@jstn-sdk/ma 0.1.12 → 0.14.0

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 (198) hide show
  1. package/.codex/agents/Architect.toml +1 -2
  2. package/.codex/agents/Auditor.toml +1 -2
  3. package/.codex/agents/Builder.toml +1 -2
  4. package/.codex/agents/Flow.toml +1 -2
  5. package/.codex/agents/Sage.toml +1 -2
  6. package/.codex/agents/Vibe.toml +1 -2
  7. package/.codex/hooks.json +24 -13
  8. package/.codex/prompts/enforcement.md +4 -0
  9. package/.codex/prompts/onboarding.md +6 -1
  10. package/.codex/prompts/release-rules.md +0 -0
  11. package/.codex/prompts/skill-contract.md +4 -0
  12. package/COVERAGE.md +211 -0
  13. package/DEMO.md +274 -0
  14. package/LICENSE +0 -0
  15. package/README.md +132 -656
  16. package/bin/ma.js +748 -55
  17. package/data/clone-data.ledger.json +41 -0
  18. package/data/clone-data.proof.json +50 -0
  19. package/data/clone-data.rvf +37 -0
  20. package/docs/README.md +10 -1
  21. package/docs/autonomous-tasks.md +46 -0
  22. package/docs/codex-integration.md +16 -0
  23. package/docs/getting-started.md +62 -22
  24. package/docs/mcp-setup.md +64 -0
  25. package/docs/qa/release-issue-gates-0.14.0.json +644 -0
  26. package/docs/qa/release-readiness-0.1.5.md +1 -1
  27. package/docs/qa/{release-readiness-0.1.12.md → release-readiness-0.14.0.md} +25 -9
  28. package/docs/quality.md +24 -0
  29. package/docs/reference/native-security-playbooks.md +6 -0
  30. package/docs/reference/native-source-selection.md +6 -0
  31. package/docs/release-spec.md +39 -10
  32. package/docs/skills.md +14 -1
  33. package/index.js +295 -2
  34. package/mcp/collections.json +23 -6
  35. package/mcp/fallback.json +0 -0
  36. package/mcp/local/code-intel.js +179 -41
  37. package/mcp/local/context.js +180 -0
  38. package/mcp/local/memory.js +17 -6
  39. package/mcp/local/quality.js +39 -0
  40. package/mcp/local/state.js +7 -3
  41. package/mcp/local/team-run.js +56 -4
  42. package/mcp/local-capabilities.json +9 -0
  43. package/mcp/servers.json +24 -0
  44. package/package.json +29 -4
  45. package/plugins/meta-architect/.app.json +1 -1
  46. package/plugins/meta-architect/.codex-plugin/plugin.json +1 -1
  47. package/plugins/meta-architect/.mcp.json +1 -1
  48. package/plugins/meta-architect/README.md +8 -1
  49. package/plugins/meta-architect/obsidian/main.js +534 -0
  50. package/plugins/meta-architect/obsidian/manifest.json +9 -0
  51. package/plugins/meta-architect/obsidian/styles.css +7 -0
  52. package/plugins/meta-architect/skills/arch/SKILL.md +2 -0
  53. package/plugins/meta-architect/skills/build/SKILL.md +3 -0
  54. package/plugins/meta-architect/skills/flow/SKILL.md +2 -0
  55. package/plugins/meta-architect/skills/sage/SKILL.md +2 -0
  56. package/plugins/meta-architect/skills/sage/references/source-selection.md +8 -0
  57. package/plugins/meta-architect/skills/vet/SKILL.md +2 -0
  58. package/plugins/meta-architect/skills/vet/references/security-playbooks.md +7 -0
  59. package/plugins/meta-architect/skills/vibe/SKILL.md +2 -0
  60. package/schemas/autonomous-task-queue.schema.json +56 -0
  61. package/schemas/handoff-packet.schema.json +36 -0
  62. package/schemas/setup-receipt.schema.json +28 -0
  63. package/schemas/skill-frontmatter.schema.json +20 -0
  64. package/schemas/support-bundle.schema.json +37 -0
  65. package/schemas/task-contract.schema.json +31 -0
  66. package/scripts/active-autonomy-hook.mjs +226 -0
  67. package/scripts/build-linux-packages.mjs +7 -3
  68. package/scripts/cleanup-test-fixtures.sh +55 -0
  69. package/scripts/context-hydration-hook.mjs +89 -0
  70. package/scripts/demo-smoke.js +285 -0
  71. package/scripts/doctor.js +27 -12
  72. package/scripts/install.sh +57 -0
  73. package/scripts/install.sh.sha256 +1 -0
  74. package/scripts/linux-package-smoke.mjs +2 -2
  75. package/scripts/package-size-check.mjs +26 -0
  76. package/scripts/plugin-sync.js +83 -17
  77. package/scripts/postinstall.js +17 -10
  78. package/scripts/prepack.js +9 -0
  79. package/scripts/ralph/prompt.md +35 -0
  80. package/scripts/release-sync.js +72 -7
  81. package/scripts/release-verify.js +260 -2
  82. package/scripts/setup-npmrc.js +48 -23
  83. package/scripts/skills-install.js +9 -2
  84. package/scripts/skills-manifest.js +2 -21
  85. package/scripts/skills-pack.js +2 -2
  86. package/scripts/skills-validate.js +5 -55
  87. package/skills/arch/SKILL.md +2 -0
  88. package/skills/build/SKILL.md +3 -0
  89. package/skills/flow/SKILL.md +2 -0
  90. package/skills/index.json +0 -0
  91. package/skills/sage/SKILL.md +2 -0
  92. package/skills/sage/references/source-selection.md +8 -0
  93. package/skills/vet/SKILL.md +2 -0
  94. package/skills/vet/references/security-playbooks.md +7 -0
  95. package/skills/vibe/SKILL.md +2 -0
  96. package/sprint/00-idea.md +0 -0
  97. package/sprint/01-architecture.md +0 -0
  98. package/sprint/02-oss-evidence.md +0 -0
  99. package/sprint/03-logic.md +0 -0
  100. package/sprint/04-security.md +0 -0
  101. package/sprint/05-dx-ux.md +0 -0
  102. package/sprint/06-build-plan.md +0 -0
  103. package/sprint/07-release.md +0 -0
  104. package/src/agents.js +279 -0
  105. package/src/bootstrap.js +268 -62
  106. package/src/build-gate.js +2 -2
  107. package/src/codex-app-server.js +291 -0
  108. package/src/decision-log.js +0 -0
  109. package/src/fs-utils.js +175 -4
  110. package/src/launcher.js +28 -21
  111. package/src/mcp-config.js +9 -1
  112. package/src/mcp-live-client.js +422 -3
  113. package/src/paths.js +10 -1
  114. package/src/policy.js +3 -3
  115. package/src/prelaunch.js +189 -0
  116. package/src/quality/ai-quality-orchestrator.js +328 -0
  117. package/src/release-issue-gates.js +252 -0
  118. package/src/release-operations.js +62 -0
  119. package/src/release-state.js +0 -0
  120. package/src/runtime/active-autonomy-core.js +208 -0
  121. package/src/runtime/agent-compat.js +31 -0
  122. package/src/runtime/alignment-sentinel.js +165 -0
  123. package/src/runtime/architect-review.js +326 -0
  124. package/src/runtime/autonomous-tasks.js +408 -0
  125. package/src/runtime/build-readiness.js +28 -4
  126. package/src/runtime/code-graph-rehearse.js +113 -0
  127. package/src/runtime/codeburn-core.js +112 -0
  128. package/src/runtime/context-authority.js +40 -0
  129. package/src/runtime/context-economy-core.js +316 -0
  130. package/src/runtime/continuity-graph.js +201 -0
  131. package/src/runtime/continuity-notes.js +71 -26
  132. package/src/runtime/core-source-ingest.js +379 -0
  133. package/src/runtime/detached-provider.js +142 -0
  134. package/src/runtime/doctor-report.js +18 -0
  135. package/src/runtime/environment-awareness-core.js +460 -0
  136. package/src/runtime/exposure-catalog.js +276 -0
  137. package/src/runtime/graphify-core.js +167 -0
  138. package/src/runtime/guidance-stack.js +9 -2
  139. package/src/runtime/handoff-packets.js +92 -0
  140. package/src/runtime/headroom-core.js +104 -0
  141. package/src/runtime/helper-orchestration-core.js +307 -0
  142. package/src/runtime/hook-profiles.js +20 -0
  143. package/src/runtime/learning-loop-core.js +344 -0
  144. package/src/runtime/live-agent-verification.js +122 -0
  145. package/src/runtime/maestro-events.js +18 -0
  146. package/src/runtime/maestro-manager.js +19 -0
  147. package/src/runtime/maestro-output.js +58 -0
  148. package/src/runtime/maestro-state.js +125 -0
  149. package/src/runtime/managed-markdown.js +29 -0
  150. package/src/runtime/mcp-authority.js +147 -0
  151. package/src/runtime/mcp-policy.js +192 -0
  152. package/src/runtime/obsidian-integration-core.js +1089 -0
  153. package/src/runtime/obsidian-plugin-bridge.js +1045 -0
  154. package/src/runtime/pi-maestro-core.js +89 -0
  155. package/src/runtime/preferences.js +79 -0
  156. package/src/runtime/project-context.js +636 -0
  157. package/src/runtime/prompt-strategy-core.js +230 -0
  158. package/src/runtime/quorum-review.js +90 -0
  159. package/src/runtime/ralph-execution-core.js +217 -0
  160. package/src/runtime/redaction-gateway.js +373 -0
  161. package/src/runtime/runtime-state.js +935 -2
  162. package/src/runtime/schema-migrations.js +162 -0
  163. package/src/runtime/semantic-recording-core.js +147 -0
  164. package/src/runtime/signal-hooks.js +28 -0
  165. package/src/runtime/skills-registry-export.js +754 -0
  166. package/src/runtime/task-contracts.js +83 -0
  167. package/src/runtime/universal-plugin-broker-core.js +898 -0
  168. package/src/runtime/workspace-intelligence-runtime.js +674 -0
  169. package/src/runtime/workspace-virtualizer.js +102 -0
  170. package/src/runtime-artifacts.js +225 -62
  171. package/src/setup-lifecycle.js +359 -0
  172. package/src/skill-frontmatter.js +78 -0
  173. package/src/skill-installer.js +226 -71
  174. package/src/skills.js +1166 -96
  175. package/src/state-sync.js +0 -0
  176. package/src/test-fixtures.js +543 -0
  177. package/src/tui/grid.js +67 -0
  178. package/src/tui/status-grid.js +23 -0
  179. package/support-bundle.json +114 -0
  180. package/templates/AGENTS.md +6 -2
  181. package/templates/catalog-manifest.json +0 -0
  182. package/templates/model-instructions/core.md +0 -0
  183. package/templates/model-instructions/release.md +0 -0
  184. package/templates/model-instructions/security.md +0 -0
  185. package/templates/quality/ai-quality-rules.yml +37 -0
  186. package/docs/assets/image/Screenshot(1).png +0 -0
  187. package/docs/assets/image/Screenshot(2).png +0 -0
  188. package/docs/assets/image/Screenshot(3).png +0 -0
  189. package/docs/assets/image/Screenshot(4).png +0 -0
  190. package/docs/assets/image/Screenshot(5).png +0 -0
  191. package/docs/assets/image/Screenshot(6).png +0 -0
  192. package/docs/assets/image/Screenshot(7).png +0 -0
  193. package/docs/assets/image/Screenshot(8).png +0 -0
  194. package/docs/assets/image/Screenshot(9).png +0 -0
  195. package/docs/assets/meta-architect-logo.png +0 -0
  196. package/docs/assets/meta-architect-logo.svg +0 -8
  197. package/docs/onboarding.md +0 -65
  198. package/docs/skills-publishing.md +0 -255
@@ -0,0 +1,89 @@
1
+ export function isPiMaestroEnabled(env = process.env) {
2
+ return env.MA_MAESTRO_PI === "1";
3
+ }
4
+
5
+ export function assertPiMaestroToolAllowed(
6
+ name,
7
+ { controlPlaneReady = true, buildReadiness } = {},
8
+ ) {
9
+ if (!controlPlaneReady) throw new Error(`${name} blocked by control-plane readiness`);
10
+ if (name === "$build" && buildReadiness && buildReadiness.allowed !== true) {
11
+ throw new Error(
12
+ `$build blocked: ${(buildReadiness.blockers ?? []).join("; ") || "readiness failed"}`,
13
+ );
14
+ }
15
+ }
16
+
17
+ export function createPiMaestroToolSurface({
18
+ runners = {},
19
+ controlPlaneReady = true,
20
+ buildReadiness,
21
+ beforeToolCall,
22
+ afterToolCall,
23
+ isWaitingReview = () => false,
24
+ } = {}) {
25
+ const surface = {
26
+ tools: {},
27
+ async dispatch(name, input = {}) {
28
+ if (!runners[name]) throw new Error(`Unknown pi-maestro tool: ${name}`);
29
+ if (isWaitingReview()) return { terminate: true, status: "WAITING_REVIEW" };
30
+ assertPiMaestroToolAllowed(name, { controlPlaneReady, buildReadiness });
31
+ await beforeToolCall?.(name, input);
32
+ const result = await runners[name](input);
33
+ await afterToolCall?.(name, result);
34
+ return { terminate: false, result };
35
+ },
36
+ };
37
+ surface.tools = Object.fromEntries(
38
+ Object.keys(runners).map((name) => [
39
+ name,
40
+ {
41
+ name,
42
+ description: `Run the bounded ${name} Meta-Architect lane`,
43
+ execute: (input) => surface.dispatch(name, input),
44
+ },
45
+ ]),
46
+ );
47
+ return surface;
48
+ }
49
+
50
+ export const maestroGateLanes = ["$arch", "$sage", "$flow", "$vet", "$vibe", "$build"];
51
+
52
+ export function createPiMaestroCapabilityMapping({
53
+ runners = {},
54
+ enabled = isPiMaestroEnabled(),
55
+ ...options
56
+ } = {}) {
57
+ const laneRunners = Object.fromEntries(
58
+ maestroGateLanes
59
+ .filter((lane) => typeof runners[lane] === "function")
60
+ .map((lane) => [lane, runners[lane]]),
61
+ );
62
+ return {
63
+ enabled,
64
+ controlModel: "maestro-pi",
65
+ umbrella: "$maestro",
66
+ lanes: maestroGateLanes.map((id) => ({
67
+ id,
68
+ runner: laneRunners[id] ? "maestro" : "unavailable",
69
+ gated: id === "$build" || id === "$vet",
70
+ })),
71
+ surface: createPiMaestroToolSurface({ runners: laneRunners, ...options }),
72
+ };
73
+ }
74
+
75
+ export async function runPiMaestroExperimental({
76
+ agent,
77
+ tools,
78
+ beforeToolCall,
79
+ afterToolCall,
80
+ } = {}) {
81
+ if (!agent || typeof agent.run !== "function") {
82
+ return {
83
+ handled: false,
84
+ reason: "Maestro Pi control runtime is not installed or was not provided",
85
+ };
86
+ }
87
+ const result = await agent.run({ tools, beforeToolCall, afterToolCall });
88
+ return { handled: true, result };
89
+ }
@@ -0,0 +1,79 @@
1
+ import { ensureDir, readJson, writeFileIfMissing, writeJson } from "../fs-utils.js";
2
+ import { getRuntimeSubsystemPath } from "../paths.js";
3
+ import { maskSensitiveText } from "./redaction-gateway.js";
4
+
5
+ const scopes = ["user-local", "project-shared", "session-only"];
6
+ const precedence = ["session-only", "project-shared", "user-local"];
7
+
8
+ export function getPreferencesPath() {
9
+ return getRuntimeSubsystemPath("memory", "preferences.json");
10
+ }
11
+
12
+ export function createDefaultPreferences() {
13
+ return { schemaVersion: "0.1.0", preferences: {} };
14
+ }
15
+
16
+ export async function seedPreferences() {
17
+ await ensureDir(getRuntimeSubsystemPath("memory"));
18
+ await writeFileIfMissing(
19
+ getPreferencesPath(),
20
+ `${JSON.stringify(createDefaultPreferences(), null, 2)}\n`,
21
+ );
22
+ }
23
+
24
+ function sanitize(value) {
25
+ if (typeof value === "string") return maskSensitiveText(value).sanitizedText;
26
+ if (Array.isArray(value)) return value.map(sanitize);
27
+ if (value && typeof value === "object") {
28
+ return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, sanitize(item)]));
29
+ }
30
+ return value;
31
+ }
32
+
33
+ export async function loadPreferences() {
34
+ return readJson(getPreferencesPath()).catch(() => createDefaultPreferences());
35
+ }
36
+
37
+ export async function setPreference(key, value, { scope = "project-shared" } = {}) {
38
+ if (!key || !scopes.includes(scope)) throw new Error(`Unsupported preference scope: ${scope}`);
39
+ const current = await loadPreferences();
40
+ const next = {
41
+ ...current,
42
+ preferences: {
43
+ ...current.preferences,
44
+ [key]: { ...(current.preferences?.[key] ?? {}), [scope]: sanitize(value) },
45
+ },
46
+ };
47
+ await writeJson(getPreferencesPath(), next);
48
+ return next.preferences[key];
49
+ }
50
+
51
+ export async function clearPreference(key, { scope } = {}) {
52
+ const current = await loadPreferences();
53
+ if (!current.preferences?.[key]) return false;
54
+ const next = { ...current, preferences: { ...current.preferences } };
55
+ if (scope) {
56
+ if (!scopes.includes(scope)) throw new Error(`Unsupported preference scope: ${scope}`);
57
+ next.preferences[key] = { ...next.preferences[key] };
58
+ delete next.preferences[key][scope];
59
+ if (Object.keys(next.preferences[key]).length === 0) delete next.preferences[key];
60
+ } else delete next.preferences[key];
61
+ await writeJson(getPreferencesPath(), next);
62
+ return true;
63
+ }
64
+
65
+ export async function listPreferences() {
66
+ return (await loadPreferences()).preferences;
67
+ }
68
+
69
+ export async function resolvePreferences() {
70
+ const stored = await listPreferences();
71
+ return Object.fromEntries(
72
+ Object.entries(stored).map(([key, values]) => {
73
+ const scope = precedence.find((candidate) => values?.[candidate] !== undefined);
74
+ return [key, scope ? { value: values[scope], scope } : null];
75
+ }),
76
+ );
77
+ }
78
+
79
+ export { scopes as preferenceScopes };