@mytechtoday/augment-extensions 3.2.0 → 3.4.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.
- package/AGENTS.md +25 -16
- package/README.md +215 -17
- package/augment-extensions/coding-standards/java/CHANGELOG.md +12 -0
- package/augment-extensions/coding-standards/java/README.md +54 -0
- package/augment-extensions/coding-standards/java/examples/SearchRequest.java +13 -0
- package/augment-extensions/coding-standards/java/metadata.json +36 -0
- package/augment-extensions/coding-standards/java/module.json +35 -0
- package/augment-extensions/coding-standards/java/rules/language-and-api-design.md +45 -0
- package/augment-extensions/coding-standards/java/rules/reliability-and-concurrency.md +43 -0
- package/augment-extensions/coding-standards/java/rules/testing-tooling-and-security.md +39 -0
- package/augment-extensions/coding-standards/spring/CHANGELOG.md +12 -0
- package/augment-extensions/coding-standards/spring/README.md +61 -0
- package/augment-extensions/coding-standards/spring/examples/OrderController.java +40 -0
- package/augment-extensions/coding-standards/spring/metadata.json +39 -0
- package/augment-extensions/coding-standards/spring/module.json +38 -0
- package/augment-extensions/coding-standards/spring/rules/beans-configuration-and-boot.md +39 -0
- package/augment-extensions/coding-standards/spring/rules/data-testing-and-transactions.md +36 -0
- package/augment-extensions/coding-standards/spring/rules/production-operations.md +40 -0
- package/augment-extensions/coding-standards/spring/rules/web-apis-and-security.md +43 -0
- package/augment-extensions/visual-design/metadata.json +1 -1
- package/augment-extensions/visual-design/module.json +2 -2
- package/augment-extensions/workflows/agent-engineering/README.md +67 -0
- package/augment-extensions/workflows/agent-engineering/examples/contracts.cjs +89 -0
- package/augment-extensions/workflows/agent-engineering/examples/demo.cjs +17 -0
- package/augment-extensions/workflows/agent-engineering/examples/evaluation-cases.json +7 -0
- package/augment-extensions/workflows/agent-engineering/examples/graphs.cjs +149 -0
- package/augment-extensions/workflows/agent-engineering/examples/loop.cjs +125 -0
- package/augment-extensions/workflows/agent-engineering/examples/recovery.cjs +51 -0
- package/augment-extensions/workflows/agent-engineering/examples/stub.cjs +11 -0
- package/augment-extensions/workflows/agent-engineering/examples/verify.cjs +21 -0
- package/augment-extensions/workflows/agent-engineering/module.json +24 -0
- package/augment-extensions/workflows/agent-engineering/rules/01-adoption.md +30 -0
- package/augment-extensions/workflows/agent-engineering/rules/02-agents.md +34 -0
- package/augment-extensions/workflows/agent-engineering/rules/03-contracts.md +34 -0
- package/augment-extensions/workflows/agent-engineering/rules/04-loops.md +39 -0
- package/augment-extensions/workflows/agent-engineering/rules/05-graphs.md +39 -0
- package/augment-extensions/workflows/agent-engineering/rules/06-improvement.md +38 -0
- package/augment-extensions/workflows/agent-engineering/schemas/contracts.schema.json +1 -0
- package/augment-extensions/workflows/agent-engineering/scripts/validate.cjs +32 -0
- package/augment-extensions/workflows/agent-engineering/sources.md +12 -0
- package/augment-extensions/workflows/agent-engineering/templates/agent.json +40 -0
- package/augment-extensions/workflows/agent-engineering/templates/check-tool.json +94 -0
- package/augment-extensions/workflows/agent-engineering/templates/evidence.json +29 -0
- package/augment-extensions/workflows/agent-engineering/templates/invocation.json +40 -0
- package/augment-extensions/workflows/agent-engineering/templates/node.json +27 -0
- package/augment-extensions/workflows/agent-engineering/templates/state.json +27 -0
- package/augment-extensions/workflows/agent-engineering/templates/task.json +40 -0
- package/augment-extensions/workflows/agent-engineering/templates/tool.json +52 -0
- package/augment-extensions/workflows/cross-platform/README.md +120 -0
- package/augment-extensions/workflows/cross-platform/examples/end-to-end-session.md +196 -0
- package/augment-extensions/workflows/cross-platform/module.json +91 -0
- package/augment-extensions/workflows/cross-platform/rules/drift-resolution.md +126 -0
- package/augment-extensions/workflows/cross-platform/rules/export-guide.md +139 -0
- package/augment-extensions/workflows/cross-platform/rules/mcp-snippet-inlining.md +99 -0
- package/augment-extensions/workflows/cross-platform/rules/mirror-guide.md +139 -0
- package/augment-extensions/workflows/cross-platform/rules/windows-fallback.md +111 -0
- package/augment-extensions/workflows/decision-layer/README.md +172 -0
- package/augment-extensions/workflows/decision-layer/examples/call-inventory.json +6 -0
- package/augment-extensions/workflows/decision-layer/examples/config.json +9 -0
- package/augment-extensions/workflows/decision-layer/examples/decision.json +13 -0
- package/augment-extensions/workflows/decision-layer/examples/labeled-cases.json +410 -0
- package/augment-extensions/workflows/decision-layer/examples/source.txt +3 -0
- package/augment-extensions/workflows/decision-layer/examples/task.json +8 -0
- package/augment-extensions/workflows/decision-layer/installation/augx-judgments/SKILL.md +14 -0
- package/augment-extensions/workflows/decision-layer/installation/package-lock.json +27 -0
- package/augment-extensions/workflows/decision-layer/installation/package.json +7 -0
- package/augment-extensions/workflows/decision-layer/installation/sources.json +18 -0
- package/augment-extensions/workflows/decision-layer/module.json +24 -0
- package/augment-extensions/workflows/decision-layer/rules/00-index.md +5 -0
- package/augment-extensions/workflows/decision-layer/rules/01-responsibilities.md +15 -0
- package/augment-extensions/workflows/decision-layer/rules/02-operation.md +15 -0
- package/augment-extensions/workflows/decision-layer/runtime/automatic.cjs +80 -0
- package/augment-extensions/workflows/decision-layer/runtime/chat-install.cjs +149 -0
- package/augment-extensions/workflows/decision-layer/runtime/chat-server.cjs +71 -0
- package/augment-extensions/workflows/decision-layer/runtime/cli.cjs +70 -0
- package/augment-extensions/workflows/decision-layer/runtime/common.cjs +85 -0
- package/augment-extensions/workflows/decision-layer/runtime/contracts.d.ts +21 -0
- package/augment-extensions/workflows/decision-layer/runtime/decisions.cjs +198 -0
- package/augment-extensions/workflows/decision-layer/runtime/evaluate.cjs +61 -0
- package/augment-extensions/workflows/decision-layer/runtime/install.cjs +199 -0
- package/augment-extensions/workflows/decision-layer/runtime/integrations.cjs +64 -0
- package/augment-extensions/workflows/decision-layer/runtime/runner.cjs +201 -0
- package/augment-extensions/workflows/decision-layer/runtime/worker-child.cjs +15 -0
- package/augment-extensions/workflows/decision-layer/runtime/workers.cjs +15 -0
- package/augment-extensions/workflows/decision-layer/schemas/automatic-input.schema.json +40 -0
- package/augment-extensions/workflows/decision-layer/schemas/config.schema.json +39 -0
- package/augment-extensions/workflows/decision-layer/scripts/validate.cjs +16 -0
- package/augment-extensions/workflows/decision-layer/sources.md +34 -0
- package/cli/MODULES.md +804 -302
- package/cli/dist/__test_file-tracking.d.ts +2 -0
- package/cli/dist/__test_file-tracking.d.ts.map +1 -0
- package/cli/dist/__test_file-tracking.js +4 -0
- package/cli/dist/__test_file-tracking.js.map +1 -0
- package/cli/dist/analysis/ast-parser.d.ts.map +1 -1
- package/cli/dist/analysis/ast-parser.js +25 -9
- package/cli/dist/analysis/ast-parser.js.map +1 -1
- package/cli/dist/cli.js +43 -9
- package/cli/dist/cli.js.map +1 -1
- package/cli/dist/commands/context.d.ts +8 -0
- package/cli/dist/commands/context.d.ts.map +1 -0
- package/cli/dist/commands/context.js +115 -0
- package/cli/dist/commands/context.js.map +1 -0
- package/cli/dist/commands/decision.d.ts +4 -0
- package/cli/dist/commands/decision.d.ts.map +1 -0
- package/cli/dist/commands/decision.js +34 -0
- package/cli/dist/commands/decision.js.map +1 -0
- package/cli/dist/commands/gui-decision.d.ts +6 -0
- package/cli/dist/commands/gui-decision.d.ts.map +1 -0
- package/cli/dist/commands/gui-decision.js +210 -0
- package/cli/dist/commands/gui-decision.js.map +1 -0
- package/cli/dist/commands/gui-module-manager.d.ts +14 -0
- package/cli/dist/commands/gui-module-manager.d.ts.map +1 -0
- package/cli/dist/commands/gui-module-manager.js +328 -0
- package/cli/dist/commands/gui-module-manager.js.map +1 -0
- package/cli/dist/commands/gui.d.ts +3 -9
- package/cli/dist/commands/gui.d.ts.map +1 -1
- package/cli/dist/commands/gui.js +7 -293
- package/cli/dist/commands/gui.js.map +1 -1
- package/cli/dist/commands/link.d.ts +2 -0
- package/cli/dist/commands/link.d.ts.map +1 -1
- package/cli/dist/commands/link.js +82 -84
- package/cli/dist/commands/link.js.map +1 -1
- package/cli/dist/commands/search.js +1 -11
- package/cli/dist/commands/search.js.map +1 -1
- package/cli/dist/commands/show.d.ts.map +1 -1
- package/cli/dist/commands/show.js +5 -18
- package/cli/dist/commands/show.js.map +1 -1
- package/cli/dist/commands/skill.d.ts.map +1 -1
- package/cli/dist/commands/skill.js +3 -3
- package/cli/dist/commands/skill.js.map +1 -1
- package/cli/dist/commands/unlink.d.ts +2 -0
- package/cli/dist/commands/unlink.d.ts.map +1 -1
- package/cli/dist/commands/unlink.js +51 -45
- package/cli/dist/commands/unlink.js.map +1 -1
- package/cli/dist/commands/update.js +14 -7
- package/cli/dist/commands/update.js.map +1 -1
- package/cli/dist/core/compatibility-checker.d.ts.map +1 -1
- package/cli/dist/core/compatibility-checker.js +5 -2
- package/cli/dist/core/compatibility-checker.js.map +1 -1
- package/cli/dist/lib/context-hosts.d.ts +16 -0
- package/cli/dist/lib/context-hosts.d.ts.map +1 -0
- package/cli/dist/lib/context-hosts.js +395 -0
- package/cli/dist/lib/context-hosts.js.map +1 -0
- package/cli/dist/lib/context-refresh.d.ts +60 -0
- package/cli/dist/lib/context-refresh.d.ts.map +1 -0
- package/cli/dist/lib/context-refresh.js +630 -0
- package/cli/dist/lib/context-refresh.js.map +1 -0
- package/cli/dist/lib/module-resolver.d.ts.map +1 -1
- package/cli/dist/lib/module-resolver.js +2 -2
- package/cli/dist/lib/module-resolver.js.map +1 -1
- package/cli/dist/types/gui.d.ts +4 -0
- package/cli/dist/types/gui.d.ts.map +1 -1
- package/cli/dist/utils/coordination-queries.js +2 -2
- package/cli/dist/utils/coordination-queries.js.map +1 -1
- package/cli/dist/utils/decision-runner.d.ts +20 -0
- package/cli/dist/utils/decision-runner.d.ts.map +1 -0
- package/cli/dist/utils/decision-runner.js +114 -0
- package/cli/dist/utils/decision-runner.js.map +1 -0
- package/cli/dist/utils/extensions-config.d.ts.map +1 -1
- package/cli/dist/utils/extensions-config.js +3 -1
- package/cli/dist/utils/extensions-config.js.map +1 -1
- package/cli/dist/utils/extractCommandHelp.d.ts +2 -2
- package/cli/dist/utils/extractCommandHelp.d.ts.map +1 -1
- package/cli/dist/utils/extractCommandHelp.js +54 -24
- package/cli/dist/utils/extractCommandHelp.js.map +1 -1
- package/cli/dist/utils/file-tracking.js +5 -5
- package/cli/dist/utils/file-tracking.js.map +1 -1
- package/cli/dist/utils/glob-match.d.ts +6 -0
- package/cli/dist/utils/glob-match.d.ts.map +1 -0
- package/cli/dist/utils/glob-match.js +8 -0
- package/cli/dist/utils/glob-match.js.map +1 -0
- package/cli/dist/utils/gui-helpers.d.ts.map +1 -1
- package/cli/dist/utils/gui-helpers.js +7 -3
- package/cli/dist/utils/gui-helpers.js.map +1 -1
- package/cli/dist/utils/mcp-integration.d.ts.map +1 -1
- package/cli/dist/utils/mcp-integration.js +5 -7
- package/cli/dist/utils/mcp-integration.js.map +1 -1
- package/cli/dist/utils/module-system.d.ts +14 -0
- package/cli/dist/utils/module-system.d.ts.map +1 -1
- package/cli/dist/utils/module-system.js +39 -13
- package/cli/dist/utils/module-system.js.map +1 -1
- package/cli/dist/utils/modules-catalog.d.ts.map +1 -1
- package/cli/dist/utils/modules-catalog.js +5 -0
- package/cli/dist/utils/modules-catalog.js.map +1 -1
- package/cli/dist/utils/process.d.ts +14 -0
- package/cli/dist/utils/process.d.ts.map +1 -0
- package/cli/dist/utils/process.js +57 -0
- package/cli/dist/utils/process.js.map +1 -0
- package/cli/dist/utils/version.d.ts +2 -0
- package/cli/dist/utils/version.d.ts.map +1 -0
- package/cli/dist/utils/version.js +8 -0
- package/cli/dist/utils/version.js.map +1 -0
- package/cli/dist/utils/vscode-editor.d.ts.map +1 -1
- package/cli/dist/utils/vscode-editor.js +14 -8
- package/cli/dist/utils/vscode-editor.js.map +1 -1
- package/modules.md +85 -6
- package/package.json +36 -16
- package/scripts/check-wsl-augx.sh +63 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { ROOT, check, object, inside, read, atomic, hash, id, lock } = require('./common.cjs');
|
|
5
|
+
const { run, registeredWorkers } = require('./runner.cjs');
|
|
6
|
+
const { capabilities, decide } = require('./decisions.cjs');
|
|
7
|
+
|
|
8
|
+
function state(goal = 'Prepare a local evidence briefing') { return { goal, revision: 1, evidence: [], completed: [], issues: [], constraints: ['Local only'], capabilities: ['local-document'] }; }
|
|
9
|
+
async function examples(root, policy, options) {
|
|
10
|
+
const menu = ['research', 'write', 'review'].map(id => ({ id, description: `Handle ${id} local evidence`, available: true, compatible: true, capabilities: ['local-document'], dataClasses: ['public'], cost: null, accessible: true, source: 'example.txt' }));
|
|
11
|
+
const results = [];
|
|
12
|
+
for (const capability of capabilities) {
|
|
13
|
+
const input = { capability, state: state(), candidates: menu, action: { id: 'read-local', args: { path: 'example.txt' } }, menuRevision: 1 };
|
|
14
|
+
results.push({ capability, result: await decide(root, policy, input, { ...options, hints: { repeating: 0.01, needs_review: 0.01 } }, { workers: registeredWorkers(), authorize: action => action.id === 'read-local', verify: () => ({ passed: false, reason: 'Example intentionally provides no artifact' }) }) });
|
|
15
|
+
}
|
|
16
|
+
return { provenance: options.mode, results };
|
|
17
|
+
}
|
|
18
|
+
function inventory(input) {
|
|
19
|
+
check(Array.isArray(input) && input.length > 0 && input.length <= 1000, 'Expected a nonempty explicit call inventory');
|
|
20
|
+
const groups = { generation: [], judgment: [], deterministic: [] };
|
|
21
|
+
for (const entry of input) {
|
|
22
|
+
check(object(entry) && typeof entry.name === 'string' && Object.hasOwnProperty.call(groups, entry.kind), 'Inventory entries require name and generation, judgment or deterministic kind');
|
|
23
|
+
check(Number.isInteger(entry.callsPerDay) && entry.callsPerDay >= 0, 'Invalid call frequency');
|
|
24
|
+
groups[entry.kind].push(entry);
|
|
25
|
+
}
|
|
26
|
+
groups.judgment.sort((a, b) => b.callsPerDay - a.callsPerDay);
|
|
27
|
+
return { groups, firstAdoption: groups.judgment[0]?.name || null, next: 'Probe this one judgment against de-identified labeled state; keep all exact logic in code' };
|
|
28
|
+
}
|
|
29
|
+
async function evaluateCases(root, policy, cases, options) {
|
|
30
|
+
check(Array.isArray(cases) && cases.length >= 20 && cases.length <= 100, 'Evaluation requires 20..100 labeled cases');
|
|
31
|
+
const ids = new Set();
|
|
32
|
+
for (const c of cases) { check(!ids.has(c.id) && ['calibration', 'held-out'].includes(c.split) && ['research', 'write', 'review'].includes(c.expected) && typeof c.shouldEscalate === 'boolean', 'Invalid evaluation identity, label or split'); ids.add(c.id); }
|
|
33
|
+
check(cases.some(c => c.split === 'held-out') && cases.some(c => c.split === 'calibration'), 'Separate held-out cases are required');
|
|
34
|
+
const evaluationId = options.runId || `eval-${hash(cases).slice(0, 12)}`, records = [];
|
|
35
|
+
check(id(evaluationId) && evaluationId.length <= 30, 'Evaluation identity must fit 30 characters');
|
|
36
|
+
for (const c of cases) {
|
|
37
|
+
const task = { id: c.id, goal: c.goal, kind: c.expected, capabilities: ['local-document'], sources: c.sources, acceptance: c.acceptance };
|
|
38
|
+
const baseline = await run(root, policy, task, { ...options, mode: 'baseline', runId: `${evaluationId}-${c.id}-base` });
|
|
39
|
+
const layered = await run(root, policy, task, { ...options, runId: `${evaluationId}-${c.id}-layer` });
|
|
40
|
+
const escalated = layered.status === 'review';
|
|
41
|
+
records.push({ id: c.id, split: c.split, baseline: { status: baseline.status, verified: baseline.verification?.passed === true, elapsedMs: baseline.elapsedMs || baseline.updatedAt - baseline.startedAt }, decisionLayer: { status: layered.status, verified: layered.verification?.passed === true, elapsedMs: layered.elapsedMs || layered.updatedAt - layered.startedAt, requests: layered.requests, attempts: layered.attempts, providerMs: layered.decisions.reduce((n, d) => n + (d.providerMs || 0), 0) || null }, expected: c.expected, escalated, inappropriateEscalation: escalated && !c.shouldEscalate, missedEscalation: !escalated && c.shouldEscalate, provenance: options.mode === 'offline' ? 'simulated-routing-with-real-local-workers' : 'live-provider-with-real-local-workers' });
|
|
42
|
+
}
|
|
43
|
+
const count = records.length, completed = records.filter(r => r.decisionLayer.verified).length;
|
|
44
|
+
const summarize = list => ({ cases: list.length, verifiedCompletionRate: list.filter(r => r.decisionLayer.verified).length / list.length, baselineCompletionRate: list.filter(r => r.baseline.verified).length / list.length, escalationRate: list.filter(r => r.escalated).length / list.length, inappropriateEscalations: list.filter(r => r.inappropriateEscalation).length, missedEscalations: list.filter(r => r.missedEscalation).length });
|
|
45
|
+
const report = { schemaVersion: 1, evaluationId, policyVersion: policy.policyVersion, mode: options.mode, metrics: { ...summarize(records), completed, medianEndToEndMs: [...records].map(r => r.decisionLayer.elapsedMs).sort((a, b) => a - b)[Math.floor(count / 2)], providerMs: records.some(r => r.decisionLayer.providerMs !== null) ? records.reduce((n, r) => n + (r.decisionLayer.providerMs || 0), 0) : null, requests: records.reduce((n, r) => n + r.decisionLayer.requests, 0), workerAttempts: records.reduce((n, r) => n + r.decisionLayer.attempts, 0), retries: records.reduce((n, r) => n + Math.max(0, r.decisionLayer.attempts - 1), 0), costPerCompletedTask: null, workerCost: null, cacheCost: null }, calibration: summarize(records.filter(r => r.split === 'calibration')), heldOut: summarize(records.filter(r => r.split === 'held-out')), records, policyPromotion: 'No automatic changes. Review held-out results and explicitly create a new policyVersion before promotion.' };
|
|
46
|
+
atomic(inside(root, `.augx-decision/evaluations/${evaluationId}.json`), report);
|
|
47
|
+
return report;
|
|
48
|
+
}
|
|
49
|
+
module.exports = { examples, inventory, evaluate, state };
|
|
50
|
+
async function evaluate(root, policy, cases, options) {
|
|
51
|
+
const evaluationId = options.runId || `eval-${hash(cases).slice(0, 12)}`;
|
|
52
|
+
check(id(evaluationId) && evaluationId.length <= 30, 'Invalid evaluation identity');
|
|
53
|
+
const unlock = lock(root, `.augx-decision/evaluations/${evaluationId}.lock`);
|
|
54
|
+
try {
|
|
55
|
+
const ledgerFile = inside(root, `.augx-decision/evaluations/${evaluationId}-budget.json`);
|
|
56
|
+
const digest = hash({ cases, policy, mode: options.mode });
|
|
57
|
+
const ledger = fs.existsSync(ledgerFile) ? read(ledgerFile) : { digest, requests: 0, requestBudget: options.requestBudget || 0 };
|
|
58
|
+
check(ledger.digest === digest, 'Evaluation inputs changed; select a new identity');
|
|
59
|
+
return await evaluateCases(root, policy, cases, { ...options, runId: evaluationId, reserveParent: () => { check(ledger.requests < Math.min(ledger.requestBudget, policy.limits.requests), 'Aggregate evaluation request budget exhausted'); ledger.requests += 1; atomic(ledgerFile, ledger); } });
|
|
60
|
+
} finally { unlock(); }
|
|
61
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const https = require('https');
|
|
5
|
+
const cp = require('child_process');
|
|
6
|
+
const { ROOT, check, inside, hash, read, atomic, lock, config } = require('./common.cjs');
|
|
7
|
+
const pins = require('../installation/sources.json');
|
|
8
|
+
|
|
9
|
+
function processEnv() {
|
|
10
|
+
// Installation and workers receive no provider credentials or npm lifecycle hooks.
|
|
11
|
+
const result = {};
|
|
12
|
+
for (const key of ['PATH', 'Path', 'SystemRoot', 'WINDIR', 'TEMP', 'TMP', 'HOME', 'USERPROFILE', 'APPDATA', 'LOCALAPPDATA']) if (process.env[key]) result[key] = process.env[key];
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
function execute(executable, args, timeout = 120000) {
|
|
16
|
+
const result = cp.spawnSync(executable, args, { encoding: 'utf8', timeout, windowsHide: true, shell: false, env: processEnv(), maxBuffer: 1048576 });
|
|
17
|
+
check(!result.error && result.status === 0, 'Installation command failed or timed out; inspect software and rerun setup (no credentials required)');
|
|
18
|
+
return result.stdout.trim();
|
|
19
|
+
}
|
|
20
|
+
function npmFor(node) {
|
|
21
|
+
return [path.join(path.dirname(node), 'node_modules/npm/bin/npm-cli.js'), path.resolve(path.dirname(node), '../lib/node_modules/npm/bin/npm-cli.js')].find(p => fs.existsSync(p));
|
|
22
|
+
}
|
|
23
|
+
function portable(root) {
|
|
24
|
+
const entry = pins.archives[`${process.platform}-${process.arch}`];
|
|
25
|
+
check(entry, `Unsupported platform ${process.platform}-${process.arch}; supported: Windows, macOS, Linux x64/arm64`);
|
|
26
|
+
const folder = entry[0].replace(/\.(zip|tar\.gz)$/, '');
|
|
27
|
+
return { entry, folder, node: inside(root, `.augx-decision/software/runtime/${folder}/${process.platform === 'win32' ? 'node.exe' : 'bin/node'}`) };
|
|
28
|
+
}
|
|
29
|
+
function detect(root, forcePortable = false) {
|
|
30
|
+
const item = portable(root);
|
|
31
|
+
const currentCompatible = Number(process.versions.node.split('.')[0]) >= 22 && !!npmFor(process.execPath);
|
|
32
|
+
const node = !forcePortable && currentCompatible ? process.execPath : item.node;
|
|
33
|
+
let version = null;
|
|
34
|
+
if (fs.existsSync(node)) { try { version = execute(node, ['--version'], 10000); } catch { /* Diagnostics reports a missing usable runtime. */ } }
|
|
35
|
+
const npm = npmFor(node) || null;
|
|
36
|
+
let npmVersion = null, installedSdkVersion = null;
|
|
37
|
+
if (version && npm) { try { npmVersion = execute(node, [npm, '--version'], 10000); } catch { /* Plan reports unavailable npm explicitly. */ } }
|
|
38
|
+
const sdkManifest = inside(root, '.augx-decision/software/sdk/node_modules/@typesafe-ai/sdk/package.json');
|
|
39
|
+
if (fs.existsSync(sdkManifest)) { try { const found = read(sdkManifest).version; if (typeof found === 'string' && /^\d+\.\d+\.\d+$/.test(found)) installedSdkVersion = found; } catch { /* Setup repairs an invalid SDK manifest. */ } }
|
|
40
|
+
const hostExecutables = {};
|
|
41
|
+
for (const host of ['codex', 'claude']) {
|
|
42
|
+
const names = process.platform === 'win32' ? [host + '.exe', host + '.cmd', host + '.ps1'] : [host];
|
|
43
|
+
const found = (process.env.PATH || process.env.Path || '').split(path.delimiter).flatMap(directory => names.map(name => path.join(directory, name))).find(file => fs.existsSync(file) && fs.statSync(file).isFile());
|
|
44
|
+
hostExecutables[host] = { path: found || null, version: null };
|
|
45
|
+
if (found && (!path.extname(found) || path.extname(found) === '.exe')) { try { hostExecutables[host].version = execute(found, ['--version'], 10000); } catch { /* An installed host can remain unavailable; no host is launched for work. */ } }
|
|
46
|
+
}
|
|
47
|
+
return { platform: process.platform, architecture: process.arch, augxNode: process.version, runtime: node, version, npm, npmVersion, installedSdkVersion, existingConfiguration: fs.existsSync(inside(root, '.augx-decision/config.json')), hostExecutables, portable: node === item.node,
|
|
48
|
+
hosts: ['.agents', '.claude'].filter(p => fs.existsSync(path.join(root, p))),
|
|
49
|
+
sdk: pins.sdkVersion, skillCommit: pins.skillCommit };
|
|
50
|
+
}
|
|
51
|
+
function download(url, expected, maximum = 125829120) {
|
|
52
|
+
check(/^https:\/\/(nodejs\.org\/dist\/v22\.23\.5\/|raw\.githubusercontent\.com\/typesafe-ai\/skills\/302eea662c54bca6730873fe245bec1d69ebc23d\/skills\/typesafe-ai\/)/.test(url), 'Download source not allowlisted');
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
const request = https.get(url, { timeout: 30000 }, response => {
|
|
55
|
+
if (response.statusCode !== 200) { response.resume(); reject(new Error(`Official download unavailable (${response.statusCode}); no ready receipt written`)); return; }
|
|
56
|
+
const chunks = []; let size = 0;
|
|
57
|
+
response.on('data', chunk => { size += chunk.length; if (size > maximum) request.destroy(new Error('Download exceeds bound')); else chunks.push(chunk); });
|
|
58
|
+
response.on('error', reject);
|
|
59
|
+
response.on('end', () => { const bytes = Buffer.concat(chunks); if (hash(bytes) !== expected) reject(new Error('Official download checksum mismatch')); else resolve(bytes); });
|
|
60
|
+
});
|
|
61
|
+
const total = setTimeout(() => request.destroy(new Error('Download deadline exceeded')), 120000);
|
|
62
|
+
request.on('close', () => clearTimeout(total));
|
|
63
|
+
request.on('timeout', () => request.destroy(new Error('Download timed out')));
|
|
64
|
+
request.on('error', reject);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function inventory(root, relative) {
|
|
68
|
+
const target = inside(root, relative), result = {};
|
|
69
|
+
if (!fs.existsSync(target)) return result;
|
|
70
|
+
const stat = fs.lstatSync(target);
|
|
71
|
+
check(!stat.isSymbolicLink(), 'Managed root cannot be a symlink');
|
|
72
|
+
if (stat.isFile()) { result[relative] = hash(fs.readFileSync(target)); return result; }
|
|
73
|
+
for (const item of fs.readdirSync(target, { withFileTypes: true })) {
|
|
74
|
+
if (item.isSymbolicLink()) continue;
|
|
75
|
+
Object.assign(result, inventory(root, `${relative}/${item.name}`));
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
function ownedPath(relative) {
|
|
80
|
+
if (typeof relative !== 'string' || relative.includes('\\') || path.posix.normalize(relative) !== relative || relative.split('/').some(p => p === '..' || p === '.')) return false;
|
|
81
|
+
return /^\.augx-decision\/(software\/[^\0]+|config\.json|install-journal\.json)$/.test(relative) || /^\.(agents|claude)\/skills\/typesafe-ai\/(SKILL\.md|LICENSE)$/.test(relative);
|
|
82
|
+
}
|
|
83
|
+
function unchanged(root, files) {
|
|
84
|
+
for (const [relative, digest] of Object.entries(files)) {
|
|
85
|
+
check(ownedPath(relative), 'Receipt contains an unsupported ownership path');
|
|
86
|
+
const file = inside(root, relative);
|
|
87
|
+
check(!fs.existsSync(file) || hash(fs.readFileSync(file)) === digest, 'Owned installation file was edited; preserve it and resolve manually');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async function setup(root, options = {}) {
|
|
91
|
+
const environment = detect(root, options.portable), host = options.host || 'codex';
|
|
92
|
+
check(['codex', 'claude-code'].includes(host), 'Supported skill hosts: codex, claude-code');
|
|
93
|
+
check(!(options.automatic && options.disableAutomatic), 'Choose automatic activation or disabling');
|
|
94
|
+
if (options.automatic) {
|
|
95
|
+
const policyFile = inside(root, '.augx-decision/config.json');
|
|
96
|
+
const policy = fs.existsSync(policyFile) ? config(root) : require('../examples/config.json');
|
|
97
|
+
check(Number.isSafeInteger(Number(options.requests)) && Number(options.requests) > 0 && Number(options.requests) <= policy.limits.requests, 'Automatic setup requires --requests within configured limit');
|
|
98
|
+
require('./chat-install.cjs').preflight(root, host, environment.runtime);
|
|
99
|
+
}
|
|
100
|
+
const plan = { scope: root, ...environment, selectedHost: host, operations: [environment.version ? 'Reuse compatible Node runtime and npm' : 'Download checksum-pinned portable Node with npm', 'npm ci: pinned isolated SDK, scripts disabled', 'Copy checksum-pinned official TypeSafe skill', 'Preserve or create validated config', 'Verify loading and write redacted ownership receipt'], credentialsRequired: false };
|
|
101
|
+
plan.automatic = options.automatic ? { enabled: true, host, publicProviderDataConsent: true, cumulativeRequests: Number(options.requests), activation: 'Native MCP registration and implicit skill; restart/trust required; host session NOT VERIFIED' } : options.disableAutomatic ? { enabled: false } : { unchanged: true };
|
|
102
|
+
if (options.dryRun) return { dryRun: true, plan };
|
|
103
|
+
const unlock = lock(root, '.augx-decision/install.lock');
|
|
104
|
+
const receiptPath = inside(root, '.augx-decision/receipt.json');
|
|
105
|
+
const journalPath = inside(root, '.augx-decision/install-journal.json');
|
|
106
|
+
try {
|
|
107
|
+
if (options.disableAutomatic) return { automatic: require('./chat-install.cjs').disable(root) };
|
|
108
|
+
const previous = fs.existsSync(receiptPath) ? read(receiptPath) : null;
|
|
109
|
+
if (previous) unchanged(root, Object.fromEntries(Object.entries(previous.files).filter(([p]) => p !== '.augx-decision/config.json')));
|
|
110
|
+
const software = inside(root, '.augx-decision/software');
|
|
111
|
+
check(!fs.existsSync(software) || previous || fs.existsSync(journalPath), 'Unowned software directory exists; setup will not replace it');
|
|
112
|
+
const journal = fs.existsSync(journalPath) ? read(journalPath) : { schemaVersion: 1, status: 'installing', sdk: pins.sdkVersion, files: {} };
|
|
113
|
+
check(journal.schemaVersion === 1 && journal.sdk === pins.sdkVersion && journal.files && typeof journal.files === 'object', 'Invalid partial-install journal');
|
|
114
|
+
atomic(journalPath, journal);
|
|
115
|
+
fs.mkdirSync(software, { recursive: true });
|
|
116
|
+
if (!environment.version) {
|
|
117
|
+
const item = portable(root), runtimeDir = inside(root, '.augx-decision/software/runtime');
|
|
118
|
+
fs.mkdirSync(runtimeDir, { recursive: true });
|
|
119
|
+
const archive = path.join(runtimeDir, item.entry[0]);
|
|
120
|
+
const bytes = await download(`https://nodejs.org/dist/v${pins.nodeVersion}/${item.entry[0]}`, item.entry[1]);
|
|
121
|
+
fs.writeFileSync(archive, bytes, { mode: 0o600 });
|
|
122
|
+
if (process.platform === 'win32') {
|
|
123
|
+
const entries = await require('unzipper').Open.buffer(bytes);
|
|
124
|
+
for (const entry of entries.files) {
|
|
125
|
+
const output = inside(root, `.augx-decision/software/runtime/${entry.path.replace(/\/$/, '')}`);
|
|
126
|
+
if (entry.type === 'Directory') fs.mkdirSync(output, { recursive: true });
|
|
127
|
+
else { fs.mkdirSync(path.dirname(output), { recursive: true }); fs.writeFileSync(output, await entry.buffer()); }
|
|
128
|
+
}
|
|
129
|
+
} else execute('/usr/bin/tar', ['-xzf', archive, '-C', runtimeDir], 120000);
|
|
130
|
+
check(/^v2[2-9]\./.test(execute(environment.runtime, ['--version'], 10000)), 'Portable runtime validation failed');
|
|
131
|
+
}
|
|
132
|
+
const npm = npmFor(environment.runtime);
|
|
133
|
+
check(npm, 'Runtime npm is unavailable; rerun setup --portable');
|
|
134
|
+
const sdkDir = inside(root, '.augx-decision/software/sdk');
|
|
135
|
+
fs.mkdirSync(sdkDir, { recursive: true });
|
|
136
|
+
for (const name of ['package.json', 'package-lock.json']) fs.copyFileSync(path.join(ROOT, 'installation', name), path.join(sdkDir, name));
|
|
137
|
+
let sdkReady = false;
|
|
138
|
+
try { sdkReady = execute(environment.runtime, ['-e', 'const s=require(process.argv[1]);if(typeof s.TypeSafeClient!=="function"||require(process.argv[1]+"/package.json").version!=="0.7.0")process.exit(2)', path.join(sdkDir, 'node_modules/@typesafe-ai/sdk')], 10000) === ''; } catch { /* A partial install is repaired by npm ci. */ }
|
|
139
|
+
if (!sdkReady) execute(environment.runtime, [npm, 'ci', '--prefix', sdkDir, '--ignore-scripts', '--no-audit', '--no-fund', '--offline=false', '--registry=https://registry.npmjs.org'], 120000);
|
|
140
|
+
const skillPrefix = `${host === 'codex' ? '.agents' : '.claude'}/skills/typesafe-ai`;
|
|
141
|
+
const ownedSkill = {};
|
|
142
|
+
for (const [name, digest] of Object.entries(pins.skillFiles)) {
|
|
143
|
+
const relative = `${skillPrefix}/${name}`, file = inside(root, relative);
|
|
144
|
+
if (fs.existsSync(file)) { check(hash(fs.readFileSync(file)) === digest, 'Existing TypeSafe skill differs; preserving it. Resolve before setup.'); if (previous?.files[relative] || journal.files[relative]) ownedSkill[relative] = digest; }
|
|
145
|
+
else {
|
|
146
|
+
const bytes = await download(`https://raw.githubusercontent.com/typesafe-ai/skills/${pins.skillCommit}/skills/typesafe-ai/${name}`, digest, 65536);
|
|
147
|
+
journal.files[relative] = digest; atomic(journalPath, journal);
|
|
148
|
+
fs.mkdirSync(path.dirname(file), { recursive: true }); fs.writeFileSync(file, bytes, { flag: 'wx', mode: 0o600 }); ownedSkill[relative] = digest;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const configFile = inside(root, '.augx-decision/config.json');
|
|
152
|
+
const createdConfig = !fs.existsSync(configFile);
|
|
153
|
+
if (createdConfig) { journal.files['.augx-decision/config.json'] = hash(fs.readFileSync(path.join(ROOT, 'examples/config.json'))); atomic(journalPath, journal); fs.copyFileSync(path.join(ROOT, 'examples/config.json'), configFile, fs.constants.COPYFILE_EXCL); }
|
|
154
|
+
config(root);
|
|
155
|
+
execute(environment.runtime, ['-e', 'const s=require(process.argv[1]);if(typeof s.TypeSafeClient!=="function")process.exit(2)', path.join(sdkDir, 'node_modules/@typesafe-ai/sdk')], 10000);
|
|
156
|
+
check(require('../module.json').name === 'decision-layer', 'Module discovery metadata unavailable');
|
|
157
|
+
const files = { ...inventory(root, '.augx-decision/software'), ...ownedSkill };
|
|
158
|
+
if (createdConfig || previous?.files['.augx-decision/config.json'] || journal.files['.augx-decision/config.json']) files['.augx-decision/config.json'] = previous?.files['.augx-decision/config.json'] || journal.files['.augx-decision/config.json'] || hash(fs.readFileSync(configFile));
|
|
159
|
+
const receipt = { schemaVersion: 1, status: 'installed', sdk: pins.sdkVersion, runtime: environment.runtime, runtimeVersion: execute(environment.runtime, ['--version'], 10000), host, skillCommit: pins.skillCommit, files };
|
|
160
|
+
atomic(receiptPath, receipt); fs.unlinkSync(journalPath);
|
|
161
|
+
const automatic = options.automatic ? require('./chat-install.cjs').install(root, host, environment.runtime, Number(options.requests)) : require('./chat-install.cjs').status(root);
|
|
162
|
+
return { softwareInstalled: true, configurationValid: true, credentialsAvailable: !!process.env.TYPESAFE_API_KEY, connectivity: 'NOT VERIFIED', liveEnabled: false, automatic, receipt: '.augx-decision/receipt.json' };
|
|
163
|
+
} finally { unlock(); }
|
|
164
|
+
}
|
|
165
|
+
function doctor(root) {
|
|
166
|
+
let configurationValid = false, softwareInstalled = false;
|
|
167
|
+
try { config(root); configurationValid = true; } catch { /* Expose validity separately. */ }
|
|
168
|
+
const environment = detect(root);
|
|
169
|
+
try {
|
|
170
|
+
check(!fs.existsSync(inside(root, '.augx-decision/install-journal.json')), 'Installation is partial');
|
|
171
|
+
const receipt = read(inside(root, '.augx-decision/receipt.json'));
|
|
172
|
+
check(receipt.status === 'installed' && Object.keys(receipt.files).every(p => fs.existsSync(inside(root, p))), 'Installation resources are missing');
|
|
173
|
+
unchanged(root, Object.fromEntries(Object.entries(receipt.files).filter(([p]) => p !== '.augx-decision/config.json')));
|
|
174
|
+
execute(environment.runtime, ['-e', 'const s=require(process.argv[1]);if(typeof s.TypeSafeClient!=="function")process.exit(2)', inside(root, '.augx-decision/software/sdk/node_modules/@typesafe-ai/sdk')], 10000);
|
|
175
|
+
softwareInstalled = true;
|
|
176
|
+
} catch { /* A partial installation never reports ready. */ }
|
|
177
|
+
return { ...environment, softwareInstalled, configurationValid, credentialsAvailable: !!process.env.TYPESAFE_API_KEY, connectivity: 'NOT VERIFIED', liveEnabled: false, automatic: require('./chat-install.cjs').status(root), next: softwareInstalled ? 'Inspect automatic readiness, or use --live with an explicit --requests budget for a manual provider probe' : 'Run augx decision setup; partial installs can be retried' };
|
|
178
|
+
}
|
|
179
|
+
function remove(root) {
|
|
180
|
+
const unlock = lock(root, '.augx-decision/install.lock');
|
|
181
|
+
try {
|
|
182
|
+
const receiptPath = inside(root, '.augx-decision/receipt.json'), receipt = read(receiptPath), removed = [], preserved = [];
|
|
183
|
+
check(receipt.files && Object.keys(receipt.files).every(ownedPath), 'Unsupported receipt ownership');
|
|
184
|
+
const configFile = inside(root, '.augx-decision/config.json');
|
|
185
|
+
const hasAutomatic = fs.existsSync(configFile) && !!read(configFile).automatic;
|
|
186
|
+
const chat = hasAutomatic || fs.existsSync(inside(root, '.augx-decision/chat-receipt.json')) ? require('./chat-install.cjs').disable(root) : null;
|
|
187
|
+
for (const [relative, digest] of Object.entries(receipt.files)) {
|
|
188
|
+
check(ownedPath(relative), 'Unsupported receipt ownership');
|
|
189
|
+
const file = inside(root, relative);
|
|
190
|
+
if (!fs.existsSync(file)) continue;
|
|
191
|
+
if (hash(fs.readFileSync(file)) !== digest) { preserved.push(relative); continue; }
|
|
192
|
+
fs.unlinkSync(file); removed.push(relative);
|
|
193
|
+
}
|
|
194
|
+
if (!preserved.length) fs.unlinkSync(receiptPath);
|
|
195
|
+
else atomic(receiptPath, { ...receipt, status: 'removed-with-preserved-edits', files: Object.fromEntries(preserved.map(p => [p, receipt.files[p]])) });
|
|
196
|
+
return { removed: removed.length, preserved, automatic: chat, retained: 'Run data, automatic request ledger, user files, credentials, unrelated runtimes, and empty directories' };
|
|
197
|
+
} finally { unlock(); }
|
|
198
|
+
}
|
|
199
|
+
module.exports = { setup, doctor, remove, detect, download, inventory, execute, processEnv, portable };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { check, inside, hash, safeData } = require('./common.cjs');
|
|
5
|
+
const { decide } = require('./decisions.cjs');
|
|
6
|
+
|
|
7
|
+
/** Load applicable repository instructions without consulting a relevance model. */
|
|
8
|
+
function scopedGuidance(root, target) {
|
|
9
|
+
const absolute = inside(root, target), relative = path.relative(fs.realpathSync(root), path.dirname(absolute));
|
|
10
|
+
const directories = [''];
|
|
11
|
+
let current = '';
|
|
12
|
+
for (const part of relative.split(path.sep).filter(Boolean)) { current = current ? `${current}/${part}` : part; directories.push(current); }
|
|
13
|
+
const result = [];
|
|
14
|
+
for (const directory of directories) {
|
|
15
|
+
const source = directory ? `${directory}/AGENTS.md` : 'AGENTS.md', file = inside(root, source);
|
|
16
|
+
if (!fs.existsSync(file)) continue;
|
|
17
|
+
check(fs.statSync(file).size <= 65536, 'Applicable instructions exceed guidance bound; inspect before continuing');
|
|
18
|
+
const content = fs.readFileSync(file, 'utf8');
|
|
19
|
+
result.push({ id: `guidance-${result.length}`, description: content, source, sha256: hash(content), kind: 'instructions', protected: true, accessible: true });
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
function actionPolicy(root, registrations, authorize) {
|
|
24
|
+
const Ajv = require('ajv'), ajv = new Ajv({ strict: true });
|
|
25
|
+
const validators = new Map();
|
|
26
|
+
return action => {
|
|
27
|
+
if (!action || typeof action.id !== 'string') return false;
|
|
28
|
+
const registered = registrations.find(r => r.id === action.id);
|
|
29
|
+
if (!registered) return false;
|
|
30
|
+
if (!validators.has(action.id)) validators.set(action.id, ajv.compile(registered.schema));
|
|
31
|
+
if (!validators.get(action.id)(action.args)) return false;
|
|
32
|
+
try { for (const key of registered.pathArguments || []) inside(root, action.args[key]); } catch { return false; }
|
|
33
|
+
return authorize(action) === true;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async function executeAction(root, policy, input, registrations, authorize, options) {
|
|
37
|
+
const allowed = actionPolicy(root, registrations, authorize);
|
|
38
|
+
const decision = await decide(root, policy, { ...input, capability: 'assess-tool' }, options, { authorize: allowed });
|
|
39
|
+
if (decision.outcome !== 'allow' || !allowed(input.action)) return { decision, executed: false };
|
|
40
|
+
const registration = registrations.find(r => r.id === input.action.id);
|
|
41
|
+
check(typeof registration.execute === 'function', 'Registered action handler unavailable');
|
|
42
|
+
return { decision, executed: true, result: await registration.execute(input.action.args, options.signal) };
|
|
43
|
+
}
|
|
44
|
+
async function routeGeneration(root, policy, input, adapters, options) {
|
|
45
|
+
const decision = await decide(root, policy, { ...input, capability: 'route-model' }, options, { models: adapters });
|
|
46
|
+
const adapter = adapters.find(a => a.id === decision.outcome);
|
|
47
|
+
if (!adapter) return { decision, result: null };
|
|
48
|
+
check(adapter.available === true && typeof adapter.generate === 'function', 'Generative adapter became unavailable');
|
|
49
|
+
safeData(input.state);
|
|
50
|
+
return { decision, result: await adapter.generate(input.state, options.signal) };
|
|
51
|
+
}
|
|
52
|
+
async function rerank(root, policy, state, retriever, options) {
|
|
53
|
+
const found = await retriever(state.goal, { limit: 64, signal: options.signal });
|
|
54
|
+
return decide(root, policy, { capability: 'rank-retrieval', state, candidates: found }, options);
|
|
55
|
+
}
|
|
56
|
+
function inspectReadonly(root, paths) {
|
|
57
|
+
check(Array.isArray(paths) && paths.length <= 16, 'Read-only inspection limit exceeded');
|
|
58
|
+
return paths.map(source => {
|
|
59
|
+
const file = inside(root, source); check(fs.statSync(file).size <= 65536, 'Inspection file too large');
|
|
60
|
+
const content = fs.readFileSync(file, 'utf8'); safeData(content);
|
|
61
|
+
return { source, sha256: hash(content), bytes: Buffer.byteLength(content) };
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
module.exports = { scopedGuidance, actionPolicy, executeAction, routeGeneration, rerank, inspectReadonly };
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const cp = require('child_process');
|
|
5
|
+
const { ROOT, check, object, finite, text, id, inside, hash, read, atomic, lock, safeData } = require('./common.cjs');
|
|
6
|
+
const { decide } = require('./decisions.cjs');
|
|
7
|
+
const { processEnv } = require('./install.cjs');
|
|
8
|
+
const { descriptions } = require('./workers.cjs');
|
|
9
|
+
const terminal = ['completed', 'failed', 'cancelled', 'exhausted', 'verification_failed'];
|
|
10
|
+
const transitions = {
|
|
11
|
+
pending: ['deciding', 'review', 'exhausted', 'cancelled'], deciding: ['queued', 'review', 'failed', 'exhausted', 'cancelled'],
|
|
12
|
+
queued: ['running', 'review', 'cancelled', 'exhausted'], running: ['verifying', 'pending', 'failed', 'review', 'cancelled', 'exhausted'],
|
|
13
|
+
verifying: ['completed', 'pending', 'review', 'verification_failed', 'cancelled', 'exhausted'], review: ['pending', 'cancelled']
|
|
14
|
+
};
|
|
15
|
+
function transition(record, status) { check(transitions[record.status]?.includes(status), `Invalid transition ${record.status} to ${status}`); record.status = status; }
|
|
16
|
+
function registeredWorkers() {
|
|
17
|
+
const modulePath = path.join(__dirname, 'workers.cjs'), sha256 = hash(fs.readFileSync(modulePath));
|
|
18
|
+
return Object.entries(descriptions).map(([id, description]) => ({ id, description, capabilities: ['local-document'], available: true, modulePath, sha256 }));
|
|
19
|
+
}
|
|
20
|
+
function validateTask(task) {
|
|
21
|
+
check(object(task) && id(task.id), 'Task requires a valid identity'); text(task.goal, 'task goal');
|
|
22
|
+
check(Array.isArray(task.sources) && task.sources.length > 0 && task.sources.length <= 16 && task.sources.every(p => typeof p === 'string'), 'Task requires 1..16 local source paths');
|
|
23
|
+
check(Array.isArray(task.capabilities) && task.capabilities.length > 0 && task.capabilities.every(id), 'Task requires explicit capabilities');
|
|
24
|
+
check(['research', 'write', 'review'].includes(task.kind), 'Unsupported local task kind');
|
|
25
|
+
check(object(task.acceptance) && Number.isInteger(task.acceptance.minBytes) && finite(task.acceptance.minBytes, 1, 1048576) && Array.isArray(task.acceptance.contains) && task.acceptance.contains.length > 0 && task.acceptance.contains.length <= 32 && task.acceptance.contains.every(x => typeof x === 'string' && x.length > 0 && x.length <= 2000), 'Invalid independent acceptance criteria');
|
|
26
|
+
safeData(task); return task;
|
|
27
|
+
}
|
|
28
|
+
function loadSources(root, task) {
|
|
29
|
+
let size = 0;
|
|
30
|
+
return task.sources.map(relative => {
|
|
31
|
+
check(!/(^|[\\/])(?:\.git|\.env[^\\/]*|node_modules|\.augx-decision|\.npmrc|credentials[^\\/]*)($|[\\/])/i.test(relative), 'Source path is sensitive or operational state');
|
|
32
|
+
const file = inside(root, relative), stat = fs.statSync(file); size += stat.size;
|
|
33
|
+
check(stat.isFile() && size <= 524288, 'Source corpus exceeds bound');
|
|
34
|
+
const content = fs.readFileSync(file, 'utf8'); safeData(content);
|
|
35
|
+
return { path: relative, sha256: hash(content), content };
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function verifier(file, task, sources) {
|
|
39
|
+
if (!fs.existsSync(file)) return { passed: false, reason: 'Required artifact missing' };
|
|
40
|
+
const stat = fs.lstatSync(file);
|
|
41
|
+
if (stat.isSymbolicLink() || !stat.isFile() || stat.size < task.acceptance.minBytes || stat.size > 1048576) return { passed: false, reason: 'Artifact type or size rejected' };
|
|
42
|
+
const bytes = fs.readFileSync(file, 'utf8');
|
|
43
|
+
let value;
|
|
44
|
+
try { value = JSON.parse(bytes); } catch { return { passed: false, reason: 'Artifact JSON invalid' }; }
|
|
45
|
+
const passed = value.schemaVersion === 1 && value.goal === task.goal && value.kind === task.kind && typeof value.body === 'string' && task.acceptance.contains.every(x => bytes.includes(x)) && Array.isArray(value.sources) && sources.every(s => value.sources.some(v => v.source === s.path && v.sha256 === s.sha256));
|
|
46
|
+
return { passed, reason: passed ? 'Artifact independently matches acceptance and source digests' : 'Artifact does not satisfy acceptance', sha256: hash(bytes), bytes: stat.size };
|
|
47
|
+
}
|
|
48
|
+
function killOwned(child) {
|
|
49
|
+
if (!child.pid) return;
|
|
50
|
+
if (process.platform === 'win32') {
|
|
51
|
+
const taskkill = path.join(process.env.SystemRoot || 'C:\\Windows', 'System32', 'taskkill.exe');
|
|
52
|
+
cp.spawnSync(taskkill, ['/PID', String(child.pid), '/T', '/F'], { windowsHide: true, timeout: 5000, stdio: 'ignore', env: processEnv() });
|
|
53
|
+
} else { try { process.kill(-child.pid, 'SIGKILL'); } catch { child.kill('SIGKILL'); } }
|
|
54
|
+
}
|
|
55
|
+
function invokeWorker(worker, context, timeout, signal) {
|
|
56
|
+
check(path.isAbsolute(worker.modulePath) && hash(fs.readFileSync(worker.modulePath)) === worker.sha256, 'Unregistered or changed worker executable');
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
const child = cp.spawn(process.execPath, [path.join(__dirname, 'worker-child.cjs'), worker.modulePath, worker.sha256], { shell: false, windowsHide: true, detached: process.platform !== 'win32', env: processEnv(), stdio: ['pipe', 'pipe', 'pipe'] });
|
|
59
|
+
let output = '', stopped = false;
|
|
60
|
+
const stop = reason => { if (!stopped) { stopped = true; killOwned(child); reject(new Error(reason)); } };
|
|
61
|
+
const timer = setTimeout(() => stop('Worker timeout'), timeout);
|
|
62
|
+
const cancel = () => stop('Worker cancelled');
|
|
63
|
+
signal?.addEventListener('abort', cancel, { once: true });
|
|
64
|
+
if (signal?.aborted) cancel();
|
|
65
|
+
child.stdout.setEncoding('utf8');
|
|
66
|
+
child.stdout.on('data', value => { output += value; if (Buffer.byteLength(output) > 1048576) stop('Worker output exceeds bound'); });
|
|
67
|
+
child.stderr.resume();
|
|
68
|
+
child.stdin.on('error', () => {});
|
|
69
|
+
child.on('error', () => stop('Worker executable unavailable'));
|
|
70
|
+
child.on('close', code => {
|
|
71
|
+
clearTimeout(timer); signal?.removeEventListener('abort', cancel);
|
|
72
|
+
if (stopped) return;
|
|
73
|
+
if (code !== 0) reject(new Error('Registered worker failed'));
|
|
74
|
+
else { try { resolve(safeData(JSON.parse(output))); } catch { reject(new Error('Invalid worker output')); } }
|
|
75
|
+
});
|
|
76
|
+
child.stdin.end(JSON.stringify(context));
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function inputState(task, revision, sources, record, workers) {
|
|
80
|
+
return { goal: task.goal, revision, evidence: sources.map(s => ({ source: s.path, sha256: s.sha256, content: s.content.slice(0, 2000) })), completed: record.verification?.passed ? [record.verification] : [], issues: [], constraints: ['Local artifacts only', 'Do not publish or contact recipients'], capabilities: task.capabilities, workers: workers.map(w => ({ id: w.id, description: w.description })), requiredKind: task.kind };
|
|
81
|
+
}
|
|
82
|
+
function fixtureWorker(goal) {
|
|
83
|
+
const value = goal.toLowerCase();
|
|
84
|
+
if (/unclear|ambiguous|missing requirements/.test(value)) return 'review';
|
|
85
|
+
if (/draft|write|compose/.test(value)) return 'write';
|
|
86
|
+
if (/review|inspect|audit/.test(value)) return 'review';
|
|
87
|
+
return 'research';
|
|
88
|
+
}
|
|
89
|
+
async function run(root, policy, suppliedTask, options = {}) {
|
|
90
|
+
const task = validateTask(suppliedTask), sources = loadSources(root, task), taskHash = hash({ task, sources: sources.map(({ path, sha256 }) => ({ path, sha256 })) });
|
|
91
|
+
check(options.mode === 'offline' || options.mode === 'live' || options.mode === 'baseline', 'Select offline, live or baseline mode');
|
|
92
|
+
const runId = options.runId || task.id; check(id(runId), 'Invalid run identity');
|
|
93
|
+
const prefix = `.augx-decision/runs/${runId}`, recordFile = inside(root, `${prefix}/state.json`), artifact = inside(root, `${prefix}/artifacts/result.json`);
|
|
94
|
+
const unlock = lock(root, `${prefix}/writer.lock`);
|
|
95
|
+
let record;
|
|
96
|
+
const save = () => { record.revision += 1; record.updatedAt = Date.now(); atomic(recordFile, record); };
|
|
97
|
+
try {
|
|
98
|
+
if (fs.existsSync(recordFile)) {
|
|
99
|
+
record = read(recordFile);
|
|
100
|
+
check(record.schemaVersion === 1 && record.taskHash === taskHash && record.policyHash === hash(policy) && record.mode === options.mode, 'Run task, source, policy or mode changed; start a new run identity');
|
|
101
|
+
check(Number.isInteger(record.requests) && record.requests >= 0 && Number.isInteger(record.attempts) && record.attempts >= 0 && Number.isInteger(record.revision) && typeof record.startedAt === 'number', 'Invalid persisted run accounting');
|
|
102
|
+
} else {
|
|
103
|
+
check(!options.resume, 'No run to resume');
|
|
104
|
+
record = { schemaVersion: 1, id: runId, task, taskHash, policyHash: hash(policy), policyVersion: policy.policyVersion, mode: options.mode, status: 'pending', revision: 0, requests: 0, attempts: 0, noProgress: 0, requestBudget: options.requestBudget || 0, startedAt: Date.now(), updatedAt: Date.now(), decisions: [], artifacts: [], verification: null, usage: { input_tokens: 0, output_tokens: 0, complete: true, cost: null, cacheCost: null }, nextAction: 'dispatch' };
|
|
105
|
+
save();
|
|
106
|
+
}
|
|
107
|
+
if (record.status === 'completed') {
|
|
108
|
+
const current = verifier(artifact, task, sources);
|
|
109
|
+
if (!current.passed || current.sha256 !== record.verification.sha256) { record.status = 'verification_failed'; record.verification = current; record.nextAction = 'Inspect modified artifact; use a new run identity for repair'; save(); }
|
|
110
|
+
return record;
|
|
111
|
+
}
|
|
112
|
+
if (terminal.includes(record.status)) return record;
|
|
113
|
+
const review = reason => {
|
|
114
|
+
if (record.status !== 'review') transition(record, 'review');
|
|
115
|
+
record.nextAction = reason;
|
|
116
|
+
record.review = { reason, taskHash, policyHash: record.policyHash, selectedWorker: record.selectedWorker || null, action: { kind: task.kind, args: { sources: task.sources, artifact: `${prefix}/artifacts/result.json` } }, stateRevision: record.revision + 1 };
|
|
117
|
+
record.review.digest = hash(record.review); save();
|
|
118
|
+
atomic(inside(root, `${prefix}/review.json`), record.review);
|
|
119
|
+
return record;
|
|
120
|
+
};
|
|
121
|
+
if (record.status === 'review') {
|
|
122
|
+
if (!options.approve) return record;
|
|
123
|
+
check(options.approve === record.review.digest && record.review.taskHash === taskHash && record.review.policyHash === hash(policy), 'Approval does not match concrete action, arguments, state and policy');
|
|
124
|
+
const approved = { ...record.review }; delete approved.digest;
|
|
125
|
+
check(hash(approved) === options.approve, 'Review request changed after approval');
|
|
126
|
+
record.authorization = { digest: options.approve, worker: task.kind, taskHash, policyHash: hash(policy) };
|
|
127
|
+
transition(record, 'pending'); record.review = null; save();
|
|
128
|
+
}
|
|
129
|
+
const deadline = () => record.startedAt + policy.limits.runMs - Date.now();
|
|
130
|
+
if (['running', 'verifying'].includes(record.status)) {
|
|
131
|
+
const reconciled = verifier(artifact, task, sources);
|
|
132
|
+
if (reconciled.passed) { record.status = 'completed'; record.verification = reconciled; record.artifacts = [{ path: `${prefix}/artifacts/result.json`, sha256: reconciled.sha256 }]; record.nextAction = 'none'; save(); return record; }
|
|
133
|
+
if (fs.existsSync(artifact)) return review('Uncertain artifact effect requires inspection before another attempt');
|
|
134
|
+
record.status = 'pending'; record.noProgress += 1; save();
|
|
135
|
+
} else if (record.status === 'deciding') return review('Interrupted decision reserved a request; inspect before redispatch');
|
|
136
|
+
const workers = options.workers || registeredWorkers();
|
|
137
|
+
check(workers.every(w => id(w.id) && typeof w.description === 'string' && Array.isArray(w.capabilities)), 'Invalid trusted worker registry');
|
|
138
|
+
while (!terminal.includes(record.status)) {
|
|
139
|
+
if (options.signal?.aborted) { transition(record, 'cancelled'); record.nextAction = 'Inspect cancellation; no automatic restart'; save(); break; }
|
|
140
|
+
if (deadline() <= 0 || record.attempts >= policy.limits.attempts) { transition(record, 'exhausted'); record.nextAction = 'Inspect run limits; use a new reviewed run'; save(); break; }
|
|
141
|
+
if (record.noProgress >= policy.limits.noProgress) return review('Deterministic no-progress limit reached');
|
|
142
|
+
if (record.status !== 'queued') {
|
|
143
|
+
transition(record, 'deciding'); save();
|
|
144
|
+
const state = inputState(task, record.revision, sources, record, workers);
|
|
145
|
+
let decision;
|
|
146
|
+
try {
|
|
147
|
+
if (options.mode === 'baseline' || record.authorization) decision = { outcome: task.kind, selected: task.kind, provenance: record.authorization ? 'explicit-action-approval' : 'deterministic-matched-baseline', cost: null };
|
|
148
|
+
else decision = await decide(root, policy, { capability: 'dispatch', state }, { ...options, timeoutMs: Math.min(policy.limits.requestMs, deadline()), requestBudget: record.requestBudget, hints: { selected: fixtureWorker(task.goal) }, reserve: () => {
|
|
149
|
+
check(record.requests < Math.min(record.requestBudget, policy.limits.requests) && deadline() > 0, 'Provider request budget exhausted');
|
|
150
|
+
options.reserveParent?.();
|
|
151
|
+
record.requests += 1; record.usage.complete = false; save();
|
|
152
|
+
} }, { workers });
|
|
153
|
+
} catch (error) { return review(error.message); }
|
|
154
|
+
record.decisions.push(decision);
|
|
155
|
+
if (decision.usage) for (const key of ['input_tokens', 'output_tokens']) { if (decision.usage[key] !== null) record.usage[key] += decision.usage[key]; }
|
|
156
|
+
if (decision.provenance === 'deterministic-offline-fixture') record.usage.complete = false;
|
|
157
|
+
const worker = workers.find(w => w.id === decision.outcome && w.available === true && task.capabilities.every(c => w.capabilities.includes(c)));
|
|
158
|
+
if (!worker) return review('Decision requires review or selected worker is unavailable');
|
|
159
|
+
record.selectedWorker = worker.id; record.selectionRevision = record.revision; record.nextAction = 'consume queued worker';
|
|
160
|
+
transition(record, 'queued'); save();
|
|
161
|
+
atomic(inside(root, `${prefix}/queue/${worker.id}.json`), { schemaVersion: 1, taskId: task.id, stateRevision: record.revision, worker: worker.id, status: 'queued', attempts: record.attempts });
|
|
162
|
+
}
|
|
163
|
+
const worker = workers.find(w => w.id === record.selectedWorker && w.available === true && task.capabilities.every(c => w.capabilities.includes(c)));
|
|
164
|
+
if (!worker) return review('Queued worker no longer available');
|
|
165
|
+
if (deadline() <= 0) { transition(record, 'exhausted'); record.nextAction = 'Overall deadline exhausted before worker launch'; save(); break; }
|
|
166
|
+
if (record.selectedWorker !== task.kind) return review('Selected worker conflicts with required artifact contract');
|
|
167
|
+
const sourceRevision = list => hash(list.map(({ path, sha256 }) => ({ path, sha256 })));
|
|
168
|
+
if (sourceRevision(loadSources(root, task)) !== sourceRevision(sources)) return review('Source observation changed after dispatch; create a fresh run');
|
|
169
|
+
const workerRequests = worker.requestsPerAttempt || 0;
|
|
170
|
+
check(Number.isInteger(workerRequests) && workerRequests >= 0, 'Invalid registered worker request reservation');
|
|
171
|
+
if (workerRequests > 0) {
|
|
172
|
+
if (options.mode !== 'live' || record.requests + workerRequests > Math.min(record.requestBudget, policy.limits.requests)) return review('Insufficient aggregate provider budget for registered worker');
|
|
173
|
+
for (let i = 0; i < workerRequests; i++) options.reserveParent?.();
|
|
174
|
+
record.requests += workerRequests; record.workerRequestReservations = (record.workerRequestReservations || 0) + workerRequests; record.usage.complete = false;
|
|
175
|
+
}
|
|
176
|
+
transition(record, 'running'); record.attempts += 1; record.nextAction = 'verify worker effect'; save();
|
|
177
|
+
atomic(inside(root, `${prefix}/queue/${worker.id}.json`), { schemaVersion: 1, taskId: task.id, stateRevision: record.revision, worker: worker.id, status: 'claimed', attempts: record.attempts });
|
|
178
|
+
try {
|
|
179
|
+
const output = await invokeWorker(worker, { task: { id: task.id, goal: task.goal, kind: task.kind }, sources, worker: worker.id, requestBudget: workerRequests }, Math.max(1, Math.min(policy.limits.workerMs, deadline())), options.signal);
|
|
180
|
+
if (output.usage) {
|
|
181
|
+
for (const key of ['input_tokens', 'output_tokens']) { check(output.usage[key] === null || Number.isInteger(output.usage[key]) && output.usage[key] >= 0, 'Invalid worker usage'); if (output.usage[key] !== null) record.usage[key] += output.usage[key]; }
|
|
182
|
+
check(Number.isInteger(output.usage.requests) && output.usage.requests >= 0 && output.usage.requests <= workerRequests, 'Worker exceeded declared request reservations');
|
|
183
|
+
}
|
|
184
|
+
check(!fs.existsSync(artifact), 'Uncertain existing artifact; refusing overwrite');
|
|
185
|
+
atomic(artifact, output);
|
|
186
|
+
transition(record, 'verifying'); save();
|
|
187
|
+
const verification = sourceRevision(loadSources(root, task)) === sourceRevision(sources) ? verifier(artifact, task, sources) : { passed: false, reason: 'Source state changed during worker execution' }; record.verification = verification;
|
|
188
|
+
if (verification.passed) { transition(record, 'completed'); record.artifacts = [{ path: `${prefix}/artifacts/result.json`, sha256: verification.sha256 }]; record.nextAction = 'none'; }
|
|
189
|
+
else { transition(record, 'verification_failed'); record.nextAction = 'Inspect rejected artifact; acceptance is controller-owned'; }
|
|
190
|
+
atomic(inside(root, `${prefix}/queue/${worker.id}.json`), { schemaVersion: 1, taskId: task.id, worker: worker.id, status: record.status, attempts: record.attempts, verification });
|
|
191
|
+
save();
|
|
192
|
+
} catch {
|
|
193
|
+
if (options.signal?.aborted) { transition(record, 'cancelled'); record.nextAction = 'Inspect cancellation'; save(); }
|
|
194
|
+
else if (fs.existsSync(artifact)) return review('Worker effect uncertain; inspect existing artifact');
|
|
195
|
+
else { transition(record, 'pending'); record.noProgress += 1; record.nextAction = 'retry within remaining limits'; save(); }
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
record.elapsedMs = Date.now() - record.startedAt; save(); return record;
|
|
199
|
+
} finally { unlock(); }
|
|
200
|
+
}
|
|
201
|
+
module.exports = { run, verifier, validateTask, loadSources, invokeWorker, registeredWorkers, transition, terminal, fixtureWorker };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const crypto = require('crypto');
|
|
4
|
+
let input = '';
|
|
5
|
+
process.stdin.setEncoding('utf8');
|
|
6
|
+
process.stdin.on('data', chunk => { input += chunk; if (Buffer.byteLength(input) > 1048576) process.exit(2); });
|
|
7
|
+
process.stdin.on('end', async () => {
|
|
8
|
+
try {
|
|
9
|
+
const [file, expected] = process.argv.slice(2);
|
|
10
|
+
if (crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex') !== expected) throw new Error('Worker registration changed');
|
|
11
|
+
const handler = require(file);
|
|
12
|
+
const result = await handler.execute(JSON.parse(input));
|
|
13
|
+
process.stdout.write(JSON.stringify(result));
|
|
14
|
+
} catch { process.stderr.write('Registered worker failed\n'); process.exitCode = 1; }
|
|
15
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const descriptions = {
|
|
3
|
+
research: 'Collect referenced evidence from supplied local source documents into a research record.',
|
|
4
|
+
write: 'Compose a local draft from supplied evidence without publishing it.',
|
|
5
|
+
review: 'Inspect supplied local evidence and produce a review checklist and findings.'
|
|
6
|
+
};
|
|
7
|
+
async function execute(context) {
|
|
8
|
+
const { task, sources, worker } = context;
|
|
9
|
+
if (!Object.hasOwnProperty.call(descriptions, worker)) throw new Error('Worker unavailable');
|
|
10
|
+
const notes = sources.map(s => ({ source: s.path, sha256: s.sha256, excerpt: s.content.slice(0, 4000) }));
|
|
11
|
+
return { schemaVersion: 1, kind: worker, goal: task.goal,
|
|
12
|
+
body: worker === 'write' ? notes.map(s => `${s.source}: ${s.excerpt}`).join('\n\n') : worker === 'review' ? 'Reviewed the supplied local documents for the stated goal. Findings require caller acceptance checks.' : 'Collected evidence from supplied local documents; no network research performed.',
|
|
13
|
+
sources: notes };
|
|
14
|
+
}
|
|
15
|
+
module.exports = { descriptions, execute };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"additionalProperties": false,
|
|
5
|
+
"required": ["capability", "dataClass", "state", "candidates"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"capability": { "enum": ["classify", "rank-retrieval"] },
|
|
8
|
+
"dataClass": { "enum": ["public", "internal"] },
|
|
9
|
+
"state": {
|
|
10
|
+
"type": "object", "additionalProperties": false,
|
|
11
|
+
"required": ["goal", "revision", "evidence", "completed", "issues", "constraints", "capabilities"],
|
|
12
|
+
"properties": {
|
|
13
|
+
"goal": { "type": "string", "minLength": 12, "maxLength": 2000 },
|
|
14
|
+
"revision": { "type": "integer", "minimum": 0, "maximum": 2147483647 },
|
|
15
|
+
"evidence": { "$ref": "#/definitions/textList" },
|
|
16
|
+
"completed": { "$ref": "#/definitions/textList" },
|
|
17
|
+
"issues": { "$ref": "#/definitions/textList" },
|
|
18
|
+
"constraints": { "$ref": "#/definitions/textList" },
|
|
19
|
+
"capabilities": { "type": "array", "maxItems": 0 }
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"candidates": {
|
|
23
|
+
"type": "array", "minItems": 2, "maxItems": 8,
|
|
24
|
+
"items": {
|
|
25
|
+
"type": "object", "additionalProperties": false,
|
|
26
|
+
"required": ["id", "description"],
|
|
27
|
+
"properties": {
|
|
28
|
+
"id": { "type": "string", "pattern": "^[a-z][a-z0-9_-]{0,63}$" },
|
|
29
|
+
"description": { "type": "string", "minLength": 8, "maxLength": 1000 },
|
|
30
|
+
"accessible": { "const": true },
|
|
31
|
+
"protected": { "type": "boolean" },
|
|
32
|
+
"kind": { "enum": ["instructions", "constraint", "blocker", "protected-evidence", "evidence"] }
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"definitions": {
|
|
38
|
+
"textList": { "type": "array", "maxItems": 8, "items": { "type": "string", "minLength": 1, "maxLength": 1000 } }
|
|
39
|
+
}
|
|
40
|
+
}
|