@aaac/runtime 0.3.1 → 0.3.3
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.
- package/README.md +1 -1
- package/bin/dev-team.mjs +6018 -0
- package/dist/adapters/claude-agent-sdk.d.ts +1 -1
- package/dist/adapters/claude-agent-sdk.js +1 -1
- package/dist/adapters/mock.d.ts +1 -1
- package/dist/adapters/openai-agents-sdk.d.ts +1 -1
- package/dist/adapters/openai-agents-sdk.js +2 -2
- package/dist/{chunk-BHTHXGA3.js → chunk-4RFPLCKG.js} +7 -6
- package/dist/{chunk-BHTHXGA3.js.map → chunk-4RFPLCKG.js.map} +1 -1
- package/dist/{chunk-N2EA3TGS.js → chunk-BLPWSV4T.js} +7 -3
- package/dist/chunk-BLPWSV4T.js.map +1 -0
- package/dist/{chunk-EBMQHLXY.js → chunk-CRKN7CIO.js} +2 -2
- package/dist/{chunk-KTVMMG33.js → chunk-DX3RJTWJ.js} +2 -17
- package/dist/{chunk-KTVMMG33.js.map → chunk-DX3RJTWJ.js.map} +1 -1
- package/dist/{chunk-GGBNVCPV.js → chunk-EYK4E3XE.js} +3 -3
- package/dist/{chunk-5ZDW4RP7.js → chunk-K5XDDJFK.js} +2 -2
- package/dist/{chunk-2SG3TBI3.js → chunk-QQTFYLUX.js} +2 -2
- package/dist/{chunk-EA4V5DVD.js → chunk-RIXKPQFC.js} +1 -2
- package/dist/{chunk-EA4V5DVD.js.map → chunk-RIXKPQFC.js.map} +1 -1
- package/dist/claude-bundles/full.js +1 -1
- package/dist/claude-bundles/lean.js +1 -1
- package/dist/generator/index.js +2 -2
- package/dist/{hooks-lite-BtOGc2F_.d.ts → hooks-lite-inKV2rv8.d.ts} +5 -5
- package/dist/index.d.ts +16 -9
- package/dist/index.js +110 -139
- package/dist/index.js.map +1 -1
- package/dist/lib/claude-native/hooks-lite.d.ts +1 -1
- package/dist/lib/claude-native/hooks-lite.js +4 -4
- package/dist/lib/claude-native/hooks-prompt.js +4 -4
- package/dist/lib/claude-native/index.d.ts +1 -1
- package/dist/lib/claude-native/index.js +7 -7
- package/dist/{task-runner-CgQx1KUq.d.ts → task-runner-Cpr-GTrl.d.ts} +4 -6
- package/package.json +10 -18
- package/dist/adapters/adk-sdk.d.ts +0 -139
- package/dist/adapters/adk-sdk.js +0 -312
- package/dist/adapters/adk-sdk.js.map +0 -1
- package/dist/chunk-N2EA3TGS.js.map +0 -1
- /package/dist/{chunk-EBMQHLXY.js.map → chunk-CRKN7CIO.js.map} +0 -0
- /package/dist/{chunk-GGBNVCPV.js.map → chunk-EYK4E3XE.js.map} +0 -0
- /package/dist/{chunk-5ZDW4RP7.js.map → chunk-K5XDDJFK.js.map} +0 -0
- /package/dist/{chunk-2SG3TBI3.js.map → chunk-QQTFYLUX.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BoundResolver,
|
|
3
|
-
DslValidationError,
|
|
4
|
-
buildAgentRegistry,
|
|
5
|
-
buildNavigationContext,
|
|
6
|
-
buildPerAgentGuardrails,
|
|
7
|
-
buildRegistriesFromDsl,
|
|
8
|
-
deriveToolchainsForAgents,
|
|
9
|
-
getEffectiveGuardrailIds,
|
|
10
|
-
getGuardrailRulesForAgent,
|
|
11
|
-
guardrailContextToRuleData,
|
|
12
|
-
loadDslContext,
|
|
13
|
-
resolveArtifacts,
|
|
14
|
-
resolveGuardrailContext,
|
|
15
|
-
resolveHandoffSchemas,
|
|
16
|
-
resolveNavigationDsl,
|
|
17
|
-
resolveNavigationSources
|
|
18
|
-
} from "./chunk-N2EA3TGS.js";
|
|
19
|
-
import {
|
|
20
|
-
jsonSchemaToZod
|
|
21
|
-
} from "./chunk-ET6TGQRT.js";
|
|
22
1
|
import {
|
|
23
2
|
AdapterError,
|
|
24
3
|
adapterErrorKind,
|
|
@@ -46,20 +25,41 @@ import {
|
|
|
46
25
|
isContextPack,
|
|
47
26
|
renderContextPackPrompt,
|
|
48
27
|
serializeObserverEmit
|
|
49
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-DX3RJTWJ.js";
|
|
29
|
+
import {
|
|
30
|
+
BoundResolver,
|
|
31
|
+
DslValidationError,
|
|
32
|
+
buildAgentRegistry,
|
|
33
|
+
buildNavigationContext,
|
|
34
|
+
buildPerAgentGuardrails,
|
|
35
|
+
buildRegistriesFromDsl,
|
|
36
|
+
deriveToolchainsForAgents,
|
|
37
|
+
getEffectiveGuardrailIds,
|
|
38
|
+
getGuardrailRulesForAgent,
|
|
39
|
+
guardrailContextToRuleData,
|
|
40
|
+
loadDslContext,
|
|
41
|
+
resolveArtifacts,
|
|
42
|
+
resolveGuardrailContext,
|
|
43
|
+
resolveHandoffSchemas,
|
|
44
|
+
resolveNavigationDsl,
|
|
45
|
+
resolveNavigationSources
|
|
46
|
+
} from "./chunk-BLPWSV4T.js";
|
|
47
|
+
import {
|
|
48
|
+
jsonSchemaToZod
|
|
49
|
+
} from "./chunk-ET6TGQRT.js";
|
|
50
50
|
import {
|
|
51
51
|
PROJECT_CONFIG_FILENAME,
|
|
52
52
|
loadProjectConfig,
|
|
53
53
|
loadWorkspaceMembers,
|
|
54
54
|
readProjectManifest
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-K5XDDJFK.js";
|
|
56
56
|
import {
|
|
57
57
|
isNavigationIndex,
|
|
58
58
|
renderNavigationIndexPrompt
|
|
59
59
|
} from "./chunk-3CLWG72V.js";
|
|
60
60
|
import {
|
|
61
61
|
editProtection
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-CRKN7CIO.js";
|
|
63
63
|
import {
|
|
64
64
|
UNRESOLVED_GUARDRAIL_ACTION,
|
|
65
65
|
createGuardrailHooks,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
hasBlockingViolation,
|
|
70
70
|
toolTargetPath,
|
|
71
71
|
toolWriteTarget
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-RIXKPQFC.js";
|
|
73
73
|
import {
|
|
74
74
|
__commonJS,
|
|
75
75
|
__require,
|
|
@@ -6342,11 +6342,7 @@ var PRICING_TABLE = {
|
|
|
6342
6342
|
"gpt-5.3-codex": { inputPerMillion: 2.5, outputPerMillion: 10 },
|
|
6343
6343
|
"gpt-4.1": { inputPerMillion: 2, outputPerMillion: 8 },
|
|
6344
6344
|
"gpt-4o": { inputPerMillion: 2.5, outputPerMillion: 10 },
|
|
6345
|
-
"gpt-4o-mini": { inputPerMillion: 0.15, outputPerMillion: 0.6 }
|
|
6346
|
-
// Google Gemini
|
|
6347
|
-
"gemini-2.5-pro": { inputPerMillion: 1.25, outputPerMillion: 10 },
|
|
6348
|
-
"gemini-2.5-flash": { inputPerMillion: 0.15, outputPerMillion: 0.6 },
|
|
6349
|
-
"gemini-2.0-flash": { inputPerMillion: 0.1, outputPerMillion: 0.4 }
|
|
6345
|
+
"gpt-4o-mini": { inputPerMillion: 0.15, outputPerMillion: 0.6 }
|
|
6350
6346
|
};
|
|
6351
6347
|
function resolveModelPricing(model) {
|
|
6352
6348
|
if (!model) return void 0;
|
|
@@ -7208,15 +7204,11 @@ Please re-execute the entire task.`
|
|
|
7208
7204
|
|
|
7209
7205
|
// src/lib/toolchain-checker.ts
|
|
7210
7206
|
import { execFile } from "child_process";
|
|
7211
|
-
import { readFile } from "fs/promises";
|
|
7212
|
-
import { existsSync } from "fs";
|
|
7213
|
-
import { resolve } from "path";
|
|
7214
7207
|
import { promisify } from "util";
|
|
7215
7208
|
import { z as z2 } from "zod";
|
|
7216
7209
|
import { parseToolchainFile } from "@aaac/toolchain";
|
|
7217
7210
|
var execFileAsync = promisify(execFile);
|
|
7218
7211
|
var SUBPROCESS_TIMEOUT_MS = 3e4;
|
|
7219
|
-
var MANIFEST_FILENAME = ".toolchain-manifest.json";
|
|
7220
7212
|
var ToolchainManifestSchema = z2.object({
|
|
7221
7213
|
schema: z2.string(),
|
|
7222
7214
|
toolchain_id: z2.string(),
|
|
@@ -7237,25 +7229,6 @@ function resolveAction(checkType, checkTypeActions, defaultAction) {
|
|
|
7237
7229
|
if (checkTypeActions?.["_default"]) return checkTypeActions["_default"];
|
|
7238
7230
|
return defaultAction ?? "warn";
|
|
7239
7231
|
}
|
|
7240
|
-
async function tryManifestFastPath(toolchainId, cwd) {
|
|
7241
|
-
const manifestPath = resolve(cwd, MANIFEST_FILENAME);
|
|
7242
|
-
if (!existsSync(manifestPath)) return null;
|
|
7243
|
-
try {
|
|
7244
|
-
const raw = await readFile(manifestPath, "utf-8");
|
|
7245
|
-
const parsed = ToolchainManifestSchema.parse(JSON.parse(raw));
|
|
7246
|
-
if (parsed.toolchain_id !== toolchainId) return null;
|
|
7247
|
-
return {
|
|
7248
|
-
toolchainId,
|
|
7249
|
-
checkType: "drift",
|
|
7250
|
-
status: "pass",
|
|
7251
|
-
action: "warn",
|
|
7252
|
-
message: `Manifest fast path: ${MANIFEST_FILENAME} found, toolchain_id matches`,
|
|
7253
|
-
durationMs: 0
|
|
7254
|
-
};
|
|
7255
|
-
} catch {
|
|
7256
|
-
return null;
|
|
7257
|
-
}
|
|
7258
|
-
}
|
|
7259
7232
|
async function executeCheck(command, cwd, observabilityIds) {
|
|
7260
7233
|
const env = observabilityIds ? buildObservabilityEnv(observabilityIds) : void 0;
|
|
7261
7234
|
try {
|
|
@@ -7310,33 +7283,27 @@ async function runToolchainChecks(options) {
|
|
|
7310
7283
|
componentId
|
|
7311
7284
|
);
|
|
7312
7285
|
let result;
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
result =
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
status: "error",
|
|
7335
|
-
action,
|
|
7336
|
-
message: err.message,
|
|
7337
|
-
durationMs
|
|
7338
|
-
};
|
|
7339
|
-
}
|
|
7286
|
+
try {
|
|
7287
|
+
const { exitCode, stderr } = await executeCheck(command, cwd, observabilityIds);
|
|
7288
|
+
const durationMs = Math.round(performance.now() - start);
|
|
7289
|
+
result = {
|
|
7290
|
+
toolchainId,
|
|
7291
|
+
checkType,
|
|
7292
|
+
status: exitCode === 0 ? "pass" : "fail",
|
|
7293
|
+
action,
|
|
7294
|
+
message: exitCode === 0 ? void 0 : stderr.trim() || `exit code ${exitCode}`,
|
|
7295
|
+
durationMs
|
|
7296
|
+
};
|
|
7297
|
+
} catch (err) {
|
|
7298
|
+
const durationMs = Math.round(performance.now() - start);
|
|
7299
|
+
result = {
|
|
7300
|
+
toolchainId,
|
|
7301
|
+
checkType,
|
|
7302
|
+
status: "error",
|
|
7303
|
+
action,
|
|
7304
|
+
message: err.message,
|
|
7305
|
+
durationMs
|
|
7306
|
+
};
|
|
7340
7307
|
}
|
|
7341
7308
|
results.push(result);
|
|
7342
7309
|
emitToolchainClose(
|
|
@@ -8117,8 +8084,8 @@ var WorkflowBuilder = class {
|
|
|
8117
8084
|
};
|
|
8118
8085
|
|
|
8119
8086
|
// src/lib/plugin-loader.ts
|
|
8120
|
-
import { existsSync
|
|
8121
|
-
import { resolve
|
|
8087
|
+
import { existsSync } from "fs";
|
|
8088
|
+
import { resolve } from "path";
|
|
8122
8089
|
function isPluginLike(obj) {
|
|
8123
8090
|
return typeof obj === "object" && obj !== null && typeof obj.id === "string";
|
|
8124
8091
|
}
|
|
@@ -8139,8 +8106,8 @@ async function loadPluginModule(modulePath) {
|
|
|
8139
8106
|
async function loadPlugins(paths, baseDir) {
|
|
8140
8107
|
const result = { loaded: 0, files: [] };
|
|
8141
8108
|
for (const p of paths) {
|
|
8142
|
-
const absPath2 =
|
|
8143
|
-
if (!
|
|
8109
|
+
const absPath2 = resolve(baseDir, p);
|
|
8110
|
+
if (!existsSync(absPath2)) {
|
|
8144
8111
|
throw new Error(
|
|
8145
8112
|
`Plugin not found: ${absPath2} (declared by the project manifest's \`plugins:\`).`
|
|
8146
8113
|
);
|
|
@@ -8268,7 +8235,7 @@ var InMemoryStore = class {
|
|
|
8268
8235
|
};
|
|
8269
8236
|
|
|
8270
8237
|
// src/lib/file-memory-store.ts
|
|
8271
|
-
import { mkdir, readFile
|
|
8238
|
+
import { mkdir, readFile, unlink, writeFile } from "fs/promises";
|
|
8272
8239
|
import { join as join2 } from "path";
|
|
8273
8240
|
import { pathSegmentForId as pathSegmentForId2 } from "@aaac/contracts";
|
|
8274
8241
|
function resolveFilePath2(baseDir, ref) {
|
|
@@ -8291,7 +8258,7 @@ var FileMemoryStore = class {
|
|
|
8291
8258
|
async load(ref) {
|
|
8292
8259
|
const filePath = resolveFilePath2(this.baseDir, ref);
|
|
8293
8260
|
try {
|
|
8294
|
-
const raw = await
|
|
8261
|
+
const raw = await readFile(filePath, "utf-8");
|
|
8295
8262
|
return JSON.parse(raw);
|
|
8296
8263
|
} catch (error) {
|
|
8297
8264
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
@@ -8314,7 +8281,7 @@ var FileMemoryStore = class {
|
|
|
8314
8281
|
};
|
|
8315
8282
|
|
|
8316
8283
|
// src/lib/agent-log-writer.ts
|
|
8317
|
-
import { mkdir as mkdir2, readFile as
|
|
8284
|
+
import { mkdir as mkdir2, readFile as readFile2, readdir, stat, unlink as unlink2, writeFile as writeFile2, appendFile } from "fs/promises";
|
|
8318
8285
|
import { join as join3 } from "path";
|
|
8319
8286
|
import { pathSegmentForId as pathSegmentForId3 } from "@aaac/contracts";
|
|
8320
8287
|
var RUN_LOG_EVENT_TYPES = [
|
|
@@ -8370,7 +8337,7 @@ var AgentLogWriter = class {
|
|
|
8370
8337
|
async readRunLog(runId) {
|
|
8371
8338
|
const filePath = this.runLogPath(runId);
|
|
8372
8339
|
try {
|
|
8373
|
-
const raw = await
|
|
8340
|
+
const raw = await readFile2(filePath, "utf-8");
|
|
8374
8341
|
const events = [];
|
|
8375
8342
|
for (const line of raw.split("\n")) {
|
|
8376
8343
|
if (line.trim().length === 0) continue;
|
|
@@ -8398,7 +8365,7 @@ var AgentLogWriter = class {
|
|
|
8398
8365
|
async readHandoff(runId, step) {
|
|
8399
8366
|
const filePath = this.handoffPath(runId, step);
|
|
8400
8367
|
try {
|
|
8401
|
-
const raw = await
|
|
8368
|
+
const raw = await readFile2(filePath, "utf-8");
|
|
8402
8369
|
return JSON.parse(raw);
|
|
8403
8370
|
} catch (error) {
|
|
8404
8371
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
@@ -8532,7 +8499,6 @@ function createRegistryFromSdkTools(tools) {
|
|
|
8532
8499
|
// src/lib/adapter-factory.ts
|
|
8533
8500
|
var ADAPTER_PACKAGES = {
|
|
8534
8501
|
claude: "@anthropic-ai/claude-agent-sdk",
|
|
8535
|
-
gemini: "@google/adk",
|
|
8536
8502
|
openai: "@openai/agents"
|
|
8537
8503
|
};
|
|
8538
8504
|
async function createAdapter(name, options) {
|
|
@@ -8558,17 +8524,6 @@ async function createAdapter(name, options) {
|
|
|
8558
8524
|
throwMissingPackageError("claude", err);
|
|
8559
8525
|
}
|
|
8560
8526
|
}
|
|
8561
|
-
case "gemini": {
|
|
8562
|
-
try {
|
|
8563
|
-
const { AdkSdkAdapter } = await import("./adapters/adk-sdk.js");
|
|
8564
|
-
return new AdkSdkAdapter({
|
|
8565
|
-
guardrailHooks,
|
|
8566
|
-
...model ? { model } : {}
|
|
8567
|
-
});
|
|
8568
|
-
} catch (err) {
|
|
8569
|
-
throwMissingPackageError("gemini", err);
|
|
8570
|
-
}
|
|
8571
|
-
}
|
|
8572
8527
|
case "openai": {
|
|
8573
8528
|
try {
|
|
8574
8529
|
const { OpenAIAgentsSdkAdapter } = await import("./adapters/openai-agents-sdk.js");
|
|
@@ -8583,7 +8538,7 @@ async function createAdapter(name, options) {
|
|
|
8583
8538
|
}
|
|
8584
8539
|
default:
|
|
8585
8540
|
throw new Error(
|
|
8586
|
-
`Unknown adapter: "${name}". Available: mock, claude, openai
|
|
8541
|
+
`Unknown adapter: "${name}". Available: mock, claude, openai`
|
|
8587
8542
|
);
|
|
8588
8543
|
}
|
|
8589
8544
|
}
|
|
@@ -8600,7 +8555,7 @@ Install it with: npm install ${pkg2}`
|
|
|
8600
8555
|
}
|
|
8601
8556
|
|
|
8602
8557
|
// src/lib/execute.ts
|
|
8603
|
-
import { resolve as
|
|
8558
|
+
import { resolve as resolve2 } from "path";
|
|
8604
8559
|
|
|
8605
8560
|
// src/component-scope.ts
|
|
8606
8561
|
var DEFAULT_COMPONENT_ID = "default";
|
|
@@ -8775,7 +8730,7 @@ function createExecutionProgressSink(invocationId, progressLog) {
|
|
|
8775
8730
|
return createProgressSink({
|
|
8776
8731
|
stderr: destination === "stderr" || destination === "both",
|
|
8777
8732
|
// The schema requires `file` whenever destination selects file output.
|
|
8778
|
-
...wantsFile && file ? { file:
|
|
8733
|
+
...wantsFile && file ? { file: resolve2(file), naming, label: invocationId } : {}
|
|
8779
8734
|
});
|
|
8780
8735
|
}
|
|
8781
8736
|
async function resolveExecutionContext(options, requiredEntities) {
|
|
@@ -9104,15 +9059,15 @@ async function dispatchOperation(operationName, op, options, input, ctx, handler
|
|
|
9104
9059
|
}
|
|
9105
9060
|
|
|
9106
9061
|
// src/lib/project-runtime.ts
|
|
9107
|
-
import { existsSync as
|
|
9108
|
-
import { resolve as
|
|
9062
|
+
import { existsSync as existsSync2 } from "fs";
|
|
9063
|
+
import { resolve as resolve3, dirname as dirname2 } from "path";
|
|
9109
9064
|
import { createPipeline } from "@aaac/observability";
|
|
9110
9065
|
var DEFAULT_ADAPTER = "claude";
|
|
9111
9066
|
function findProjectConfig(startDir, filename = PROJECT_CONFIG_FILENAME) {
|
|
9112
|
-
let dir =
|
|
9067
|
+
let dir = resolve3(startDir);
|
|
9113
9068
|
for (; ; ) {
|
|
9114
|
-
const candidate =
|
|
9115
|
-
if (
|
|
9069
|
+
const candidate = resolve3(dir, filename);
|
|
9070
|
+
if (existsSync2(candidate)) return candidate;
|
|
9116
9071
|
const parent = dirname2(dir);
|
|
9117
9072
|
if (parent === dir) return void 0;
|
|
9118
9073
|
dir = parent;
|
|
@@ -9124,8 +9079,8 @@ function serializeRequest(input) {
|
|
|
9124
9079
|
}
|
|
9125
9080
|
async function createProjectRuntime(options) {
|
|
9126
9081
|
const cwd = options.cwd ?? process.cwd();
|
|
9127
|
-
const configPath = options.configPath ?
|
|
9128
|
-
if (!configPath || !
|
|
9082
|
+
const configPath = options.configPath ? resolve3(cwd, options.configPath) : findProjectConfig(cwd);
|
|
9083
|
+
if (!configPath || !existsSync2(configPath)) {
|
|
9129
9084
|
const where = options.configPath ? `config path "${options.configPath}"` : `${PROJECT_CONFIG_FILENAME} from ${cwd} upward`;
|
|
9130
9085
|
throw new Error(
|
|
9131
9086
|
`No ${PROJECT_CONFIG_FILENAME} found (${where}). Pass --config <path> to a project manifest.`
|
|
@@ -9133,7 +9088,7 @@ async function createProjectRuntime(options) {
|
|
|
9133
9088
|
}
|
|
9134
9089
|
const config = await loadProjectConfig(configPath);
|
|
9135
9090
|
const env = options.env ?? process.env;
|
|
9136
|
-
if (config.dslDeclared && !
|
|
9091
|
+
if (config.dslDeclared && !existsSync2(config.dslPath)) {
|
|
9137
9092
|
throw new Error(
|
|
9138
9093
|
`Project agents DSL not found: ${config.dslPath} (referenced by ${configPath}).`
|
|
9139
9094
|
);
|
|
@@ -9244,7 +9199,7 @@ async function createProjectRuntime(options) {
|
|
|
9244
9199
|
}
|
|
9245
9200
|
|
|
9246
9201
|
// src/lib/guard-commands.ts
|
|
9247
|
-
import { readFile as
|
|
9202
|
+
import { readFile as readFile3, readdir as readdir2 } from "fs/promises";
|
|
9248
9203
|
import "yaml";
|
|
9249
9204
|
async function evaluateGuardrail(opts) {
|
|
9250
9205
|
let document;
|
|
@@ -9259,12 +9214,21 @@ async function evaluateGuardrail(opts) {
|
|
|
9259
9214
|
throw new Error("Invalid hook JSON: input must be a JSON object.");
|
|
9260
9215
|
}
|
|
9261
9216
|
const hookInput = document;
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9217
|
+
let guardrailCtx;
|
|
9218
|
+
try {
|
|
9219
|
+
guardrailCtx = await resolveGuardrailContext(
|
|
9220
|
+
opts.dsl,
|
|
9221
|
+
opts.bindingPaths,
|
|
9222
|
+
opts.activeGuardrailPolicy
|
|
9223
|
+
);
|
|
9224
|
+
} catch (cause) {
|
|
9225
|
+
const message = `[guard-unavailable] The guardrail bindings could not be read (${cause.message}), so this operation gets no verdict and is refused rather than allowed.`;
|
|
9226
|
+
return {
|
|
9227
|
+
response: { permission: "deny", user_message: message, agent_message: message },
|
|
9228
|
+
exitCode: 2,
|
|
9229
|
+
checks: []
|
|
9230
|
+
};
|
|
9231
|
+
}
|
|
9268
9232
|
const ruleData = guardrailContextToRuleData(guardrailCtx);
|
|
9269
9233
|
const hooks = createGuardrailHooksFromRules(ruleData);
|
|
9270
9234
|
const command = hookInput.command;
|
|
@@ -9350,7 +9314,7 @@ async function guardStatus(opts = {}) {
|
|
|
9350
9314
|
const filePath = `${runsDir}/${file}`;
|
|
9351
9315
|
let raw;
|
|
9352
9316
|
try {
|
|
9353
|
-
raw = await
|
|
9317
|
+
raw = await readFile3(filePath, "utf8");
|
|
9354
9318
|
} catch {
|
|
9355
9319
|
continue;
|
|
9356
9320
|
}
|
|
@@ -9447,7 +9411,7 @@ var ClaudeConfigSchema = z3.object({
|
|
|
9447
9411
|
guard_command: z3.string().optional(),
|
|
9448
9412
|
/**
|
|
9449
9413
|
* The command that runs `syncClaude` for this project (e.g.
|
|
9450
|
-
* "
|
|
9414
|
+
* "node bin/dev-team.mjs claude sync"). The CLAUDE.md block and the banner on every
|
|
9451
9415
|
* generated subagent and workflow file name it as the way to regenerate
|
|
9452
9416
|
* them. Without it they name `syncClaude` itself: the component id is not a
|
|
9453
9417
|
* command, so nothing else here says which executable runs the sync. The
|
|
@@ -9457,7 +9421,7 @@ var ClaudeConfigSchema = z3.object({
|
|
|
9457
9421
|
sync_command: z3.string().optional(),
|
|
9458
9422
|
/**
|
|
9459
9423
|
* The command that runs `checkClaude` for this project (e.g.
|
|
9460
|
-
* "
|
|
9424
|
+
* "node bin/dev-team.mjs claude check"), named in the CLAUDE.md block as the drift
|
|
9461
9425
|
* check. Without it the block names `checkClaude` itself. The project
|
|
9462
9426
|
* manifest's `bindings.claude.check_command` wins over it.
|
|
9463
9427
|
*/
|
|
@@ -9520,14 +9484,14 @@ import {
|
|
|
9520
9484
|
} from "@aaac/contracts";
|
|
9521
9485
|
|
|
9522
9486
|
// src/lib/claude-materialize/dsl-sources.ts
|
|
9523
|
-
import { existsSync as
|
|
9524
|
-
import { join as join4, resolve as
|
|
9487
|
+
import { existsSync as existsSync3 } from "fs";
|
|
9488
|
+
import { join as join4, resolve as resolve4 } from "path";
|
|
9525
9489
|
function originLabel(source) {
|
|
9526
9490
|
return source.member ?? "project";
|
|
9527
9491
|
}
|
|
9528
9492
|
async function workspaceMembersForProject(root) {
|
|
9529
9493
|
const manifestPath = join4(root, PROJECT_CONFIG_FILENAME);
|
|
9530
|
-
if (!
|
|
9494
|
+
if (!existsSync3(manifestPath)) return [];
|
|
9531
9495
|
const members = await loadWorkspaceMembers(manifestPath);
|
|
9532
9496
|
return members.map((m) => ({
|
|
9533
9497
|
name: m.name,
|
|
@@ -9537,7 +9501,7 @@ async function workspaceMembersForProject(root) {
|
|
|
9537
9501
|
}
|
|
9538
9502
|
async function resolveDslSources(root, embeddedDsl, config) {
|
|
9539
9503
|
const members = await workspaceMembersForProject(root);
|
|
9540
|
-
const roots = members.length > 0 ? members.map((m) => ({ member: m.name, root:
|
|
9504
|
+
const roots = members.length > 0 ? members.map((m) => ({ member: m.name, root: resolve4(root, m.path) })) : [{ root }];
|
|
9541
9505
|
return Promise.all(
|
|
9542
9506
|
roots.map(async ({ member, root: projectRoot }) => {
|
|
9543
9507
|
const { navigationOptions } = await resolveNavigationSources({
|
|
@@ -9762,7 +9726,6 @@ function priorContextExpr(i, steps, deps) {
|
|
|
9762
9726
|
return fragments.join(" + ");
|
|
9763
9727
|
}
|
|
9764
9728
|
function emitWorkflowInputOutputHelper(pad) {
|
|
9765
|
-
const id = WORKFLOW_INPUT_STEP_ID;
|
|
9766
9729
|
return [
|
|
9767
9730
|
`${pad}const _wfInputOutput = (args) => {`,
|
|
9768
9731
|
`${pad} if (args === undefined || args === null) return undefined`,
|
|
@@ -9778,7 +9741,7 @@ function emitWorkflowInputOutputHelper(pad) {
|
|
|
9778
9741
|
`${pad} ? { user_request: userRequest, handoff: (h.version !== undefined ? { type: h.type, version: h.version, payload: h.payload } : { type: h.type, payload: h.payload }) }`,
|
|
9779
9742
|
`${pad} : { user_request: userRequest }`,
|
|
9780
9743
|
`${pad} }`,
|
|
9781
|
-
`${pad} return { user_request: JSON.stringify(args
|
|
9744
|
+
`${pad} return { user_request: JSON.stringify(args) }`,
|
|
9782
9745
|
`${pad}}`
|
|
9783
9746
|
];
|
|
9784
9747
|
}
|
|
@@ -10358,9 +10321,9 @@ function renderEntryAgentPrompt(sources, outputDir) {
|
|
|
10358
10321
|
}
|
|
10359
10322
|
|
|
10360
10323
|
// src/lib/claude-materialize/materialize.ts
|
|
10361
|
-
import { existsSync as
|
|
10362
|
-
import { chmod, mkdir as mkdir3, readFile as
|
|
10363
|
-
import { dirname as dirname5, join as join7, resolve as
|
|
10324
|
+
import { existsSync as existsSync4 } from "fs";
|
|
10325
|
+
import { chmod, mkdir as mkdir3, readFile as readFile4, rm, stat as stat2, writeFile as writeFile3 } from "fs/promises";
|
|
10326
|
+
import { dirname as dirname5, join as join7, resolve as resolve5 } from "path";
|
|
10364
10327
|
import {
|
|
10365
10328
|
claudeGenerator,
|
|
10366
10329
|
generatedFileRelPath,
|
|
@@ -10550,6 +10513,11 @@ function recomputeMarkerFromDisk(content) {
|
|
|
10550
10513
|
function commandOf(hook) {
|
|
10551
10514
|
return typeof hook.command === "string" ? hook.command : void 0;
|
|
10552
10515
|
}
|
|
10516
|
+
function launcherOf(command) {
|
|
10517
|
+
const quoted = /^"([^"]*)"/.exec(command);
|
|
10518
|
+
if (quoted) return quoted[1];
|
|
10519
|
+
return command.split(/\s/, 1)[0];
|
|
10520
|
+
}
|
|
10553
10521
|
function isGroup(entry) {
|
|
10554
10522
|
return Array.isArray(entry.hooks);
|
|
10555
10523
|
}
|
|
@@ -10597,7 +10565,10 @@ function managedCommandsByEvent(managed) {
|
|
|
10597
10565
|
for (const [event, entries] of Object.entries(managed.hooks ?? {})) {
|
|
10598
10566
|
const cmds = /* @__PURE__ */ new Set();
|
|
10599
10567
|
for (const entry of entries) {
|
|
10600
|
-
for (const c of commandsInEntry(entry))
|
|
10568
|
+
for (const c of commandsInEntry(entry)) {
|
|
10569
|
+
cmds.add(c);
|
|
10570
|
+
cmds.add(launcherOf(c));
|
|
10571
|
+
}
|
|
10601
10572
|
}
|
|
10602
10573
|
byEvent.set(event, cmds);
|
|
10603
10574
|
}
|
|
@@ -10679,8 +10650,8 @@ function absPath(root, file) {
|
|
|
10679
10650
|
return join7(root, generatedFileRelPath(file));
|
|
10680
10651
|
}
|
|
10681
10652
|
async function readIfExists(path) {
|
|
10682
|
-
if (!
|
|
10683
|
-
return
|
|
10653
|
+
if (!existsSync4(path)) return void 0;
|
|
10654
|
+
return readFile4(path, "utf8");
|
|
10684
10655
|
}
|
|
10685
10656
|
async function renderFiles(root, dsl, config, entryAgentPrompt, protectsArtifacts) {
|
|
10686
10657
|
if (!config.emit.harness) return [];
|
|
@@ -10800,8 +10771,8 @@ async function commandFiles(sources, config, root) {
|
|
|
10800
10771
|
const outputTemplate = commandOutputTemplate(config);
|
|
10801
10772
|
let templateSource = DEFAULT_COMMAND_TEMPLATE;
|
|
10802
10773
|
if (commands.template) {
|
|
10803
|
-
const templatePath =
|
|
10804
|
-
templateSource = await
|
|
10774
|
+
const templatePath = resolve5(root, commands.template);
|
|
10775
|
+
templateSource = await readFile4(templatePath, "utf8");
|
|
10805
10776
|
}
|
|
10806
10777
|
return renderCommandFiles(sources, outputTemplate, templateSource);
|
|
10807
10778
|
}
|
|
@@ -10908,7 +10879,7 @@ function checkHookBin(file, existing) {
|
|
|
10908
10879
|
function effectiveClaudeInputs(root, raw) {
|
|
10909
10880
|
const config = parseClaudeConfig(raw);
|
|
10910
10881
|
const manifestPath = join7(root, PROJECT_CONFIG_FILENAME);
|
|
10911
|
-
if (!
|
|
10882
|
+
if (!existsSync4(manifestPath)) return { config, modelMapping: {} };
|
|
10912
10883
|
const manifest = readProjectManifest(manifestPath);
|
|
10913
10884
|
return {
|
|
10914
10885
|
config: applyProjectBinding(config, manifest.bindings?.claude),
|
|
@@ -10916,7 +10887,7 @@ function effectiveClaudeInputs(root, raw) {
|
|
|
10916
10887
|
};
|
|
10917
10888
|
}
|
|
10918
10889
|
async function syncClaude(opts) {
|
|
10919
|
-
const root =
|
|
10890
|
+
const root = resolve5(opts.projectRoot);
|
|
10920
10891
|
const { config, modelMapping } = effectiveClaudeInputs(root, opts.config);
|
|
10921
10892
|
const result = { files: [] };
|
|
10922
10893
|
const sources = await resolveDslSources(root, opts.dsl, config);
|
|
@@ -10987,7 +10958,7 @@ async function syncClaude(opts) {
|
|
|
10987
10958
|
return result;
|
|
10988
10959
|
}
|
|
10989
10960
|
async function checkClaude(opts) {
|
|
10990
|
-
const root =
|
|
10961
|
+
const root = resolve5(opts.projectRoot);
|
|
10991
10962
|
const { config, modelMapping } = effectiveClaudeInputs(root, opts.config);
|
|
10992
10963
|
const drift = [];
|
|
10993
10964
|
const skipped = [];
|