@aaac/runtime 0.3.2 → 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/bin/dev-team.mjs +6018 -0
- package/dist/{chunk-DUADHXC2.js → chunk-4RFPLCKG.js} +4 -3
- package/dist/{chunk-DUADHXC2.js.map → chunk-4RFPLCKG.js.map} +1 -1
- package/dist/{chunk-DNSVEP4U.js → chunk-BLPWSV4T.js} +6 -2
- package/dist/chunk-BLPWSV4T.js.map +1 -0
- package/dist/claude-bundles/full.js +1 -1
- package/dist/claude-bundles/lean.js +1 -1
- package/dist/{hooks-lite-BtOGc2F_.d.ts → hooks-lite-inKV2rv8.d.ts} +5 -5
- package/dist/index.d.ts +12 -5
- package/dist/index.js +72 -92
- 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 +1 -1
- package/dist/lib/claude-native/index.d.ts +1 -1
- package/dist/lib/claude-native/index.js +2 -2
- package/package.json +8 -5
- package/dist/chunk-DNSVEP4U.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
resolveHandoffSchemas,
|
|
44
44
|
resolveNavigationDsl,
|
|
45
45
|
resolveNavigationSources
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-BLPWSV4T.js";
|
|
47
47
|
import {
|
|
48
48
|
jsonSchemaToZod
|
|
49
49
|
} from "./chunk-ET6TGQRT.js";
|
|
@@ -7204,15 +7204,11 @@ Please re-execute the entire task.`
|
|
|
7204
7204
|
|
|
7205
7205
|
// src/lib/toolchain-checker.ts
|
|
7206
7206
|
import { execFile } from "child_process";
|
|
7207
|
-
import { readFile } from "fs/promises";
|
|
7208
|
-
import { existsSync } from "fs";
|
|
7209
|
-
import { resolve } from "path";
|
|
7210
7207
|
import { promisify } from "util";
|
|
7211
7208
|
import { z as z2 } from "zod";
|
|
7212
7209
|
import { parseToolchainFile } from "@aaac/toolchain";
|
|
7213
7210
|
var execFileAsync = promisify(execFile);
|
|
7214
7211
|
var SUBPROCESS_TIMEOUT_MS = 3e4;
|
|
7215
|
-
var MANIFEST_FILENAME = ".toolchain-manifest.json";
|
|
7216
7212
|
var ToolchainManifestSchema = z2.object({
|
|
7217
7213
|
schema: z2.string(),
|
|
7218
7214
|
toolchain_id: z2.string(),
|
|
@@ -7233,25 +7229,6 @@ function resolveAction(checkType, checkTypeActions, defaultAction) {
|
|
|
7233
7229
|
if (checkTypeActions?.["_default"]) return checkTypeActions["_default"];
|
|
7234
7230
|
return defaultAction ?? "warn";
|
|
7235
7231
|
}
|
|
7236
|
-
async function tryManifestFastPath(toolchainId, cwd) {
|
|
7237
|
-
const manifestPath = resolve(cwd, MANIFEST_FILENAME);
|
|
7238
|
-
if (!existsSync(manifestPath)) return null;
|
|
7239
|
-
try {
|
|
7240
|
-
const raw = await readFile(manifestPath, "utf-8");
|
|
7241
|
-
const parsed = ToolchainManifestSchema.parse(JSON.parse(raw));
|
|
7242
|
-
if (parsed.toolchain_id !== toolchainId) return null;
|
|
7243
|
-
return {
|
|
7244
|
-
toolchainId,
|
|
7245
|
-
checkType: "drift",
|
|
7246
|
-
status: "pass",
|
|
7247
|
-
action: "warn",
|
|
7248
|
-
message: `Manifest fast path: ${MANIFEST_FILENAME} found, toolchain_id matches`,
|
|
7249
|
-
durationMs: 0
|
|
7250
|
-
};
|
|
7251
|
-
} catch {
|
|
7252
|
-
return null;
|
|
7253
|
-
}
|
|
7254
|
-
}
|
|
7255
7232
|
async function executeCheck(command, cwd, observabilityIds) {
|
|
7256
7233
|
const env = observabilityIds ? buildObservabilityEnv(observabilityIds) : void 0;
|
|
7257
7234
|
try {
|
|
@@ -7306,33 +7283,27 @@ async function runToolchainChecks(options) {
|
|
|
7306
7283
|
componentId
|
|
7307
7284
|
);
|
|
7308
7285
|
let result;
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
result =
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
status: "error",
|
|
7331
|
-
action,
|
|
7332
|
-
message: err.message,
|
|
7333
|
-
durationMs
|
|
7334
|
-
};
|
|
7335
|
-
}
|
|
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
|
+
};
|
|
7336
7307
|
}
|
|
7337
7308
|
results.push(result);
|
|
7338
7309
|
emitToolchainClose(
|
|
@@ -8113,8 +8084,8 @@ var WorkflowBuilder = class {
|
|
|
8113
8084
|
};
|
|
8114
8085
|
|
|
8115
8086
|
// src/lib/plugin-loader.ts
|
|
8116
|
-
import { existsSync
|
|
8117
|
-
import { resolve
|
|
8087
|
+
import { existsSync } from "fs";
|
|
8088
|
+
import { resolve } from "path";
|
|
8118
8089
|
function isPluginLike(obj) {
|
|
8119
8090
|
return typeof obj === "object" && obj !== null && typeof obj.id === "string";
|
|
8120
8091
|
}
|
|
@@ -8135,8 +8106,8 @@ async function loadPluginModule(modulePath) {
|
|
|
8135
8106
|
async function loadPlugins(paths, baseDir) {
|
|
8136
8107
|
const result = { loaded: 0, files: [] };
|
|
8137
8108
|
for (const p of paths) {
|
|
8138
|
-
const absPath2 =
|
|
8139
|
-
if (!
|
|
8109
|
+
const absPath2 = resolve(baseDir, p);
|
|
8110
|
+
if (!existsSync(absPath2)) {
|
|
8140
8111
|
throw new Error(
|
|
8141
8112
|
`Plugin not found: ${absPath2} (declared by the project manifest's \`plugins:\`).`
|
|
8142
8113
|
);
|
|
@@ -8264,7 +8235,7 @@ var InMemoryStore = class {
|
|
|
8264
8235
|
};
|
|
8265
8236
|
|
|
8266
8237
|
// src/lib/file-memory-store.ts
|
|
8267
|
-
import { mkdir, readFile
|
|
8238
|
+
import { mkdir, readFile, unlink, writeFile } from "fs/promises";
|
|
8268
8239
|
import { join as join2 } from "path";
|
|
8269
8240
|
import { pathSegmentForId as pathSegmentForId2 } from "@aaac/contracts";
|
|
8270
8241
|
function resolveFilePath2(baseDir, ref) {
|
|
@@ -8287,7 +8258,7 @@ var FileMemoryStore = class {
|
|
|
8287
8258
|
async load(ref) {
|
|
8288
8259
|
const filePath = resolveFilePath2(this.baseDir, ref);
|
|
8289
8260
|
try {
|
|
8290
|
-
const raw = await
|
|
8261
|
+
const raw = await readFile(filePath, "utf-8");
|
|
8291
8262
|
return JSON.parse(raw);
|
|
8292
8263
|
} catch (error) {
|
|
8293
8264
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
@@ -8310,7 +8281,7 @@ var FileMemoryStore = class {
|
|
|
8310
8281
|
};
|
|
8311
8282
|
|
|
8312
8283
|
// src/lib/agent-log-writer.ts
|
|
8313
|
-
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";
|
|
8314
8285
|
import { join as join3 } from "path";
|
|
8315
8286
|
import { pathSegmentForId as pathSegmentForId3 } from "@aaac/contracts";
|
|
8316
8287
|
var RUN_LOG_EVENT_TYPES = [
|
|
@@ -8366,7 +8337,7 @@ var AgentLogWriter = class {
|
|
|
8366
8337
|
async readRunLog(runId) {
|
|
8367
8338
|
const filePath = this.runLogPath(runId);
|
|
8368
8339
|
try {
|
|
8369
|
-
const raw = await
|
|
8340
|
+
const raw = await readFile2(filePath, "utf-8");
|
|
8370
8341
|
const events = [];
|
|
8371
8342
|
for (const line of raw.split("\n")) {
|
|
8372
8343
|
if (line.trim().length === 0) continue;
|
|
@@ -8394,7 +8365,7 @@ var AgentLogWriter = class {
|
|
|
8394
8365
|
async readHandoff(runId, step) {
|
|
8395
8366
|
const filePath = this.handoffPath(runId, step);
|
|
8396
8367
|
try {
|
|
8397
|
-
const raw = await
|
|
8368
|
+
const raw = await readFile2(filePath, "utf-8");
|
|
8398
8369
|
return JSON.parse(raw);
|
|
8399
8370
|
} catch (error) {
|
|
8400
8371
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
@@ -8584,7 +8555,7 @@ Install it with: npm install ${pkg2}`
|
|
|
8584
8555
|
}
|
|
8585
8556
|
|
|
8586
8557
|
// src/lib/execute.ts
|
|
8587
|
-
import { resolve as
|
|
8558
|
+
import { resolve as resolve2 } from "path";
|
|
8588
8559
|
|
|
8589
8560
|
// src/component-scope.ts
|
|
8590
8561
|
var DEFAULT_COMPONENT_ID = "default";
|
|
@@ -8759,7 +8730,7 @@ function createExecutionProgressSink(invocationId, progressLog) {
|
|
|
8759
8730
|
return createProgressSink({
|
|
8760
8731
|
stderr: destination === "stderr" || destination === "both",
|
|
8761
8732
|
// The schema requires `file` whenever destination selects file output.
|
|
8762
|
-
...wantsFile && file ? { file:
|
|
8733
|
+
...wantsFile && file ? { file: resolve2(file), naming, label: invocationId } : {}
|
|
8763
8734
|
});
|
|
8764
8735
|
}
|
|
8765
8736
|
async function resolveExecutionContext(options, requiredEntities) {
|
|
@@ -9088,15 +9059,15 @@ async function dispatchOperation(operationName, op, options, input, ctx, handler
|
|
|
9088
9059
|
}
|
|
9089
9060
|
|
|
9090
9061
|
// src/lib/project-runtime.ts
|
|
9091
|
-
import { existsSync as
|
|
9092
|
-
import { resolve as
|
|
9062
|
+
import { existsSync as existsSync2 } from "fs";
|
|
9063
|
+
import { resolve as resolve3, dirname as dirname2 } from "path";
|
|
9093
9064
|
import { createPipeline } from "@aaac/observability";
|
|
9094
9065
|
var DEFAULT_ADAPTER = "claude";
|
|
9095
9066
|
function findProjectConfig(startDir, filename = PROJECT_CONFIG_FILENAME) {
|
|
9096
|
-
let dir =
|
|
9067
|
+
let dir = resolve3(startDir);
|
|
9097
9068
|
for (; ; ) {
|
|
9098
|
-
const candidate =
|
|
9099
|
-
if (
|
|
9069
|
+
const candidate = resolve3(dir, filename);
|
|
9070
|
+
if (existsSync2(candidate)) return candidate;
|
|
9100
9071
|
const parent = dirname2(dir);
|
|
9101
9072
|
if (parent === dir) return void 0;
|
|
9102
9073
|
dir = parent;
|
|
@@ -9108,8 +9079,8 @@ function serializeRequest(input) {
|
|
|
9108
9079
|
}
|
|
9109
9080
|
async function createProjectRuntime(options) {
|
|
9110
9081
|
const cwd = options.cwd ?? process.cwd();
|
|
9111
|
-
const configPath = options.configPath ?
|
|
9112
|
-
if (!configPath || !
|
|
9082
|
+
const configPath = options.configPath ? resolve3(cwd, options.configPath) : findProjectConfig(cwd);
|
|
9083
|
+
if (!configPath || !existsSync2(configPath)) {
|
|
9113
9084
|
const where = options.configPath ? `config path "${options.configPath}"` : `${PROJECT_CONFIG_FILENAME} from ${cwd} upward`;
|
|
9114
9085
|
throw new Error(
|
|
9115
9086
|
`No ${PROJECT_CONFIG_FILENAME} found (${where}). Pass --config <path> to a project manifest.`
|
|
@@ -9117,7 +9088,7 @@ async function createProjectRuntime(options) {
|
|
|
9117
9088
|
}
|
|
9118
9089
|
const config = await loadProjectConfig(configPath);
|
|
9119
9090
|
const env = options.env ?? process.env;
|
|
9120
|
-
if (config.dslDeclared && !
|
|
9091
|
+
if (config.dslDeclared && !existsSync2(config.dslPath)) {
|
|
9121
9092
|
throw new Error(
|
|
9122
9093
|
`Project agents DSL not found: ${config.dslPath} (referenced by ${configPath}).`
|
|
9123
9094
|
);
|
|
@@ -9228,7 +9199,7 @@ async function createProjectRuntime(options) {
|
|
|
9228
9199
|
}
|
|
9229
9200
|
|
|
9230
9201
|
// src/lib/guard-commands.ts
|
|
9231
|
-
import { readFile as
|
|
9202
|
+
import { readFile as readFile3, readdir as readdir2 } from "fs/promises";
|
|
9232
9203
|
import "yaml";
|
|
9233
9204
|
async function evaluateGuardrail(opts) {
|
|
9234
9205
|
let document;
|
|
@@ -9243,12 +9214,21 @@ async function evaluateGuardrail(opts) {
|
|
|
9243
9214
|
throw new Error("Invalid hook JSON: input must be a JSON object.");
|
|
9244
9215
|
}
|
|
9245
9216
|
const hookInput = document;
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
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
|
+
}
|
|
9252
9232
|
const ruleData = guardrailContextToRuleData(guardrailCtx);
|
|
9253
9233
|
const hooks = createGuardrailHooksFromRules(ruleData);
|
|
9254
9234
|
const command = hookInput.command;
|
|
@@ -9334,7 +9314,7 @@ async function guardStatus(opts = {}) {
|
|
|
9334
9314
|
const filePath = `${runsDir}/${file}`;
|
|
9335
9315
|
let raw;
|
|
9336
9316
|
try {
|
|
9337
|
-
raw = await
|
|
9317
|
+
raw = await readFile3(filePath, "utf8");
|
|
9338
9318
|
} catch {
|
|
9339
9319
|
continue;
|
|
9340
9320
|
}
|
|
@@ -9504,14 +9484,14 @@ import {
|
|
|
9504
9484
|
} from "@aaac/contracts";
|
|
9505
9485
|
|
|
9506
9486
|
// src/lib/claude-materialize/dsl-sources.ts
|
|
9507
|
-
import { existsSync as
|
|
9508
|
-
import { join as join4, resolve as
|
|
9487
|
+
import { existsSync as existsSync3 } from "fs";
|
|
9488
|
+
import { join as join4, resolve as resolve4 } from "path";
|
|
9509
9489
|
function originLabel(source) {
|
|
9510
9490
|
return source.member ?? "project";
|
|
9511
9491
|
}
|
|
9512
9492
|
async function workspaceMembersForProject(root) {
|
|
9513
9493
|
const manifestPath = join4(root, PROJECT_CONFIG_FILENAME);
|
|
9514
|
-
if (!
|
|
9494
|
+
if (!existsSync3(manifestPath)) return [];
|
|
9515
9495
|
const members = await loadWorkspaceMembers(manifestPath);
|
|
9516
9496
|
return members.map((m) => ({
|
|
9517
9497
|
name: m.name,
|
|
@@ -9521,7 +9501,7 @@ async function workspaceMembersForProject(root) {
|
|
|
9521
9501
|
}
|
|
9522
9502
|
async function resolveDslSources(root, embeddedDsl, config) {
|
|
9523
9503
|
const members = await workspaceMembersForProject(root);
|
|
9524
|
-
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 }];
|
|
9525
9505
|
return Promise.all(
|
|
9526
9506
|
roots.map(async ({ member, root: projectRoot }) => {
|
|
9527
9507
|
const { navigationOptions } = await resolveNavigationSources({
|
|
@@ -10341,9 +10321,9 @@ function renderEntryAgentPrompt(sources, outputDir) {
|
|
|
10341
10321
|
}
|
|
10342
10322
|
|
|
10343
10323
|
// src/lib/claude-materialize/materialize.ts
|
|
10344
|
-
import { existsSync as
|
|
10345
|
-
import { chmod, mkdir as mkdir3, readFile as
|
|
10346
|
-
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";
|
|
10347
10327
|
import {
|
|
10348
10328
|
claudeGenerator,
|
|
10349
10329
|
generatedFileRelPath,
|
|
@@ -10670,8 +10650,8 @@ function absPath(root, file) {
|
|
|
10670
10650
|
return join7(root, generatedFileRelPath(file));
|
|
10671
10651
|
}
|
|
10672
10652
|
async function readIfExists(path) {
|
|
10673
|
-
if (!
|
|
10674
|
-
return
|
|
10653
|
+
if (!existsSync4(path)) return void 0;
|
|
10654
|
+
return readFile4(path, "utf8");
|
|
10675
10655
|
}
|
|
10676
10656
|
async function renderFiles(root, dsl, config, entryAgentPrompt, protectsArtifacts) {
|
|
10677
10657
|
if (!config.emit.harness) return [];
|
|
@@ -10791,8 +10771,8 @@ async function commandFiles(sources, config, root) {
|
|
|
10791
10771
|
const outputTemplate = commandOutputTemplate(config);
|
|
10792
10772
|
let templateSource = DEFAULT_COMMAND_TEMPLATE;
|
|
10793
10773
|
if (commands.template) {
|
|
10794
|
-
const templatePath =
|
|
10795
|
-
templateSource = await
|
|
10774
|
+
const templatePath = resolve5(root, commands.template);
|
|
10775
|
+
templateSource = await readFile4(templatePath, "utf8");
|
|
10796
10776
|
}
|
|
10797
10777
|
return renderCommandFiles(sources, outputTemplate, templateSource);
|
|
10798
10778
|
}
|
|
@@ -10899,7 +10879,7 @@ function checkHookBin(file, existing) {
|
|
|
10899
10879
|
function effectiveClaudeInputs(root, raw) {
|
|
10900
10880
|
const config = parseClaudeConfig(raw);
|
|
10901
10881
|
const manifestPath = join7(root, PROJECT_CONFIG_FILENAME);
|
|
10902
|
-
if (!
|
|
10882
|
+
if (!existsSync4(manifestPath)) return { config, modelMapping: {} };
|
|
10903
10883
|
const manifest = readProjectManifest(manifestPath);
|
|
10904
10884
|
return {
|
|
10905
10885
|
config: applyProjectBinding(config, manifest.bindings?.claude),
|
|
@@ -10907,7 +10887,7 @@ function effectiveClaudeInputs(root, raw) {
|
|
|
10907
10887
|
};
|
|
10908
10888
|
}
|
|
10909
10889
|
async function syncClaude(opts) {
|
|
10910
|
-
const root =
|
|
10890
|
+
const root = resolve5(opts.projectRoot);
|
|
10911
10891
|
const { config, modelMapping } = effectiveClaudeInputs(root, opts.config);
|
|
10912
10892
|
const result = { files: [] };
|
|
10913
10893
|
const sources = await resolveDslSources(root, opts.dsl, config);
|
|
@@ -10978,7 +10958,7 @@ async function syncClaude(opts) {
|
|
|
10978
10958
|
return result;
|
|
10979
10959
|
}
|
|
10980
10960
|
async function checkClaude(opts) {
|
|
10981
|
-
const root =
|
|
10961
|
+
const root = resolve5(opts.projectRoot);
|
|
10982
10962
|
const { config, modelMapping } = effectiveClaudeInputs(root, opts.config);
|
|
10983
10963
|
const drift = [];
|
|
10984
10964
|
const skipped = [];
|