@aiwg/cli 2026.10.5 → 2026.10.7
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/agentic/code/addons/composition-engine/lib/runtime.mjs +1401 -0
- package/agentic/code/addons/composition-engine/lib/validator.mjs +513 -0
- package/agentic/code/addons/composition-engine/schemas/flow-graph.schema.json +372 -0
- package/agentic/code/providers/model-capabilities.v1.json +74 -50
- package/bin/aiwg.mjs +7 -3
- package/dist/src/a2a/agent-card.js +11 -0
- package/dist/src/api/index.d.ts +1 -0
- package/dist/src/api/index.js +1 -0
- package/dist/src/artifacts/browser-export.js +1 -0
- package/dist/src/artifacts/citation-parser.js +8 -1
- package/dist/src/artifacts/cli.js +57 -6
- package/dist/src/artifacts/fortemi-core-query-adapter.js +2 -0
- package/dist/src/artifacts/fortemi-core-sync.js +26 -8
- package/dist/src/artifacts/fortemi-shard-contract/2.2.0/contract.json +103 -0
- package/dist/src/artifacts/fortemi-shard-contract/2.2.0/full-v1-embedding-config.schema.json +212 -0
- package/dist/src/artifacts/fortemi-shard-contract/2.2.0/full-v1-embedding-set.schema.json +240 -0
- package/dist/src/artifacts/fortemi-shard-contract/2.2.0/full-v1-manifest.schema.json +451 -0
- package/dist/src/artifacts/fortemi-shard-export.js +284 -0
- package/dist/src/artifacts/graph-query.js +18 -8
- package/dist/src/artifacts/index-adapters.js +339 -0
- package/dist/src/artifacts/index-builder.js +143 -14
- package/dist/src/artifacts/index-files.js +15 -4
- package/dist/src/artifacts/index-preparation.js +2 -0
- package/dist/src/artifacts/index-reader.js +44 -0
- package/dist/src/artifacts/index-refresh.js +114 -55
- package/dist/src/artifacts/index-status.js +20 -5
- package/dist/src/artifacts/memory-maintenance.js +503 -0
- package/dist/src/artifacts/prebuilt-relations.js +3 -1
- package/dist/src/artifacts/query-engine.js +263 -108
- package/dist/src/artifacts/relations-builder.js +2 -2
- package/dist/src/artifacts/source-graph.js +2 -2
- package/dist/src/artifacts/types.js +9 -1
- package/dist/src/auth/client.js +5 -1
- package/dist/src/auth/credential-store.js +5 -1
- package/dist/src/auth/sensitive-input.js +151 -0
- package/dist/src/channel/manager.mjs +3 -0
- package/dist/src/cli/handlers/agentcard.js +47 -25
- package/dist/src/cli/handlers/auth.js +22 -2
- package/dist/src/cli/handlers/decision.js +22 -3
- package/dist/src/cli/handlers/effect.js +4 -84
- package/dist/src/cli/handlers/guided-setup.js +470 -0
- package/dist/src/cli/handlers/help.js +2 -2
- package/dist/src/cli/handlers/housekeeper.js +1110 -0
- package/dist/src/cli/handlers/index.js +4 -2
- package/dist/src/cli/handlers/init.js +41 -6
- package/dist/src/cli/handlers/install.js +6 -0
- package/dist/src/cli/handlers/local-executor.js +5 -3
- package/dist/src/cli/handlers/marketplace.js +15 -4
- package/dist/src/cli/handlers/mc.js +509 -53
- package/dist/src/cli/handlers/models.js +32 -2
- package/dist/src/cli/handlers/ralph-launcher.js +76 -4
- package/dist/src/cli/handlers/rules.js +1 -1
- package/dist/src/cli/handlers/script-runner.js +73 -2
- package/dist/src/cli/handlers/serve.js +5 -3
- package/dist/src/cli/handlers/sessions.js +1 -0
- package/dist/src/cli/handlers/setup.js +432 -1
- package/dist/src/cli/handlers/skill-lint.js +1 -1
- package/dist/src/cli/handlers/subcommands.js +118 -8
- package/dist/src/cli/handlers/use.js +335 -107
- package/dist/src/cli/handlers/workspace.js +3 -1
- package/dist/src/cli/prompt-utils.js +81 -0
- package/dist/src/cli/router.js +16 -1
- package/dist/src/config/aiwg-config.js +42 -0
- package/dist/src/config/cli.js +7 -3
- package/dist/src/config/decision-config.js +14 -1
- package/dist/src/config/gitignore.js +4 -0
- package/dist/src/config/native-sandbox-warnings.js +25 -0
- package/dist/src/config/workspace.js +2 -1
- package/dist/src/contributors/validation.js +6 -5
- package/dist/src/decision/adapters/jev.js +20 -31
- package/dist/src/decision/admission.js +7 -3
- package/dist/src/decision/ask.js +6 -1
- package/dist/src/decision/benchmark.js +482 -0
- package/dist/src/decision/ledger.js +22 -3
- package/dist/src/decision/pricing.js +147 -0
- package/dist/src/decision/qualification/gate-evidence.js +23 -18
- package/dist/src/decision/qualification/load-staged.js +576 -0
- package/dist/src/decision/qualification/load.js +109 -33
- package/dist/src/decision/qualification/runner.js +12 -5
- package/dist/src/decision/review/service.js +6 -4
- package/dist/src/decision/review/validate.js +23 -2
- package/dist/src/decision/savings.js +8 -3
- package/dist/src/discovery/index.js +492 -0
- package/dist/src/discovery/interview.js +238 -0
- package/dist/src/discovery/plan-apply.js +567 -0
- package/dist/src/discovery/plan-store.js +171 -0
- package/dist/src/discovery/plan-types.js +2 -0
- package/dist/src/discovery/plan-validation.js +139 -0
- package/dist/src/discovery/types.js +2 -0
- package/dist/src/effects/host.js +91 -0
- package/dist/src/extensions/commands/definitions.js +49 -9
- package/dist/src/extensions/manifest.js +71 -44
- package/dist/src/extensions/project-local-discovery.js +1 -1
- package/dist/src/extensions/project-local-gitignore.js +2 -0
- package/dist/src/extensions/project-quickref.js +18 -17
- package/dist/src/extensions/validation.js +32 -29
- package/dist/src/housekeeper/daemon-config.js +148 -0
- package/dist/src/housekeeper/ipc.js +84 -0
- package/dist/src/housekeeper/lifecycle.js +148 -0
- package/dist/src/housekeeper/platform.js +35 -0
- package/dist/src/housekeeper/status.js +70 -0
- package/dist/src/housekeeper/units.js +114 -0
- package/dist/src/issues/cli.js +16 -5
- package/dist/src/issues/live.js +44 -12
- package/dist/src/jobs/flow.js +22 -21
- package/dist/src/lint/rule-activation.js +20 -5
- package/dist/src/lint/runner.js +1 -1
- package/dist/src/marketplace/exchange.js +18 -6
- package/dist/src/marketplace/provenance.js +3 -2
- package/dist/src/mcp/adapters/codex-runtime.js +46 -76
- package/dist/src/mcp/cli.mjs +22 -96
- package/dist/src/mcp/config-file.mjs +6 -2
- package/dist/src/mcp/config-layers.mjs +23 -7
- package/dist/src/mcp/grok-build-config.mjs +2 -1
- package/dist/src/mcp/muse-native-config.mjs +2 -1
- package/dist/src/mcp/profiles.js +18 -31
- package/dist/src/mcp/profiles.mjs +18 -32
- package/dist/src/mcp/registry.js +7 -27
- package/dist/src/mcp/registry.mjs +7 -28
- package/dist/src/mcp/server.mjs +34 -1
- package/dist/src/mcp/tools/agentic-sandbox.mjs +8 -7
- package/dist/src/mcp/tools/command-run.mjs +3 -2
- package/dist/src/mcp/tools/decision.mjs +49 -48
- package/dist/src/mcp/tools/discovery.mjs +46 -21
- package/dist/src/mcp/tools/orchestration.mjs +22 -22
- package/dist/src/mcp/tools/subsystems.mjs +9 -8
- package/dist/src/mcp/tools/worker-invoke.mjs +30 -6
- package/dist/src/mcp/tools/writer-profiles.mjs +1 -1
- package/dist/src/memory/audit.js +719 -0
- package/dist/src/memory/canonical-context.js +392 -13
- package/dist/src/memory/canonical-maintenance.js +95 -0
- package/dist/src/memory/cli-result.js +22 -0
- package/dist/src/memory/cli.js +176 -0
- package/dist/src/memory/context-pack.js +57 -6
- package/dist/src/memory/cost.js +512 -0
- package/dist/src/memory/firewall-classification.d.mts +7 -0
- package/dist/src/memory/firewall-classification.mjs +32 -0
- package/dist/src/memory/index.js +8 -0
- package/dist/src/memory/line-maintenance.js +68 -0
- package/dist/src/memory/maintenance-cli.js +286 -0
- package/dist/src/memory/maintenance-contract.js +136 -0
- package/dist/src/memory/maintenance-index.js +18 -0
- package/dist/src/memory/maintenance-owner.js +2 -0
- package/dist/src/memory/maintenance-record.js +138 -0
- package/dist/src/memory/maintenance.js +254 -0
- package/dist/src/memory/project-registry.js +2 -1
- package/dist/src/memory/provider-memory-adapter.js +154 -0
- package/dist/src/memory/recommend-cli.js +83 -0
- package/dist/src/memory/recommend.js +269 -0
- package/dist/src/memory/scheduled.js +81 -0
- package/dist/src/memory/taxonomy.js +44 -0
- package/dist/src/mission-protocol/codecs.js +19 -9
- package/dist/src/mission-protocol/worker-status.js +91 -1
- package/dist/src/models/config-loader.js +11 -1
- package/dist/src/models/model-capabilities.v1.json +74 -50
- package/dist/src/models/provider-policy.js +125 -62
- package/dist/src/models/resolver.js +45 -8
- package/dist/src/models/worker-installation.d.mts +8 -1
- package/dist/src/models/worker-installation.mjs +231 -38
- package/dist/src/models/wrapper-route.js +1 -1
- package/dist/src/output-modes/registry.js +8 -7
- package/dist/src/packages/adapters/git.js +99 -23
- package/dist/src/packages/adapters/gitea.js +8 -27
- package/dist/src/packages/adapters/github.js +7 -25
- package/dist/src/packages/registry.js +4 -4
- package/dist/src/plugin/metadata-validator.js +1 -1
- package/dist/src/process/cli-command.d.mts +5 -0
- package/dist/src/process/cli-command.mjs +42 -0
- package/dist/src/providers/deploy-version.d.mts +1 -0
- package/dist/src/providers/deploy-version.mjs +17 -0
- package/dist/src/providers/provider-definitions.js +19 -16
- package/dist/src/providers/skill-ownership.d.mts +11 -2
- package/dist/src/providers/skill-ownership.mjs +35 -17
- package/dist/src/rules/activation.d.mts +11 -2
- package/dist/src/rules/activation.mjs +82 -6
- package/dist/src/rules/inventory.js +1 -1
- package/dist/src/rules/rule-frontmatter.schema.json +2 -0
- package/dist/src/schema/zod-validation.d.mts +6 -0
- package/dist/src/schema/zod-validation.mjs +50 -0
- package/dist/src/serve/executor-registry.js +297 -20
- package/dist/src/serve/executor-token.d.mts +1 -0
- package/dist/src/serve/executor-token.mjs +8 -0
- package/dist/src/serve/shared-host-scheduler.js +1102 -31
- package/dist/src/serve/worker-invocation.js +124 -15
- package/dist/src/sessions/adapters/claude.js +19 -18
- package/dist/src/sessions/adapters/codex.js +10 -9
- package/dist/src/sessions/adapters/copilot.js +14 -13
- package/dist/src/sessions/adapters/cursor.js +19 -18
- package/dist/src/sessions/adapters/deepseek-harness.js +9 -8
- package/dist/src/sessions/adapters/factory.js +11 -10
- package/dist/src/sessions/adapters/generic.js +32 -23
- package/dist/src/sessions/adapters/grokbot.js +35 -35
- package/dist/src/sessions/adapters/hermes.js +20 -19
- package/dist/src/sessions/adapters/muse.js +50 -49
- package/dist/src/sessions/adapters/omp.js +5 -4
- package/dist/src/sessions/adapters/openclaw.js +30 -29
- package/dist/src/sessions/adapters/opencode.js +26 -26
- package/dist/src/sessions/adapters/openhuman.js +24 -23
- package/dist/src/sessions/adapters/pi.js +5 -4
- package/dist/src/sessions/adapters/windsurf.js +8 -8
- package/dist/src/sessions/analytics.js +10 -9
- package/dist/src/sessions/candidates.js +7 -6
- package/dist/src/sessions/contracts.js +63 -53
- package/dist/src/sessions/output-registration.js +11 -10
- package/dist/src/sessions/workspace-discovery.js +3 -4
- package/dist/src/smiths/context-pipeline/aiwg-md.js +18 -1
- package/dist/src/smiths/context-pipeline/claude-hook.js +46 -10
- package/dist/src/smiths/context-pipeline/context-file-safety.js +330 -9
- package/dist/src/smiths/context-pipeline/finalization.js +3 -2
- package/dist/src/smiths/context-pipeline/generator.js +7 -19
- package/dist/src/smiths/context-pipeline/legacy-inject.js +3 -10
- package/dist/src/smiths/context-pipeline/managed-hook.js +5 -5
- package/dist/src/smiths/context-pipeline/parallelism-section.js +72 -5
- package/dist/src/smiths/context-pipeline/workspace-context.js +110 -22
- package/dist/src/tracker/project-inputs.js +2 -0
- package/dist/src/update/checker.d.mts +4 -0
- package/dist/src/update/checker.mjs +14 -0
- package/dist/src/update/notifier.mjs +2 -4
- package/dist/src/writing/exemplar-selection.js +6 -6
- package/dist/src/writing/voice-evaluation.js +24 -23
- package/dist/src/writing/writer-migration.js +14 -13
- package/dist/src/writing/writer-profile.js +19 -18
- package/dist/src/writing/writing-brief.js +18 -17
- package/dist/src/writing/writing-receipt.js +47 -46
- package/package.json +5 -2
- package/schemas/decision/DecisionReview.schema.json +78 -1
- package/schemas/mission-v1.schema.json +3 -0
- package/tools/agents/deploy-agents.mjs +67 -39
- package/tools/agents/providers/antigravity.mjs +6 -1
- package/tools/agents/providers/base.mjs +24 -14
- package/tools/agents/providers/claude.mjs +6 -3
- package/tools/agents/providers/codex.mjs +54 -57
- package/tools/agents/providers/context-write.mjs +28 -0
- package/tools/agents/providers/copilot.mjs +13 -4
- package/tools/agents/providers/cursor.mjs +1 -1
- package/tools/agents/providers/deepseek-harness.mjs +1 -1
- package/tools/agents/providers/factory.mjs +7 -1
- package/tools/agents/providers/grok-build.mjs +18 -2
- package/tools/agents/providers/grokbot.mjs +1 -1
- package/tools/agents/providers/hermes.mjs +12 -15
- package/tools/agents/providers/muse-hooks.mjs +21 -14
- package/tools/agents/providers/muse.mjs +7 -2
- package/tools/agents/providers/omp.mjs +31 -5
- package/tools/agents/providers/opencode.mjs +14 -5
- package/tools/agents/providers/openhuman.mjs +1 -1
- package/tools/agents/providers/pi.mjs +1 -1
- package/tools/agents/providers/provider-prepare-coordinator.mjs +29 -9
- package/tools/agents/providers/rule-delivery.mjs +289 -80
- package/tools/agents/providers/warp.mjs +4 -1
- package/tools/agents/providers/windsurf.mjs +13 -3
- package/tools/cli/workspace-status.mjs +5 -0
- package/tools/commands/deploy-prompts-codex.mjs +11 -8
- package/tools/ralph-external/lib/codex-adapter.mjs +6 -2
- package/tools/ralph-external/lib/consecutive-failure-circuit-breaker.mjs +26 -0
- package/tools/ralph-external/lib/launcher-recovery-evidence.mjs +7 -1
- package/tools/ralph-external/lib/muse-adapter.mjs +12 -2
- package/tools/ralph-external/lib/recovery-probe.mjs +14 -4
- package/tools/ralph-external/lib/worker-health.mjs +1 -1
- package/tools/ralph-external/lib/worker-isolation.mjs +65 -9
- package/tools/ralph-external/process-monitor.mjs +49 -8
- package/tools/ralph-external/session-launcher.mjs +405 -35
- package/tools/skills/deploy-skills-codex.mjs +11 -7
- package/vscode-extension/schemas/aiwg.config.v1.json +11 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import { integer, dateTime } from '../schema/zod-validation.mjs';
|
|
3
4
|
const id = z.string().min(1).max(120);
|
|
4
5
|
const nonempty = z.string().min(1);
|
|
5
6
|
const sha = z.string().regex(/^[a-f0-9]{64}$/);
|
|
@@ -10,18 +11,18 @@ export const EVALUATION_CONDITIONS = Array.from({ length: 8 }, (_, n) => ({
|
|
|
10
11
|
rules: Boolean(n & 4), voiceDescription: Boolean(n & 2), exemplars: Boolean(n & 1),
|
|
11
12
|
}));
|
|
12
13
|
export const EVALUATION_DIMENSIONS = ['factual-fidelity', 'author-authenticity', 'reader-suitability', 'effort', 'within-author-preservation', 'between-author-diversity'];
|
|
13
|
-
const model = z.
|
|
14
|
-
const document = z.
|
|
15
|
-
export const evaluationManifestSchema = z.
|
|
14
|
+
const model = z.strictObject({ id, family: nonempty, provider: nonempty, snapshot: nonempty, decoding: z.record(z.string(), z.union([z.string(), z.number().finite(), z.boolean(), z.null()])), promptSha256: sha });
|
|
15
|
+
const document = z.strictObject({ id, authorId: id, topic: nonempty, split: z.enum(['development', 'enrollment', 'heldout']), text: nonempty, sha256: sha });
|
|
16
|
+
export const evaluationManifestSchema = z.strictObject({
|
|
16
17
|
schemaVersion: z.literal(1), id,
|
|
17
18
|
developmentAuthorIds: z.array(id), finalAuthorIds: z.array(id), documents: z.array(document),
|
|
18
|
-
duplicatePolicy: z.
|
|
19
|
-
controls: z.array(z.
|
|
19
|
+
duplicatePolicy: z.strictObject({ metric: z.literal('normalized-word-trigram-jaccard-v1'), threshold: z.number().gt(0).lte(1), justification: nonempty }),
|
|
20
|
+
controls: z.array(z.strictObject({ kind: z.enum(['same-author-different-topic', 'different-author-same-topic']), leftDocumentId: id, rightDocumentId: id })),
|
|
20
21
|
models: z.array(model), extractionModelIds: z.array(id),
|
|
21
|
-
judges: z.array(z.
|
|
22
|
-
humanJudges: z.array(z.
|
|
23
|
-
voluntaryStrata: z.array(z.
|
|
24
|
-
})
|
|
22
|
+
judges: z.array(z.strictObject({ id, modelId: id, role: z.literal('reader').default('reader'), independentCalibrationSha256: sha, selfPreferenceAuditSha256: sha })),
|
|
23
|
+
humanJudges: z.array(z.strictObject({ id, role: z.enum(['author', 'reader']), authorId: id.optional() })).prefault([]),
|
|
24
|
+
voluntaryStrata: z.array(z.strictObject({ authorId: id, suppliedByAuthor: z.literal(true), language: nonempty.optional(), proficiency: nonempty.optional() })),
|
|
25
|
+
});
|
|
25
26
|
const unique = (items) => new Set(items).size === items.length;
|
|
26
27
|
const words = (text) => text.normalize('NFKC').toLowerCase().match(/[\p{L}\p{M}\p{N}]+/gu) ?? [];
|
|
27
28
|
function shingles(text) {
|
|
@@ -80,15 +81,15 @@ export function parseEvaluationManifest(value) {
|
|
|
80
81
|
throw new Error('Unknown voluntary stratum author');
|
|
81
82
|
return m;
|
|
82
83
|
}
|
|
83
|
-
const preregistrationSchema = z.
|
|
84
|
+
const preregistrationSchema = z.strictObject({
|
|
84
85
|
schemaVersion: z.literal(1), id, manifestSha256: sha,
|
|
85
|
-
pilot: z.
|
|
86
|
-
registeredAt:
|
|
87
|
-
plannedAuthors:
|
|
88
|
-
thresholds: z.array(z.
|
|
86
|
+
pilot: z.strictObject({ artifactSha256: sha, completedAt: dateTime(), authorIds: z.array(id).min(1), findings: nonempty }),
|
|
87
|
+
registeredAt: dateTime(), finalDataNotAccessed: z.literal(true),
|
|
88
|
+
plannedAuthors: integer().min(2), sampleSizeJustification: nonempty,
|
|
89
|
+
thresholds: z.array(z.strictObject({ dimension: z.enum(EVALUATION_DIMENSIONS), value: z.number().finite(), direction: z.enum(['at-least', 'at-most']), justification: nonempty })).min(1),
|
|
89
90
|
primaryOutcomes: z.array(z.enum(EVALUATION_DIMENSIONS)).min(1), analysisPlan: nonempty,
|
|
90
|
-
selectorPoliciesSha256: sha, budget: z.
|
|
91
|
-
})
|
|
91
|
+
selectorPoliciesSha256: sha, budget: z.strictObject({ limit: integer().positive(), tokenizerId: nonempty, tokenizerVersion: nonempty }),
|
|
92
|
+
});
|
|
92
93
|
/** Records caller declarations; hashes/timestamps do not attest that a pilot occurred or final data stayed unseen. */
|
|
93
94
|
export function preregisterEvaluation(manifest, value) {
|
|
94
95
|
const m = parseEvaluationManifest(manifest);
|
|
@@ -103,13 +104,13 @@ export function preregisterEvaluation(manifest, value) {
|
|
|
103
104
|
throw new Error('Duplicate preregistered outcomes');
|
|
104
105
|
return p;
|
|
105
106
|
}
|
|
106
|
-
const stimulusSchema = z.
|
|
107
|
+
const stimulusSchema = z.strictObject({ id, taskId: id, authorId: id, heldoutDocumentId: id, text: nonempty, sha256: sha, budgetUsed: integer().nonnegative(), tokenizerId: nonempty, tokenizerVersion: nonempty, conditionId: z.enum(['r0v0e0', 'r0v0e1', 'r0v1e0', 'r0v1e1', 'r1v0e0', 'r1v0e1', 'r1v1e0', 'r1v1e1']), workflow: z.enum(EVALUATION_WORKFLOWS), modelId: id.nullable(), genre: nonempty, lengthBand: nonempty, editingStrength: nonempty });
|
|
107
108
|
/** Latin-square rotations plus reversed blocks. Balance is exact only for complete 2N-judge blocks per role. */
|
|
108
109
|
export function createBlindEvaluationPackets(stimuliInput, judges, seed) {
|
|
109
110
|
const stimuli = z.array(stimulusSchema).min(2).parse(stimuliInput);
|
|
110
111
|
if (stimuli.some(s => evaluationHash(s.text) !== s.sha256))
|
|
111
112
|
throw new Error('Stimulus integrity mismatch');
|
|
112
|
-
z.array(z.
|
|
113
|
+
z.array(z.strictObject({ id, role: z.enum(['author', 'reader']) })).min(1).parse(judges);
|
|
113
114
|
if (!seed || !unique(stimuli.map(s => s.id)) || !unique(judges.map(j => j.id)))
|
|
114
115
|
throw new Error('Seed and unique stimulus/judge IDs required');
|
|
115
116
|
if (new Set(stimuli.map(s => `${s.authorId}\0${s.taskId}\0${s.heldoutDocumentId}`)).size !== 1)
|
|
@@ -150,7 +151,7 @@ function validateManifestStimuli(m, input) {
|
|
|
150
151
|
return stimuli;
|
|
151
152
|
}
|
|
152
153
|
function ingestRatings(ratings, context) {
|
|
153
|
-
const parsed = z.array(z.
|
|
154
|
+
const parsed = z.array(z.strictObject({ stimulusId: id, authorId: id, judgeId: id, role: z.enum(['author', 'reader']), dimension: z.enum(EVALUATION_DIMENSIONS), value: z.number().finite().nullable(), missingReason: nonempty.optional(), tie: z.boolean() })).parse(ratings);
|
|
154
155
|
if (!unique(parsed.map(r => JSON.stringify([r.stimulusId, r.judgeId, r.role, r.dimension]))))
|
|
155
156
|
throw new Error('Duplicate rating observations');
|
|
156
157
|
if (parsed.some(r => r.value === null && (!r.missingReason || r.tie) || r.value !== null && r.missingReason !== undefined))
|
|
@@ -172,7 +173,7 @@ function ingestRatings(ratings, context) {
|
|
|
172
173
|
if (validate(r).authorId !== r.authorId)
|
|
173
174
|
throw new Error('Rating/stimulus author mismatch');
|
|
174
175
|
if (context.assignments !== undefined) {
|
|
175
|
-
const assignments = z.array(z.
|
|
176
|
+
const assignments = z.array(z.strictObject({ stimulusId: id, judgeId: id, role: z.enum(['author', 'reader']), dimension: z.enum(EVALUATION_DIMENSIONS) })).parse(context.assignments);
|
|
176
177
|
if (!unique(assignments.map(key)))
|
|
177
178
|
throw new Error('Duplicate rating assignments');
|
|
178
179
|
for (const assignment of assignments)
|
|
@@ -205,7 +206,7 @@ function random(seed) {
|
|
|
205
206
|
}
|
|
206
207
|
/** Equal-weight author means, then author-cluster percentile bootstrap; no independent-text pseudo-replication. */
|
|
207
208
|
export function bootstrapAuthorMeans(rows, options) {
|
|
208
|
-
z.array(z.
|
|
209
|
+
z.array(z.strictObject({ authorId: id, value: z.number().finite().nullable() })).parse(rows);
|
|
209
210
|
if (!options.seed || !Number.isSafeInteger(options.iterations) || options.iterations < 2 || !Number.isFinite(options.confidence) || options.confidence <= 0 || options.confidence >= 1)
|
|
210
211
|
throw new Error('Invalid bootstrap options');
|
|
211
212
|
const authors = [...new Set(rows.map(r => r.authorId))].sort();
|
|
@@ -227,9 +228,9 @@ export function bootstrapAuthorMeans(rows, options) {
|
|
|
227
228
|
}
|
|
228
229
|
/** Outcomes must already share a preregistered decision rule; never compare arbitrary raw scales. */
|
|
229
230
|
export function reportMetricDisagreement(rows, calibration) {
|
|
230
|
-
z.
|
|
231
|
+
z.strictObject({ humanReferenceSha256: sha, independentOfFinalData: z.literal(true), decisionRule: nonempty }).parse(calibration);
|
|
231
232
|
const outcome = z.enum(['pass', 'fail', 'tie']).nullable();
|
|
232
|
-
z.array(z.
|
|
233
|
+
z.array(z.strictObject({ itemId: id, human: outcome, metric: outcome })).parse(rows);
|
|
233
234
|
if (!unique(rows.map(r => r.itemId)))
|
|
234
235
|
throw new Error('Duplicate metric comparison IDs');
|
|
235
236
|
const paired = rows.filter(r => r.human !== null && r.metric !== null);
|
|
@@ -2,6 +2,7 @@ import { createHash, randomUUID } from 'node:crypto';
|
|
|
2
2
|
import { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { isAbsolute, resolve, join } from 'node:path';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
+
import { integer, dateTime } from '../schema/zod-validation.mjs';
|
|
5
6
|
import { importLegacyWriterProfile } from './writer-profile-legacy.js';
|
|
6
7
|
import { parseWriterProfile } from './writer-profile.js';
|
|
7
8
|
import { WriterProfileStore } from './writer-profile-store.js';
|
|
@@ -19,38 +20,38 @@ function canonicalize(value) {
|
|
|
19
20
|
}
|
|
20
21
|
return value;
|
|
21
22
|
}
|
|
22
|
-
const requestSchema = z.
|
|
23
|
+
const requestSchema = z.strictObject({
|
|
23
24
|
cwd: z.string().min(1),
|
|
24
25
|
sourcePath: z.string().min(1),
|
|
25
26
|
format: z.enum(['yaml', 'json']),
|
|
26
27
|
scope: z.enum(['project', 'user']).default('project'),
|
|
27
28
|
userConfigDir: z.string().min(1).optional(),
|
|
28
|
-
profile: z.
|
|
29
|
+
profile: z.strictObject({
|
|
29
30
|
id: profileId,
|
|
30
31
|
name: z.string().min(1).max(200),
|
|
31
32
|
version: z.string().regex(/^\d+\.\d+\.\d+$/).default('1.0.0'),
|
|
32
|
-
provenance: z.
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
const planSchema = z.
|
|
33
|
+
provenance: z.strictObject({ source: z.string().min(1).max(2000), license: z.string().min(1).max(200) }),
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
36
|
+
const planSchema = z.strictObject({
|
|
36
37
|
schemaVersion: z.literal('aiwg.writer-migration-plan.v1'),
|
|
37
38
|
id: z.string().regex(/^wm-[a-f0-9]{24}$/),
|
|
38
39
|
planSha256: digest,
|
|
39
|
-
createdAt:
|
|
40
|
+
createdAt: dateTime(),
|
|
40
41
|
dryRun: z.literal(true),
|
|
41
42
|
cwd: z.string().min(1),
|
|
42
|
-
source: z.
|
|
43
|
-
target: z.
|
|
43
|
+
source: z.strictObject({ path: z.string().min(1), format: z.enum(['yaml', 'json']), sha256: digest, bytes: integer().nonnegative(), legacyKind: z.string().min(1).max(80) }),
|
|
44
|
+
target: z.strictObject({
|
|
44
45
|
scope: z.enum(['project', 'user']),
|
|
45
46
|
profileId,
|
|
46
47
|
userConfigDir: z.string().min(1).optional(),
|
|
47
|
-
existingProfile: z.
|
|
48
|
+
existingProfile: z.strictObject({ revision: integer().positive(), sha256: digest }).nullable(),
|
|
48
49
|
activatesProfile: z.literal(false),
|
|
49
|
-
})
|
|
50
|
+
}),
|
|
50
51
|
actions: z.array(z.string().min(1).max(200)).min(1),
|
|
51
52
|
warnings: z.array(z.string().min(1).max(400)),
|
|
52
|
-
profileTemplate: z.unknown(),
|
|
53
|
-
})
|
|
53
|
+
profileTemplate: z.unknown().optional(),
|
|
54
|
+
});
|
|
54
55
|
function planDigest(plan) {
|
|
55
56
|
return hash(JSON.stringify(canonicalize(plan)));
|
|
56
57
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import { integer } from '../schema/zod-validation.mjs';
|
|
3
4
|
import { redactText } from '../governance/redaction.js';
|
|
4
5
|
import { validateLegacyWriterProfile } from './writer-profile-legacy.js';
|
|
5
6
|
const hash = (text) => createHash('sha256').update(text).digest('hex');
|
|
6
7
|
const id = z.string().min(1).max(120).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]*$/);
|
|
7
|
-
const provenance = z.
|
|
8
|
-
const evidence = z.
|
|
8
|
+
const provenance = z.strictObject({ source: z.string().min(1).max(2000), license: z.string().min(1).max(200) });
|
|
9
|
+
const evidence = z.strictObject({ sampleId: id, start: integer().nonnegative(), end: integer().positive() });
|
|
9
10
|
/** Closed expression controls exclude identity, personality and generated signature phrases. */
|
|
10
11
|
export const writerPreferenceValues = {
|
|
11
12
|
dialect: ['unspecified', 'en-US', 'en-GB', 'en-AU', 'en-CA', 'fr-FR', 'fr-CA'],
|
|
@@ -22,29 +23,29 @@ export const writerPreferenceValues = {
|
|
|
22
23
|
structure: ['prose', 'lists', 'contextual'],
|
|
23
24
|
};
|
|
24
25
|
const preferenceKey = z.enum(Object.keys(writerPreferenceValues));
|
|
25
|
-
const preference = z.
|
|
26
|
+
const preference = z.strictObject({
|
|
26
27
|
id, key: preferenceKey, value: z.string(), origin: z.enum(['explicit', 'inferred']),
|
|
27
|
-
confidence: z.enum(['low', 'moderate', 'high']), evidence: z.array(evidence).
|
|
28
|
+
confidence: z.enum(['low', 'moderate', 'high']), evidence: z.array(evidence).prefault([]),
|
|
28
29
|
task: z.string().max(120).optional(), status: z.enum(['accepted', 'rejected']).default('accepted'),
|
|
29
|
-
})
|
|
30
|
-
const override = z.
|
|
31
|
-
const sample = z.
|
|
30
|
+
});
|
|
31
|
+
const override = z.strictObject({ key: preferenceKey, action: z.enum(['set', 'reject', 'reset']), value: z.string().optional(), task: z.string().max(120).optional() });
|
|
32
|
+
const sample = z.strictObject({
|
|
32
33
|
id, text: z.string().max(1_000_000).optional(), sha256: z.string().regex(/^[a-f0-9]{64}$/), approved: z.boolean(),
|
|
33
34
|
status: z.enum(['active', 'revoked']), provenance,
|
|
34
|
-
rights: z.
|
|
35
|
+
rights: z.strictObject({ useForVoice: z.boolean(), shareText: z.boolean() }),
|
|
35
36
|
sensitivity: z.enum(['public', 'private', 'secret']),
|
|
36
|
-
})
|
|
37
|
-
export const legacyProfileAttachmentSchema = z.
|
|
37
|
+
});
|
|
38
|
+
export const legacyProfileAttachmentSchema = z.strictObject({
|
|
38
39
|
format: z.enum(['yaml', 'json']),
|
|
39
40
|
kind: z.enum(['addon-template', 'python-generated', 'python-analyzed', 'python-blended', 'ts-analyzer', 'ts-calibration']),
|
|
40
|
-
raw: z.string(), sha256: z.string().regex(/^[a-f0-9]{64}$/), payload: z.unknown(),
|
|
41
|
-
})
|
|
42
|
-
export const writerProfileSchema = z.
|
|
43
|
-
schemaVersion: z.literal(1), revision:
|
|
44
|
-
samples: z.array(sample), preferences: z.array(preference), overrides: z.array(override).
|
|
45
|
-
counterexamples: z.array(evidence).
|
|
46
|
-
cacheEpoch:
|
|
47
|
-
}).
|
|
41
|
+
raw: z.string(), sha256: z.string().regex(/^[a-f0-9]{64}$/), payload: z.unknown().optional(),
|
|
42
|
+
});
|
|
43
|
+
export const writerProfileSchema = z.strictObject({
|
|
44
|
+
schemaVersion: z.literal(1), revision: integer().positive().default(1), metadataSharingApproved: z.boolean().default(false), id: z.string().regex(/^[a-z0-9][a-z0-9.-]{0,79}$/).refine(v => !v.includes('..')), version: z.string().regex(/^\d+\.\d+\.\d+$/), name: z.string().min(1).max(200), provenance,
|
|
45
|
+
samples: z.array(sample), preferences: z.array(preference), overrides: z.array(override).prefault([]),
|
|
46
|
+
counterexamples: z.array(evidence).prefault([]), legacy: legacyProfileAttachmentSchema.optional(),
|
|
47
|
+
cacheEpoch: integer().nonnegative().default(0),
|
|
48
|
+
}).superRefine((p, ctx) => {
|
|
48
49
|
const problem = (message) => ctx.addIssue({ code: z.ZodIssueCode.custom, message });
|
|
49
50
|
if (new Set(p.samples.map(s => s.id)).size !== p.samples.length)
|
|
50
51
|
problem('Duplicate sample IDs');
|
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import { integer } from '../schema/zod-validation.mjs';
|
|
3
4
|
const id = z.string().min(1).max(120).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]*$/);
|
|
4
5
|
const digest = z.string().regex(/^[a-f0-9]{64}$/);
|
|
5
6
|
const text = z.string().min(1);
|
|
6
|
-
const span = { start:
|
|
7
|
-
const evidence = z.
|
|
8
|
-
const input = z.
|
|
7
|
+
const span = { start: integer().nonnegative(), end: integer().nonnegative() };
|
|
8
|
+
const evidence = z.strictObject({ inputId: id, ...span });
|
|
9
|
+
const input = z.strictObject({
|
|
9
10
|
id, kind: z.enum(['source', 'author-notes', 'existing-draft']), text,
|
|
10
|
-
sha256: digest, provenance: z.
|
|
11
|
+
sha256: digest, provenance: z.strictObject({ source: text, version: text }),
|
|
11
12
|
authorApproved: z.boolean(),
|
|
12
|
-
})
|
|
13
|
-
const proposition = z.
|
|
13
|
+
});
|
|
14
|
+
const proposition = z.strictObject({
|
|
14
15
|
id, text, evidenceStrength: z.enum(['verified', 'reported', 'preliminary', 'experimental', 'unverified']),
|
|
15
16
|
evidence: z.array(evidence).min(1), qualifiers: z.array(text),
|
|
16
|
-
})
|
|
17
|
-
const authorClaim = z.
|
|
17
|
+
});
|
|
18
|
+
const authorClaim = z.strictObject({
|
|
18
19
|
id, kind: z.enum(['experience', 'opinion', 'intent', 'rationale']), text,
|
|
19
20
|
evidence: z.array(evidence).min(1),
|
|
20
|
-
})
|
|
21
|
-
const correction = z.
|
|
21
|
+
});
|
|
22
|
+
const correction = z.strictObject({
|
|
22
23
|
id, ...span, expected: z.string(), replacement: z.string(), reason: text,
|
|
23
24
|
authorAuthorized: z.literal(true),
|
|
24
|
-
})
|
|
25
|
-
export const writingBriefSchema = z.
|
|
25
|
+
});
|
|
26
|
+
export const writingBriefSchema = z.strictObject({
|
|
26
27
|
schemaVersion: z.literal(1), id,
|
|
27
28
|
operation: z.enum(['draft-from-notes', 'edit-existing', 'proofread-only', 'continue-author-text']),
|
|
28
|
-
reader: z.
|
|
29
|
+
reader: z.strictObject({ task: z.string(), audience: text, requirements: z.array(text) }),
|
|
29
30
|
intendedAction: z.string(), exclusions: z.array(text), inputs: z.array(input),
|
|
30
31
|
propositions: z.array(proposition), limitations: z.array(proposition), authorClaims: z.array(authorClaim),
|
|
31
32
|
sourceInputId: id.optional(),
|
|
32
|
-
permissions: z.
|
|
33
|
-
})
|
|
33
|
+
permissions: z.strictObject({ rephrase: z.boolean(), reorder: z.boolean(), addContent: z.boolean(), corrections: z.array(correction) }),
|
|
34
|
+
});
|
|
34
35
|
export const writingBriefHash = (value) => createHash('sha256').update(value, 'utf8').digest('hex');
|
|
35
36
|
function boundary(source, offset) {
|
|
36
37
|
return offset >= 0 && offset <= source.length
|
|
@@ -101,7 +102,7 @@ export function parseWritingBrief(value) {
|
|
|
101
102
|
/** Parameterization changes presentation targets only, never the brief or confidence. */
|
|
102
103
|
export function prepareWritingBrief(value, target) {
|
|
103
104
|
const b = parseWritingBrief(value);
|
|
104
|
-
const selection = z.
|
|
105
|
+
const selection = z.strictObject({ profileId: id, channel: z.enum(['article', 'social', 'email', 'engineering', 'conversation']) }).safeParse(target);
|
|
105
106
|
if (!selection.success)
|
|
106
107
|
throw new Error('Invalid writing brief target; input text is omitted.');
|
|
107
108
|
return { brief: structuredClone(b), target: selection.data, briefDigest: writingBriefHash(JSON.stringify(b)),
|
|
@@ -114,7 +115,7 @@ export function validateBriefClaims(value, proposed) {
|
|
|
114
115
|
if (!check.valid)
|
|
115
116
|
return check;
|
|
116
117
|
const b = parseWritingBrief(value);
|
|
117
|
-
const proposal = z.array(z.
|
|
118
|
+
const proposal = z.array(z.strictObject({ kind: z.enum(['proposition', 'experience', 'opinion', 'intent', 'rationale']), text, groundedIn: z.array(id) })).safeParse(proposed);
|
|
118
119
|
if (!proposal.success)
|
|
119
120
|
return { valid: false, diagnostics: [{ code: 'schema', message: 'Invalid proposed claim shape; input text is omitted.' }] };
|
|
120
121
|
const claims = [...b.propositions.map(p => ({ ...p, kind: 'proposition' })), ...b.limitations.map(p => ({ ...p, kind: 'proposition' })), ...b.authorClaims];
|
|
@@ -2,12 +2,13 @@ import { createHash, randomUUID } from 'node:crypto';
|
|
|
2
2
|
import { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { dirname, join } from 'node:path';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
+
import { integer, dateTime } from '../schema/zod-validation.mjs';
|
|
5
6
|
import { redactStructured } from '../governance/redaction.js';
|
|
6
7
|
import { resolveProjectAiwgDirForWrite } from '../config/project-artifacts.js';
|
|
7
8
|
const sha = z.string().regex(/^[a-f0-9]{64}$/);
|
|
8
9
|
const id = z.string().min(1).max(120).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]*$/);
|
|
9
10
|
const stableId = z.string().min(1).max(120).regex(/^[a-z0-9][a-z0-9.-]*$/).refine(value => !value.includes('..'));
|
|
10
|
-
const isoDate =
|
|
11
|
+
const isoDate = dateTime();
|
|
11
12
|
const hash = (text) => createHash('sha256').update(text, 'utf8').digest('hex');
|
|
12
13
|
function canonicalize(value) {
|
|
13
14
|
if (Array.isArray(value))
|
|
@@ -28,105 +29,105 @@ function rejectSensitiveReceipt(value) {
|
|
|
28
29
|
if (redacted.sensitivity !== 'none')
|
|
29
30
|
throw new Error('Writing receipt contains a known secret or credential field');
|
|
30
31
|
}
|
|
31
|
-
const budgetSchema = z.
|
|
32
|
-
limit:
|
|
33
|
-
used:
|
|
32
|
+
const budgetSchema = z.strictObject({
|
|
33
|
+
limit: integer().nonnegative(),
|
|
34
|
+
used: integer().nonnegative(),
|
|
34
35
|
unit: z.enum(['tokens', 'utf8-bytes', 'characters']),
|
|
35
36
|
measurement: z.enum(['exact', 'upper-bound', 'estimated']),
|
|
36
37
|
tokenizerId: z.string().min(1).max(120),
|
|
37
38
|
tokenizerVersion: z.string().min(1).max(120),
|
|
38
|
-
}).
|
|
39
|
-
const operationConfigSchema = z.
|
|
39
|
+
}).refine(value => value.used <= value.limit, 'Budget use cannot exceed limit');
|
|
40
|
+
const operationConfigSchema = z.strictObject({
|
|
40
41
|
action: z.enum(['plan', 'proofread', 'draft', 'edit', 'continue']),
|
|
41
|
-
correctionIds: z.array(id).
|
|
42
|
+
correctionIds: z.array(id).prefault([]),
|
|
42
43
|
channel: z.enum(['article', 'social', 'email', 'engineering', 'conversation']).optional(),
|
|
43
44
|
configSha256: sha.optional(),
|
|
44
|
-
})
|
|
45
|
-
const receiptInputBaseSchema = z.
|
|
45
|
+
});
|
|
46
|
+
const receiptInputBaseSchema = z.strictObject({
|
|
46
47
|
schemaVersion: z.literal('aiwg.writing-receipt.v1').default('aiwg.writing-receipt.v1'),
|
|
47
48
|
id: stableId.optional(),
|
|
48
49
|
createdAt: isoDate.default(() => new Date().toISOString()),
|
|
49
50
|
operation: z.enum(['draft-from-notes', 'edit-existing', 'proofread-only', 'continue-author-text']),
|
|
50
|
-
profile: z.
|
|
51
|
+
profile: z.strictObject({
|
|
51
52
|
id: stableId,
|
|
52
53
|
version: z.string().regex(/^\d+\.\d+\.\d+$/),
|
|
53
|
-
revision:
|
|
54
|
-
cacheEpoch:
|
|
54
|
+
revision: integer().positive(),
|
|
55
|
+
cacheEpoch: integer().nonnegative(),
|
|
55
56
|
compiledModeSha256: sha.optional(),
|
|
56
57
|
fallback: z.boolean(),
|
|
57
|
-
})
|
|
58
|
-
examples: z.
|
|
58
|
+
}),
|
|
59
|
+
examples: z.strictObject({
|
|
59
60
|
receiptSha256: sha.optional(),
|
|
60
61
|
cacheKey: sha.optional(),
|
|
61
|
-
selections: z.array(z.
|
|
62
|
+
selections: z.array(z.strictObject({ sampleId: id, sha256: sha })).prefault([]),
|
|
62
63
|
budget: budgetSchema.optional(),
|
|
63
64
|
fallback: z.boolean().default(false),
|
|
64
|
-
}).
|
|
65
|
-
modes: z.array(z.
|
|
65
|
+
}).optional(),
|
|
66
|
+
modes: z.array(z.strictObject({
|
|
66
67
|
id: stableId,
|
|
67
68
|
version: z.string().min(1).max(120),
|
|
68
69
|
profileSha256: sha.optional(),
|
|
69
|
-
})
|
|
70
|
-
state: z.
|
|
71
|
-
selected: z.array(stableId).
|
|
72
|
-
delivered: z.array(stableId).
|
|
73
|
-
applied: z.array(stableId).
|
|
74
|
-
validated: z.array(stableId).
|
|
70
|
+
})).prefault([]),
|
|
71
|
+
state: z.strictObject({
|
|
72
|
+
selected: z.array(stableId).prefault([]),
|
|
73
|
+
delivered: z.array(stableId).prefault([]),
|
|
74
|
+
applied: z.array(stableId).prefault([]),
|
|
75
|
+
validated: z.array(stableId).prefault([]),
|
|
75
76
|
deliveredTo: z.enum(['local-transform-callback', 'none']),
|
|
76
77
|
fallback: z.enum(['none', 'unaltered']),
|
|
77
|
-
}).
|
|
78
|
-
modelPrompt: z.
|
|
78
|
+
}).optional(),
|
|
79
|
+
modelPrompt: z.strictObject({
|
|
79
80
|
execution: z.enum(['none', 'local-callback', 'hosted']).default('none'),
|
|
80
81
|
provider: z.string().min(1).max(120).optional(),
|
|
81
82
|
model: z.string().min(1).max(120).optional(),
|
|
82
83
|
promptSha256: sha,
|
|
83
84
|
templateSha256: sha.optional(),
|
|
84
|
-
decoding: z.
|
|
85
|
+
decoding: z.strictObject({
|
|
85
86
|
temperature: z.number().finite().min(0).max(2).optional(),
|
|
86
87
|
topP: z.number().finite().min(0).max(1).optional(),
|
|
87
|
-
maxOutputTokens:
|
|
88
|
-
seed:
|
|
88
|
+
maxOutputTokens: integer().positive().optional(),
|
|
89
|
+
seed: integer().optional(),
|
|
89
90
|
stopSha256: sha.optional(),
|
|
90
|
-
}).
|
|
91
|
+
}).optional(),
|
|
91
92
|
promptConfigSha256: sha.optional(),
|
|
92
|
-
hostedVersion: z.
|
|
93
|
+
hostedVersion: z.strictObject({
|
|
93
94
|
attested: z.literal(false),
|
|
94
95
|
reason: z.literal('Hosted provider prompt/version cannot be attested from this local receipt.'),
|
|
95
|
-
}).
|
|
96
|
-
})
|
|
97
|
-
inputs: z.array(z.
|
|
96
|
+
}).optional(),
|
|
97
|
+
}),
|
|
98
|
+
inputs: z.array(z.strictObject({
|
|
98
99
|
id,
|
|
99
100
|
role: z.enum(['source', 'author-notes', 'existing-draft', 'brief', 'configuration']),
|
|
100
101
|
sha256: sha,
|
|
101
|
-
})
|
|
102
|
+
})).min(1),
|
|
102
103
|
operationConfig: operationConfigSchema.optional(),
|
|
103
|
-
output: z.
|
|
104
|
+
output: z.strictObject({
|
|
104
105
|
sha256: sha,
|
|
105
106
|
path: z.string().min(1).max(2000).optional(),
|
|
106
|
-
}).
|
|
107
|
+
}).optional(),
|
|
107
108
|
budget: budgetSchema,
|
|
108
|
-
fallback: z.
|
|
109
|
+
fallback: z.strictObject({
|
|
109
110
|
applied: z.boolean(),
|
|
110
111
|
reason: z.string().min(1).max(400).optional(),
|
|
111
|
-
})
|
|
112
|
-
validators: z.array(z.
|
|
112
|
+
}),
|
|
113
|
+
validators: z.array(z.strictObject({
|
|
113
114
|
id,
|
|
114
115
|
version: z.string().min(1).max(120),
|
|
115
116
|
sha256: sha.optional(),
|
|
116
117
|
outcome: z.enum(['pass', 'fail', 'uncertain', 'not-run']),
|
|
117
|
-
})
|
|
118
|
-
evaluation: z.array(z.
|
|
118
|
+
})).prefault([]),
|
|
119
|
+
evaluation: z.array(z.strictObject({
|
|
119
120
|
id,
|
|
120
121
|
method: z.string().min(1).max(120),
|
|
121
122
|
sha256: sha,
|
|
122
123
|
outcome: z.enum(['pass', 'fail', 'uncertain', 'not-established']),
|
|
123
|
-
})
|
|
124
|
-
authorAcceptance: z.
|
|
124
|
+
})).prefault([]),
|
|
125
|
+
authorAcceptance: z.strictObject({
|
|
125
126
|
status: z.enum(['accepted', 'pending', 'rejected', 'not-required']),
|
|
126
127
|
acceptedAt: isoDate.optional(),
|
|
127
128
|
acceptedBy: z.string().min(1).max(120).optional(),
|
|
128
|
-
})
|
|
129
|
-
})
|
|
129
|
+
}),
|
|
130
|
+
});
|
|
130
131
|
const enforceReceiptRules = (value, ctx) => {
|
|
131
132
|
if (new Set(value.inputs.map(input => input.id)).size !== value.inputs.length) {
|
|
132
133
|
ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'Input IDs must be unique' });
|
|
@@ -176,7 +177,7 @@ const enforceReceiptRules = (value, ctx) => {
|
|
|
176
177
|
}
|
|
177
178
|
};
|
|
178
179
|
const receiptInputSchema = receiptInputBaseSchema.superRefine(enforceReceiptRules);
|
|
179
|
-
export const writingReceiptSchema = receiptInputBaseSchema.extend({ id: stableId, operationConfig: operationConfigSchema, receiptSha256: sha }).
|
|
180
|
+
export const writingReceiptSchema = receiptInputBaseSchema.extend({ id: stableId, operationConfig: operationConfigSchema, receiptSha256: sha }).superRefine(enforceReceiptRules);
|
|
180
181
|
export function createWritingReceipt(input) {
|
|
181
182
|
const parsed = receiptInputSchema.parse(input);
|
|
182
183
|
const defaultAction = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiwg/cli",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.7",
|
|
4
4
|
"description": "Lightweight AIWG CLI for signed, versioned web-backed resources.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
"THIRD_PARTY_NOTICES.md",
|
|
28
28
|
"bin/",
|
|
29
29
|
"agentic/code/providers/",
|
|
30
|
+
"agentic/code/addons/composition-engine/lib/runtime.mjs",
|
|
31
|
+
"agentic/code/addons/composition-engine/lib/validator.mjs",
|
|
32
|
+
"agentic/code/addons/composition-engine/schemas/flow-graph.schema.json",
|
|
30
33
|
"schemas/security/",
|
|
31
34
|
"schemas/decision/",
|
|
32
35
|
"schemas/dataset/",
|
|
@@ -115,7 +118,7 @@
|
|
|
115
118
|
"semver": "^7.8.5",
|
|
116
119
|
"toml-eslint-parser": "0.10.0",
|
|
117
120
|
"yaml": "^2.9.0",
|
|
118
|
-
"zod": "^
|
|
121
|
+
"zod": "^4.6.6"
|
|
119
122
|
},
|
|
120
123
|
"optionalDependencies": {
|
|
121
124
|
"@hono/node-server": "2.0.11",
|
|
@@ -17,12 +17,89 @@
|
|
|
17
17
|
"lifecycle": { "type": "object", "additionalProperties": false, "required": ["legalHold"], "properties": { "legalHold": { "type": "boolean" }, "tombstonedAtEpochMs": { "type": "integer", "minimum": 0 }, "tombstoneReason": { "type": "string" } } }
|
|
18
18
|
},
|
|
19
19
|
"$defs": {
|
|
20
|
+
"evaluation": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"additionalProperties": false,
|
|
23
|
+
"description": "Observed evaluator provenance and evidence. Agreement does not establish independent errors or proof.",
|
|
24
|
+
"properties": {
|
|
25
|
+
"evaluatorModel": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"minLength": 1,
|
|
28
|
+
"maxLength": 8192,
|
|
29
|
+
"pattern": "\\S"
|
|
30
|
+
},
|
|
31
|
+
"evaluatorVendor": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"minLength": 1,
|
|
34
|
+
"maxLength": 8192,
|
|
35
|
+
"pattern": "\\S"
|
|
36
|
+
},
|
|
37
|
+
"evaluatorFamily": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"minLength": 1,
|
|
40
|
+
"maxLength": 8192,
|
|
41
|
+
"pattern": "\\S",
|
|
42
|
+
"description": "Observed model family; unknown remains unknown. CLI names are not model families."
|
|
43
|
+
},
|
|
44
|
+
"acceptanceCriteriaRef": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"minLength": 1,
|
|
47
|
+
"maxLength": 8192,
|
|
48
|
+
"pattern": "\\S"
|
|
49
|
+
},
|
|
50
|
+
"reReviewOf": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"minLength": 1,
|
|
53
|
+
"maxLength": 8192,
|
|
54
|
+
"pattern": "\\S",
|
|
55
|
+
"description": "Reference to the previous review/decision, recorded on a re-review after material fixes."
|
|
56
|
+
},
|
|
57
|
+
"disagreements": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"items": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"additionalProperties": false,
|
|
62
|
+
"required": [
|
|
63
|
+
"claimRef",
|
|
64
|
+
"generatorPosition",
|
|
65
|
+
"evaluatorPosition"
|
|
66
|
+
],
|
|
67
|
+
"properties": {
|
|
68
|
+
"claimRef": {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"minLength": 1,
|
|
71
|
+
"maxLength": 8192,
|
|
72
|
+
"pattern": "\\S"
|
|
73
|
+
},
|
|
74
|
+
"generatorPosition": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"minLength": 1,
|
|
77
|
+
"maxLength": 8192,
|
|
78
|
+
"pattern": "\\S"
|
|
79
|
+
},
|
|
80
|
+
"evaluatorPosition": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"minLength": 1,
|
|
83
|
+
"maxLength": 8192,
|
|
84
|
+
"pattern": "\\S"
|
|
85
|
+
},
|
|
86
|
+
"resolutionRef": {
|
|
87
|
+
"type": "string",
|
|
88
|
+
"minLength": 1,
|
|
89
|
+
"maxLength": 8192,
|
|
90
|
+
"pattern": "\\S"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
20
97
|
"digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
21
98
|
"actor": { "type": "object", "additionalProperties": false, "required": ["id", "roles", "authorityContext"], "properties": { "id": { "type": "string", "minLength": 1 }, "roles": { "type": "array", "items": { "type": "string" } }, "authorityContext": { "type": "string" } } },
|
|
22
99
|
"pin": { "type": "object", "additionalProperties": false, "required": ["id", "version", "digest"], "properties": { "id": { "type": "string" }, "version": { "type": "string" }, "digest": { "$ref": "#/$defs/digest" } } },
|
|
23
100
|
"sourceReceipt": { "type": "object", "additionalProperties": false, "required": ["id", "digest"], "properties": { "id": { "type": "string" }, "digest": { "$ref": "#/$defs/digest" } } },
|
|
24
101
|
"proposal": { "type": "object", "additionalProperties": false, "required": ["version", "action", "actionDigest", "createdAtEpochMs", "editor", "rationale"], "properties": { "version": { "type": "integer", "minimum": 1 }, "action": {}, "actionDigest": { "$ref": "#/$defs/digest" }, "createdAtEpochMs": { "type": "integer" }, "editor": { "$ref": "#/$defs/actor" }, "rationale": { "type": "string" } } },
|
|
25
|
-
"decision": { "type": "object", "additionalProperties": false, "required": ["reviewer", "proposalVersion", "decision", "rationale", "atEpochMs"], "properties": { "reviewer": { "$ref": "#/$defs/actor" }, "proposalVersion": { "type": "integer" }, "decision": { "enum": ["approve", "reject"] }, "rationale": { "type": "string" }, "atEpochMs": { "type": "integer" } } },
|
|
102
|
+
"decision": { "type": "object", "additionalProperties": false, "required": ["reviewer", "proposalVersion", "decision", "rationale", "atEpochMs"], "properties": { "reviewer": { "$ref": "#/$defs/actor" }, "proposalVersion": { "type": "integer" }, "decision": { "enum": ["approve", "reject"] }, "rationale": { "type": "string" }, "atEpochMs": { "type": "integer" }, "evaluation": { "$ref": "#/$defs/evaluation" } } },
|
|
26
103
|
"event": { "type": "object", "additionalProperties": false, "required": ["sequence", "type", "atEpochMs", "actor", "proposalVersion", "rationale"], "properties": { "sequence": { "type": "integer" }, "type": { "enum": ["created", "claimed", "approved", "rejected", "edited", "expired", "escalated", "canceled", "resumed", "execution-completed", "execution-failed", "legal-hold-placed", "legal-hold-released", "tombstoned", "authorization-denied", "sensitive-view-accessed"] }, "atEpochMs": { "type": "integer" }, "actor": { "$ref": "#/$defs/actor" }, "proposalVersion": { "type": "integer" }, "rationale": { "type": "string" }, "operatorDecisionEventId": { "type": "string", "minLength": 1 }, "data": { "type": "object" } } },
|
|
27
104
|
"effect": { "type": "object", "additionalProperties": false, "required": ["effectId", "continuationId", "proposalVersion", "completedAtEpochMs", "result"], "properties": { "effectId": { "type": "string" }, "continuationId": { "type": "string" }, "proposalVersion": { "type": "integer" }, "completedAtEpochMs": { "type": "integer" }, "result": {} } }
|
|
28
105
|
}
|