@h-rig/core 0.0.6-alpha.17 → 0.0.6-alpha.170

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/src/agent-role-registry.d.ts +4 -0
  2. package/dist/src/agent-role-registry.js +27 -0
  3. package/dist/src/authority-paths.d.ts +15 -0
  4. package/dist/src/authority-paths.js +80 -0
  5. package/dist/src/baked-secrets.d.ts +6 -0
  6. package/dist/src/baked-secrets.js +121 -0
  7. package/dist/src/build-time-config.d.ts +12 -0
  8. package/dist/src/build-time-config.js +25 -0
  9. package/dist/src/build-time-config.macro.d.ts +1 -0
  10. package/dist/src/capability-loaders.d.ts +51 -0
  11. package/dist/src/capability-loaders.js +758 -0
  12. package/dist/src/capability.d.ts +79 -0
  13. package/dist/src/capability.js +63 -0
  14. package/dist/src/checkout-root.d.ts +1 -0
  15. package/dist/src/checkout-root.js +30 -0
  16. package/dist/src/config-env.d.ts +4 -0
  17. package/dist/src/config-env.js +23 -0
  18. package/dist/src/config.d.ts +3 -0
  19. package/dist/src/config.js +44 -0
  20. package/dist/src/declarative-config.d.ts +14 -0
  21. package/dist/src/declarative-config.js +82 -0
  22. package/dist/src/default-kernel.d.ts +1 -0
  23. package/dist/src/default-kernel.js +12 -0
  24. package/dist/src/define-config.d.ts +20 -0
  25. package/dist/src/define-config.js +28 -15
  26. package/dist/src/define-plugin.d.ts +13 -0
  27. package/dist/src/define-plugin.js +4 -43
  28. package/dist/src/embedded-plugins.d.ts +59 -0
  29. package/dist/src/embedded-plugins.js +22 -0
  30. package/dist/src/exec.d.ts +13 -0
  31. package/dist/src/exec.js +101 -0
  32. package/dist/src/harness-paths.d.ts +18 -0
  33. package/dist/src/harness-paths.js +141 -0
  34. package/dist/src/hook-materializer.d.ts +72 -0
  35. package/dist/src/hook-materializer.js +281 -0
  36. package/dist/src/hook-protocol.d.ts +2 -0
  37. package/dist/src/hook-protocol.js +462 -0
  38. package/dist/src/hook-runner.d.ts +48 -0
  39. package/dist/src/hook-runner.js +756 -0
  40. package/dist/src/hook-runtime.d.ts +52 -0
  41. package/dist/src/hook-runtime.js +462 -0
  42. package/dist/src/index.d.ts +8 -0
  43. package/dist/src/index.js +210 -2499
  44. package/dist/src/json-files.d.ts +9 -0
  45. package/dist/src/json-files.js +125 -0
  46. package/dist/src/kernel-boot.d.ts +2 -0
  47. package/dist/src/kernel-boot.js +10 -0
  48. package/dist/src/kernel-entrypoint.d.ts +22 -0
  49. package/dist/src/kernel-entrypoint.js +548 -0
  50. package/dist/src/kernel-plugin-abi.d.ts +1 -0
  51. package/dist/src/kernel-plugin-abi.js +1 -0
  52. package/dist/src/kernel-resolver.d.ts +2 -0
  53. package/dist/src/kernel-resolver.js +6 -0
  54. package/dist/src/layout.d.ts +10 -0
  55. package/dist/src/layout.js +144 -0
  56. package/dist/src/load-config.d.ts +2 -0
  57. package/dist/src/load-config.js +423 -30
  58. package/dist/src/placement.d.ts +50 -0
  59. package/dist/src/placement.js +996 -0
  60. package/dist/src/plugin-host-context.d.ts +66 -0
  61. package/dist/src/plugin-host-context.js +1292 -0
  62. package/dist/src/plugin-host-registries.d.ts +31 -0
  63. package/dist/src/plugin-host-registries.js +79 -0
  64. package/dist/src/plugin-host.d.ts +77 -0
  65. package/dist/src/plugin-host.js +127 -63
  66. package/dist/src/plugin-runtime.d.ts +173 -0
  67. package/dist/src/profile-ops.d.ts +9 -0
  68. package/dist/src/profile-ops.js +252 -0
  69. package/dist/src/project-plugins.d.ts +63 -0
  70. package/dist/src/project-plugins.js +793 -0
  71. package/dist/src/remote-config.d.ts +183 -0
  72. package/dist/src/remote-config.js +574 -0
  73. package/dist/src/root-resolver.d.ts +5 -0
  74. package/dist/src/root-resolver.js +69 -0
  75. package/dist/src/run-provisioning.d.ts +58 -0
  76. package/dist/src/run-provisioning.js +128 -0
  77. package/dist/src/runtime-context.d.ts +20 -0
  78. package/dist/src/runtime-context.js +257 -0
  79. package/dist/src/runtime-events.d.ts +44 -0
  80. package/dist/src/runtime-events.js +212 -0
  81. package/dist/src/runtime-overlay.d.ts +11 -0
  82. package/dist/src/runtime-overlay.js +71 -0
  83. package/dist/src/runtime-paths.d.ts +21 -0
  84. package/dist/src/runtime-paths.js +181 -0
  85. package/dist/src/runtime-provisioning-env.d.ts +5 -0
  86. package/dist/src/runtime-provisioning-env.js +217 -0
  87. package/dist/src/runtime-runner-context.d.ts +12 -0
  88. package/dist/src/runtime-runner-context.js +1 -0
  89. package/dist/src/safe-identifiers.d.ts +44 -0
  90. package/dist/src/safe-identifiers.js +96 -0
  91. package/dist/src/scope-rules.d.ts +4 -0
  92. package/dist/src/scope-rules.js +21 -0
  93. package/dist/src/server-paths.d.ts +26 -0
  94. package/dist/src/server-paths.js +308 -0
  95. package/dist/src/setup-version.d.ts +3 -0
  96. package/dist/src/setup-version.js +14 -0
  97. package/dist/src/task-record-reader.d.ts +3 -0
  98. package/dist/src/task-record-reader.js +9 -0
  99. package/dist/src/validator-registry.d.ts +27 -0
  100. package/dist/src/validator-registry.js +64 -0
  101. package/package.json +166 -10
  102. package/dist/src/engineReadModelReducer.js +0 -1780
  103. package/dist/src/rig-init-builder.js +0 -57
  104. package/dist/src/rigSelectors.js +0 -293
  105. package/dist/src/taskGraph.js +0 -64
  106. package/dist/src/taskGraphCodes.js +0 -26
  107. package/dist/src/taskGraphLayout.js +0 -374
@@ -0,0 +1,66 @@
1
+ /**
2
+ * plugin-host-context.ts
3
+ *
4
+ * Wires the new declarative plugin API into runtime startup.
5
+ *
6
+ * Calling flow:
7
+ * buildPluginHostContext(projectRoot)
8
+ * → loadConfig(projectRoot) (from @rig/core)
9
+ * → createPluginHost(cfg.plugins) (from @rig/core)
10
+ * → createValidatorRegistry() + register plugin validators
11
+ * → buildTaskSourceRegistry(config)
12
+ * → createRepoRegistry(...)
13
+ * → createAgentRoleRegistry(...)
14
+ * → createTaskFieldRegistry(...)
15
+ *
16
+ * The function is intentionally non-throwing for the "no rig.config found" case
17
+ * so harness boot can choose between explicit legacy compatibility mode and a
18
+ * no-plugin mode without masking found-but-broken configs.
19
+ *
20
+ * NOTE: registries are instantiated here. The validatorRegistry is consumed
21
+ * by CLI/harness validation and completion verification. Task dispatch and
22
+ * closeout read/update the configured plugin task source directly, with
23
+ * materialized task-config kept only as an explicit compatibility export.
24
+ */
25
+ import type { RepoRegistry, RigConfig } from "@rig/contracts";
26
+ import type { PluginHost } from "./plugin-host";
27
+ import { type TaskFieldRegistry, type TaskSourceRegistry } from "./plugin-host-registries";
28
+ import type { AgentRoleRegistry } from "@rig/contracts";
29
+ import { type ValidatorRegistry } from "./validator-registry";
30
+ /** All registries populated from the declarative RigPlugin contributions. */
31
+ export interface PluginHostContext {
32
+ /** The loaded rig.config — available for further config-driven decisions. */
33
+ config: RigConfig;
34
+ /** Flattened read-only index of all plugin contributions. */
35
+ pluginHost: PluginHost;
36
+ /** Validators contributed by plugins, ready for dispatch. */
37
+ validatorRegistry: ValidatorRegistry;
38
+ /** Task source adapter(s) configured in rig.config.taskSource. */
39
+ taskSourceRegistry: TaskSourceRegistry;
40
+ /** Repo source registrations contributed by plugins. */
41
+ repoRegistry: RepoRegistry;
42
+ /**
43
+ * Agent role registrations contributed by plugins, merged with
44
+ * config.runtime.agentRoles model overrides.
45
+ *
46
+ * NOTE: createAgentRoleRegistry throws when a role has no model. If any
47
+ * plugin-contributed role lacks defaultModel and is not covered by a config
48
+ * override, registry construction fails. The outer try/catch in
49
+ * buildPluginHostContext propagates this as-is so the operator sees the error
50
+ * rather than silently losing roles.
51
+ */
52
+ agentRoleRegistry: AgentRoleRegistry;
53
+ /** Task field schema extensions contributed by plugins. */
54
+ taskFieldRegistry: TaskFieldRegistry;
55
+ }
56
+ /**
57
+ * Load the project's rig.config, build a plugin host from its declared plugins,
58
+ * and instantiate all runtime registries from the plugin contributions.
59
+ *
60
+ * @returns The populated context, or `null` if no rig.config was found.
61
+ *
62
+ * @throws If a rig.config IS found but is invalid (schema error, duplicate
63
+ * plugin ids, missing model on an agent role, etc.). A found-but-broken
64
+ * config should surface immediately rather than falling back silently.
65
+ */
66
+ export declare function buildPluginHostContext(projectRoot: string): Promise<PluginHostContext | null>;