Skip to content

Commit d84ed71

Browse files
authored
Merge pull request #603 from Extra-Chill/fix-workspace-preload-early-registration
fix: register workspace preload artifacts early
2 parents a51a843 + 56b7e83 commit d84ed71

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

data-machine-code.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,25 @@ function datamachine_code_has_datamachine_integration(): bool {
6565
return class_exists('DataMachine\Abilities\PermissionHelper');
6666
}
6767

68+
/**
69+
* Register DMC-owned bundle artifact hooks.
70+
*
71+
* Bundle artifact type discovery can run before the rest of DMC's Data Machine
72+
* integrations are available. Keep these hooks registered independently so
73+
* imported agent bundles can materialize DMC-owned artifacts during install.
74+
*/
75+
function datamachine_code_register_bundle_artifacts(): void {
76+
static $registered = false;
77+
78+
if ( $registered ) {
79+
return;
80+
}
81+
82+
$registered = true;
83+
( new \DataMachineCode\Bundle\WorkspacePreloadArtifact() )->register();
84+
}
85+
datamachine_code_register_bundle_artifacts();
86+
6887
/**
6988
* Register optional Data Machine integrations.
7089
*/
@@ -77,10 +96,6 @@ function datamachine_code_register_datamachine_integrations(): void {
7796

7897
$registered = true;
7998

80-
// Bundle artifact types are Data Machine-specific and are only registered
81-
// when the bundle importer substrate is present.
82-
( new \DataMachineCode\Bundle\WorkspacePreloadArtifact() )->register();
83-
8499
// Project active workspace identity into Data Machine's engine_data snapshot.
85100
\DataMachineCode\Runtime\ActiveWorkspaceProjector::register();
86101

0 commit comments

Comments
 (0)