@jinn-network/client 0.1.9-canary.5c19fc6d → 0.1.9-canary.5ff3d8cb
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/CONTRIBUTING.md +2 -2
- package/dist/adapters/mech/adapter.d.ts +10 -0
- package/dist/adapters/mech/adapter.js +19 -1
- package/dist/adapters/mech/adapter.js.map +1 -1
- package/dist/adapters/mech/types.d.ts +1 -88
- package/dist/adapters/mech/types.js +1 -45
- package/dist/adapters/mech/types.js.map +1 -1
- package/dist/api/bootstrap-endpoint.d.ts +18 -3
- package/dist/api/bootstrap-endpoint.js +3 -0
- package/dist/api/bootstrap-endpoint.js.map +1 -1
- package/dist/api/gather-status.js +6 -5
- package/dist/api/gather-status.js.map +1 -1
- package/dist/api/launcher-endpoints.js +6 -1
- package/dist/api/launcher-endpoints.js.map +1 -1
- package/dist/api/launcher-status.d.ts +2 -0
- package/dist/api/launcher-status.js.map +1 -1
- package/dist/api/launcher-tasks.d.ts +47 -0
- package/dist/api/launcher-tasks.js +88 -3
- package/dist/api/launcher-tasks.js.map +1 -1
- package/dist/api/loop-completion-build.d.ts +2 -2
- package/dist/api/loop-completion-build.js +2 -3
- package/dist/api/loop-completion-build.js.map +1 -1
- package/dist/api/portfolio-v0-build.d.ts +2 -1
- package/dist/api/portfolio-v0-build.js +5 -7
- package/dist/api/portfolio-v0-build.js.map +1 -1
- package/dist/api/prediction-v1-build.d.ts +2 -2
- package/dist/api/prediction-v1-build.js +5 -7
- package/dist/api/prediction-v1-build.js.map +1 -1
- package/dist/api/setup-endpoints.d.ts +4 -0
- package/dist/api/setup-endpoints.js +13 -7
- package/dist/api/setup-endpoints.js.map +1 -1
- package/dist/api/status-build.js +1 -4
- package/dist/api/status-build.js.map +1 -1
- package/dist/api/task-run-routing.d.ts +1 -1
- package/dist/api/task-runs-build.d.ts +2 -2
- package/dist/api/task-runs-build.js +5 -7
- package/dist/api/task-runs-build.js.map +1 -1
- package/dist/bin/jinn-distill-mcp.js +813 -0
- package/dist/bin/jinn-layer.js +4992 -1151
- package/dist/build-info.json +4 -4
- package/dist/build-meta.json +1 -1
- package/dist/captures/distil-export.d.ts +54 -0
- package/dist/captures/distil-export.js +135 -0
- package/dist/captures/distil-export.js.map +1 -0
- package/dist/captures/ingest.d.ts +21 -0
- package/dist/captures/ingest.js +144 -0
- package/dist/captures/ingest.js.map +1 -0
- package/dist/captures/live-publisher.js +4 -3
- package/dist/captures/live-publisher.js.map +1 -1
- package/dist/captures/publish.d.ts +4 -0
- package/dist/captures/publish.js +2 -2
- package/dist/captures/publish.js.map +1 -1
- package/dist/cli/execution-context.js +2 -1
- package/dist/cli/execution-context.js.map +1 -1
- package/dist/config.js +34 -1
- package/dist/config.js.map +1 -1
- package/dist/contracts/abis.d.ts +100 -0
- package/dist/contracts/abis.js +58 -0
- package/dist/contracts/abis.js.map +1 -0
- package/dist/contracts/addresses.d.ts +36 -0
- package/dist/contracts/addresses.js +60 -0
- package/dist/contracts/addresses.js.map +1 -0
- package/dist/corpus/onchain-query.d.ts +0 -1
- package/dist/corpus/onchain-query.js +2 -5
- package/dist/corpus/onchain-query.js.map +1 -1
- package/dist/daemon/balance-topup-loop.js +27 -12
- package/dist/daemon/balance-topup-loop.js.map +1 -1
- package/dist/daemon/creator.js +15 -13
- package/dist/daemon/creator.js.map +1 -1
- package/dist/daemon/daemon.js +35 -13
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/loop-heartbeat.d.ts +62 -7
- package/dist/daemon/loop-heartbeat.js +50 -13
- package/dist/daemon/loop-heartbeat.js.map +1 -1
- package/dist/{api/peers.js → daemon/peer-sync.js} +2 -2
- package/dist/daemon/peer-sync.js.map +1 -0
- package/dist/daemon/reward-claim-loop.js +27 -12
- package/dist/daemon/reward-claim-loop.js.map +1 -1
- package/dist/daemon/spend-cap-gate.d.ts +0 -6
- package/dist/daemon/spend-cap-gate.js +1 -8
- package/dist/daemon/spend-cap-gate.js.map +1 -1
- package/dist/dashboard/assets/index-BdGCkGPF.js +157 -0
- package/dist/dashboard/assets/index-D7rvJRNa.css +1 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/discovery/http.js +83 -1
- package/dist/discovery/http.js.map +1 -1
- package/dist/discovery/onchain.js +16 -8
- package/dist/discovery/onchain.js.map +1 -1
- package/dist/discovery/types.d.ts +43 -0
- package/dist/discovery/types.js.map +1 -1
- package/dist/discovery/with-fallback.js +10 -0
- package/dist/discovery/with-fallback.js.map +1 -1
- package/dist/earning/bootstrap-run.d.ts +25 -0
- package/dist/earning/bootstrap-run.js +315 -0
- package/dist/earning/bootstrap-run.js.map +1 -0
- package/dist/earning/bootstrap.d.ts +6 -11
- package/dist/earning/bootstrap.js +45 -195
- package/dist/earning/bootstrap.js.map +1 -1
- package/dist/earning/contracts.d.ts +2 -3
- package/dist/earning/contracts.js +12 -21
- package/dist/earning/contracts.js.map +1 -1
- package/dist/earning/master-gas.d.ts +10 -0
- package/dist/earning/master-gas.js +11 -0
- package/dist/earning/master-gas.js.map +1 -0
- package/dist/earning/safe-adapter.js +1 -45
- package/dist/earning/safe-adapter.js.map +1 -1
- package/dist/earning/steps/context.d.ts +42 -0
- package/dist/earning/steps/context.js +4 -0
- package/dist/earning/steps/context.js.map +1 -0
- package/dist/earning/steps/fleet-identity-register.d.ts +4 -0
- package/dist/earning/steps/fleet-identity-register.js +65 -0
- package/dist/earning/steps/fleet-identity-register.js.map +1 -0
- package/dist/earning/steps/fleet-safe-deploy.d.ts +4 -0
- package/dist/earning/steps/fleet-safe-deploy.js +62 -0
- package/dist/earning/steps/fleet-safe-deploy.js.map +1 -0
- package/dist/earning/steps/fleet-safe-predict.d.ts +4 -0
- package/dist/earning/steps/fleet-safe-predict.js +18 -0
- package/dist/earning/steps/fleet-safe-predict.js.map +1 -0
- package/dist/earning/steps/receipt-parsing.d.ts +12 -0
- package/dist/earning/steps/receipt-parsing.js +71 -0
- package/dist/earning/steps/receipt-parsing.js.map +1 -0
- package/dist/earning/stolas-staking.js +20 -14
- package/dist/earning/stolas-staking.js.map +1 -1
- package/dist/erc8004/addresses.d.ts +6 -5
- package/dist/erc8004/addresses.js +7 -5
- package/dist/erc8004/addresses.js.map +1 -1
- package/dist/erc8004/identity.d.ts +12 -1
- package/dist/erc8004/identity.js +31 -0
- package/dist/erc8004/identity.js.map +1 -1
- package/dist/erc8004/index.d.ts +1 -1
- package/dist/erc8004/index.js +1 -1
- package/dist/erc8004/index.js.map +1 -1
- package/dist/erc8004/reputation.js +16 -12
- package/dist/erc8004/reputation.js.map +1 -1
- package/dist/erc8004/validation.js +5 -4
- package/dist/erc8004/validation.js.map +1 -1
- package/dist/eval/capability-slate.d.ts +54 -0
- package/dist/eval/capability-slate.js +116 -0
- package/dist/eval/capability-slate.js.map +1 -0
- package/dist/eval/capability-stats.d.ts +39 -0
- package/dist/eval/capability-stats.js +123 -0
- package/dist/eval/capability-stats.js.map +1 -0
- package/dist/eval/contested-band.d.ts +18 -0
- package/dist/eval/contested-band.js +19 -0
- package/dist/eval/contested-band.js.map +1 -0
- package/dist/eval/corpus-index.d.ts +21 -0
- package/dist/eval/corpus-index.js +55 -0
- package/dist/eval/corpus-index.js.map +1 -0
- package/dist/eval/disjointness.d.ts +26 -0
- package/dist/eval/disjointness.js +67 -0
- package/dist/eval/disjointness.js.map +1 -0
- package/dist/eval/mcnemar-power.d.ts +14 -0
- package/dist/eval/mcnemar-power.js +40 -0
- package/dist/eval/mcnemar-power.js.map +1 -0
- package/dist/harnesses/engine/engine.d.ts +2 -1
- package/dist/harnesses/engine/engine.js +15 -2
- package/dist/harnesses/engine/engine.js.map +1 -1
- package/dist/harnesses/engine/persistence.d.ts +2 -61
- package/dist/harnesses/engine/persistence.js.map +1 -1
- package/dist/harnesses/impls/_evaluator-base.d.ts +48 -0
- package/dist/harnesses/impls/_evaluator-base.js +35 -0
- package/dist/harnesses/impls/_evaluator-base.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-prediction/index.d.ts +2 -3
- package/dist/harnesses/impls/claude-mcp-prediction/index.js +29 -99
- package/dist/harnesses/impls/claude-mcp-prediction/index.js.map +1 -1
- package/dist/harnesses/impls/claude-mcp-prediction/mcp-tools.js +4 -21
- package/dist/harnesses/impls/claude-mcp-prediction/mcp-tools.js.map +1 -1
- package/dist/harnesses/impls/claude-mcp-prediction/session-orchestrator.d.ts +2 -0
- package/dist/harnesses/impls/claude-mcp-prediction/session-orchestrator.js +1 -1
- package/dist/harnesses/impls/claude-mcp-prediction/session-orchestrator.js.map +1 -1
- package/dist/harnesses/impls/claude-mcp-prediction-apy/index.js +30 -79
- package/dist/harnesses/impls/claude-mcp-prediction-apy/index.js.map +1 -1
- package/dist/harnesses/impls/claude-mcp-prediction-apy/mcp-tools.js +4 -19
- package/dist/harnesses/impls/claude-mcp-prediction-apy/mcp-tools.js.map +1 -1
- package/dist/harnesses/impls/claude-mcp-prediction-apy/session-orchestrator.d.ts +2 -0
- package/dist/harnesses/impls/claude-mcp-prediction-apy/session-orchestrator.js +1 -1
- package/dist/harnesses/impls/claude-mcp-prediction-apy/session-orchestrator.js.map +1 -1
- package/dist/harnesses/impls/claude-mcp-shared/mcp-server-script.d.ts +39 -0
- package/dist/harnesses/impls/claude-mcp-shared/mcp-server-script.js +62 -0
- package/dist/harnesses/impls/claude-mcp-shared/mcp-server-script.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-shared/mcp-server.d.ts +40 -0
- package/dist/harnesses/impls/claude-mcp-shared/mcp-server.js +44 -0
- package/dist/harnesses/impls/claude-mcp-shared/mcp-server.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-shared/single-session-harness.d.ts +56 -0
- package/dist/harnesses/impls/claude-mcp-shared/single-session-harness.js +79 -0
- package/dist/harnesses/impls/claude-mcp-shared/single-session-harness.js.map +1 -0
- package/dist/harnesses/impls/learner/adapters/codex-code.d.ts +3 -1
- package/dist/harnesses/impls/learner/adapters/codex-code.js +39 -4
- package/dist/harnesses/impls/learner/adapters/codex-code.js.map +1 -1
- package/dist/harnesses/impls/portfolio-v0-evaluator/index.d.ts +5 -15
- package/dist/harnesses/impls/portfolio-v0-evaluator/index.js +10 -29
- package/dist/harnesses/impls/portfolio-v0-evaluator/index.js.map +1 -1
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/index.d.ts +5 -15
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/index.js +10 -23
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/index.js.map +1 -1
- package/dist/harnesses/impls/prediction-v0-evaluator/index.d.ts +5 -15
- package/dist/harnesses/impls/prediction-v0-evaluator/index.js +10 -25
- package/dist/harnesses/impls/prediction-v0-evaluator/index.js.map +1 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js +8 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js.map +1 -1
- package/dist/learner/verification-gate.d.ts +53 -0
- package/dist/learner/verification-gate.js +80 -0
- package/dist/learner/verification-gate.js.map +1 -0
- package/dist/main.js +74 -457
- package/dist/main.js.map +1 -1
- package/dist/monitoring/net-liveness.d.ts +143 -0
- package/dist/monitoring/net-liveness.js +301 -0
- package/dist/monitoring/net-liveness.js.map +1 -0
- package/dist/observability/progress.d.ts +11 -0
- package/dist/observability/progress.js +16 -0
- package/dist/observability/progress.js.map +1 -0
- package/dist/pilot/cost.d.ts +19 -0
- package/dist/pilot/cost.js +31 -0
- package/dist/pilot/cost.js.map +1 -0
- package/dist/pilot/instance.d.ts +20 -0
- package/dist/pilot/instance.js +19 -0
- package/dist/pilot/instance.js.map +1 -0
- package/dist/pilot/repo.d.ts +31 -0
- package/dist/pilot/repo.js +42 -0
- package/dist/pilot/repo.js.map +1 -0
- package/dist/pilot/solve.d.ts +22 -0
- package/dist/pilot/solve.js +37 -0
- package/dist/pilot/solve.js.map +1 -0
- package/dist/pilot/tally.d.ts +35 -0
- package/dist/pilot/tally.js +61 -0
- package/dist/pilot/tally.js.map +1 -0
- package/dist/plugins/local-trace-distiller/.claude-plugin/plugin.json +9 -0
- package/dist/plugins/local-trace-distiller/.codex-plugin/plugin.json +41 -0
- package/dist/plugins/local-trace-distiller/.mcp.json +8 -0
- package/dist/plugins/local-trace-distiller/README.md +27 -0
- package/dist/plugins/local-trace-distiller/jinn.plugin.json +36 -0
- package/dist/plugins/local-trace-distiller/skills/distill/SKILL.md +51 -0
- package/dist/preflight/rpc-network.d.ts +10 -3
- package/dist/preflight/rpc-network.js +46 -13
- package/dist/preflight/rpc-network.js.map +1 -1
- package/dist/preflight/stable-cwd.d.ts +29 -0
- package/dist/preflight/stable-cwd.js +98 -0
- package/dist/preflight/stable-cwd.js.map +1 -0
- package/dist/solvernets/launched-record-dispatcher.js +6 -0
- package/dist/solvernets/launched-record-dispatcher.js.map +1 -1
- package/dist/spend/credential.d.ts +2 -2
- package/dist/spend/credential.js +9 -3
- package/dist/spend/credential.js.map +1 -1
- package/dist/spend/spend-cap.d.ts +10 -0
- package/dist/spend/spend-cap.js +13 -0
- package/dist/spend/spend-cap.js.map +1 -0
- package/dist/store/store.d.ts +14 -0
- package/dist/store/store.js +10 -1
- package/dist/store/store.js.map +1 -1
- package/dist/trajectory/processors/identity-scrub.js +22 -3
- package/dist/trajectory/processors/identity-scrub.js.map +1 -1
- package/dist/trajectory/scrub/build.d.ts +19 -0
- package/dist/trajectory/scrub/build.js +25 -0
- package/dist/trajectory/scrub/build.js.map +1 -1
- package/dist/trajectory/scrub/layer2.d.ts +23 -0
- package/dist/trajectory/scrub/layer2.js +33 -0
- package/dist/trajectory/scrub/layer2.js.map +1 -0
- package/dist/trajectory/scrub/openredaction-stage.d.ts +127 -0
- package/dist/trajectory/scrub/openredaction-stage.js +186 -2
- package/dist/trajectory/scrub/openredaction-stage.js.map +1 -1
- package/dist/trajectory/scrub/pipeline.d.ts +21 -0
- package/dist/trajectory/scrub/pipeline.js +57 -0
- package/dist/trajectory/scrub/pipeline.js.map +1 -1
- package/dist/trajectory/scrub/plain-patterns-stage.d.ts +14 -1
- package/dist/trajectory/scrub/plain-patterns-stage.js +35 -5
- package/dist/trajectory/scrub/plain-patterns-stage.js.map +1 -1
- package/dist/trajectory/scrub/secretlint-stage.d.ts +22 -3
- package/dist/trajectory/scrub/secretlint-stage.js +118 -27
- package/dist/trajectory/scrub/secretlint-stage.js.map +1 -1
- package/dist/trajectory/transcript-watcher.d.ts +26 -0
- package/dist/trajectory/transcript-watcher.js +33 -0
- package/dist/trajectory/transcript-watcher.js.map +1 -1
- package/dist/types/skill-artifact.d.ts +442 -0
- package/dist/types/skill-artifact.js +137 -0
- package/dist/types/skill-artifact.js.map +1 -0
- package/dist/types/task-run-read-model.d.ts +21 -0
- package/dist/types/task-run-read-model.js +2 -0
- package/dist/types/task-run-read-model.js.map +1 -0
- package/dist/types/task-run.d.ts +75 -0
- package/dist/types/task-run.js +2 -0
- package/dist/types/task-run.js.map +1 -0
- package/dist/util/redact-rpc-urls.d.ts +1 -1
- package/dist/util/redact-rpc-urls.js +57 -2
- package/dist/util/redact-rpc-urls.js.map +1 -1
- package/package.json +11 -8
- package/plugins/local-trace-distiller/.claude-plugin/plugin.json +9 -0
- package/plugins/local-trace-distiller/.codex-plugin/plugin.json +41 -0
- package/plugins/local-trace-distiller/.mcp.json +8 -0
- package/plugins/local-trace-distiller/README.md +27 -0
- package/plugins/local-trace-distiller/jinn.plugin.json +36 -0
- package/plugins/local-trace-distiller/skills/distill/SKILL.md +51 -0
- package/dist/api/peers.js.map +0 -1
- package/dist/dashboard/assets/index-BsrAAmvC.js +0 -171
- package/dist/dashboard/assets/index-DQOWJ2SF.css +0 -1
- /package/dist/{api/peers.d.ts → daemon/peer-sync.d.ts} +0 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { z } from 'zod/v3';
|
|
2
|
+
/**
|
|
3
|
+
* jinn.skill.v1 — first-class skill artifact (issue #1394).
|
|
4
|
+
*
|
|
5
|
+
* A skill (SKILL.md + optional companion files + machine-readable
|
|
6
|
+
* provenance) carried as one entry in the `jinn.execution.v1` wrapper
|
|
7
|
+
* envelope's `artifacts[]`. Carrier invariant by provenance kind:
|
|
8
|
+
* **imported** (seeds) publish ALONGSIDE the seeded layer-1 trace envelope
|
|
9
|
+
* (never instead of it); **distilled** skills have no trace of their own —
|
|
10
|
+
* their evidence is the referenced layer-1 envelopes in `sourceEnvelopeCids` —
|
|
11
|
+
* so they publish as a skill-only wrapper (`publishSkill()`,
|
|
12
|
+
* client/packages/harness-layer/src/publish-skill.ts, DR-2026-07-06).
|
|
13
|
+
* Access/pricing come from the enclosing Artifact
|
|
14
|
+
* entry (client/src/types/envelope.ts ArtifactSchema: sha256,
|
|
15
|
+
* access.endpoint, access.priceUsdc, metadata.tags).
|
|
16
|
+
*
|
|
17
|
+
* Frozen-caps review (AC3, additive): this schema is a NEW artifact payload
|
|
18
|
+
* type. It does not touch the frozen layer-1 evidence envelope
|
|
19
|
+
* (jinn.trace-envelope.v0 — client/packages/harness-layer/src/envelope.ts,
|
|
20
|
+
* caps in client/packages/harness-layer/docs/envelope-v0.md) and requires no
|
|
21
|
+
* change to the jinn.execution.v1 wrapper, whose artifacts[] already accepts
|
|
22
|
+
* any artifactType string. Companion-file content lives here, free of the
|
|
23
|
+
* trace envelope's 16 KiB step-attribute cap, under its own 1 MiB total cap.
|
|
24
|
+
*
|
|
25
|
+
* Precedent: client/src/trajectory/harness-bundle-schema.ts.
|
|
26
|
+
*/
|
|
27
|
+
export declare const SKILL_ARTIFACT_TYPE: "jinn.skill.v1";
|
|
28
|
+
/** Max companion files per skill. */
|
|
29
|
+
export declare const MAX_SKILL_FILES = 64;
|
|
30
|
+
/** Max total decoded bytes (skillMd + all companion files): 1 MiB. */
|
|
31
|
+
export declare const MAX_SKILL_TOTAL_DECODED_BYTES: number;
|
|
32
|
+
export declare const SkillCompanionFileSchema: z.ZodObject<{
|
|
33
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
34
|
+
contentBase64: z.ZodString;
|
|
35
|
+
sha256: z.ZodString;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
path: string;
|
|
38
|
+
sha256: string;
|
|
39
|
+
contentBase64: string;
|
|
40
|
+
}, {
|
|
41
|
+
path: string;
|
|
42
|
+
sha256: string;
|
|
43
|
+
contentBase64: string;
|
|
44
|
+
}>;
|
|
45
|
+
export declare const SkillProvenanceSchema: z.ZodObject<{
|
|
46
|
+
kind: z.ZodEnum<["imported", "distilled"]>;
|
|
47
|
+
/**
|
|
48
|
+
* Envelope CIDs the skill was distilled from ([] for seed imports).
|
|
49
|
+
* The "distilled from N traces" count is this array's length — never
|
|
50
|
+
* stored separately (anti-drift).
|
|
51
|
+
*/
|
|
52
|
+
sourceEnvelopeCids: z.ZodArray<z.ZodString, "many">;
|
|
53
|
+
operator: z.ZodObject<{
|
|
54
|
+
safeAddress: z.ZodString;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
safeAddress: string;
|
|
57
|
+
}, {
|
|
58
|
+
safeAddress: string;
|
|
59
|
+
}>;
|
|
60
|
+
solverType: z.ZodOptional<z.ZodString>;
|
|
61
|
+
/** Seed attribution, mirroring the seeded trace's `seed.attribution`. */
|
|
62
|
+
seed: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
skill: z.ZodString;
|
|
64
|
+
source: z.ZodString;
|
|
65
|
+
licence: z.ZodNullable<z.ZodString>;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
source: string;
|
|
68
|
+
skill: string;
|
|
69
|
+
licence: string | null;
|
|
70
|
+
}, {
|
|
71
|
+
source: string;
|
|
72
|
+
skill: string;
|
|
73
|
+
licence: string | null;
|
|
74
|
+
}>>;
|
|
75
|
+
/**
|
|
76
|
+
* Success→strategic-pattern, failure→lesson, both-polarity→contrastive
|
|
77
|
+
* (spec §7, D10 + v0.5), or cross-instance corroboration→cross-instance
|
|
78
|
+
* (stage-2 meta-distill). `contrastive` and `cross-instance` are additive
|
|
79
|
+
* enum values: strict consumers (`extractSkill`) reject them until upgraded
|
|
80
|
+
* — acceptable at testnet volume, named in the spec.
|
|
81
|
+
*/
|
|
82
|
+
skillKind: z.ZodOptional<z.ZodEnum<["strategic-pattern", "failure-lesson", "contrastive", "cross-instance"]>>;
|
|
83
|
+
/** SHA-256 of the exact distill prompt that produced the skill (auditability, D4). */
|
|
84
|
+
distillPromptSha256: z.ZodOptional<z.ZodString>;
|
|
85
|
+
/** Task-distribution the skill targets (e.g. 'coding'). */
|
|
86
|
+
distribution: z.ZodOptional<z.ZodString>;
|
|
87
|
+
/** Verifiability tier of the source evidence (e.g. 'evaluator-verified'). */
|
|
88
|
+
verifiabilityTier: z.ZodOptional<z.ZodString>;
|
|
89
|
+
/**
|
|
90
|
+
* The model that ran distillation (spec §5, v0.5). Distillation quality is
|
|
91
|
+
* model-sensitive; recording it makes a skill's quality auditable.
|
|
92
|
+
*/
|
|
93
|
+
distillModel: z.ZodOptional<z.ZodString>;
|
|
94
|
+
/**
|
|
95
|
+
* Deterministic `ceil(utf8 chars / 4)` token estimates of the distiller
|
|
96
|
+
* input and the emitted body (spec §5, v0.5). The pair records the
|
|
97
|
+
* compression ratio (SkillRL operates at 10–20×); an auditable estimate
|
|
98
|
+
* serves that purpose better than an unreproducible exact count (the LLM
|
|
99
|
+
* port reports no usage).
|
|
100
|
+
*/
|
|
101
|
+
evidenceTokens: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
skillTokens: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
/**
|
|
104
|
+
* Envelope/manifest CID of a prior skill record this one replaces — the same
|
|
105
|
+
* identity space as `sourceEnvelopeCids` and a search-hit `ref`. Honored at
|
|
106
|
+
* read time ONLY when this record's operator matches the superseded record's
|
|
107
|
+
* operator (cross-operator supersedes are ignored); see the read-path head
|
|
108
|
+
* resolver in client/packages/harness-layer/src/consume.ts.
|
|
109
|
+
*/
|
|
110
|
+
supersedes: z.ZodOptional<z.ZodString>;
|
|
111
|
+
/**
|
|
112
|
+
* Pure retirement marker: retires this record's `supersedes` target with no
|
|
113
|
+
* replacement and hides this record itself from discovery. A deprecation
|
|
114
|
+
* record carries no successor skill content.
|
|
115
|
+
*/
|
|
116
|
+
deprecates: z.ZodOptional<z.ZodBoolean>;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
kind: "imported" | "distilled";
|
|
119
|
+
operator: {
|
|
120
|
+
safeAddress: string;
|
|
121
|
+
};
|
|
122
|
+
sourceEnvelopeCids: string[];
|
|
123
|
+
solverType?: string | undefined;
|
|
124
|
+
seed?: {
|
|
125
|
+
source: string;
|
|
126
|
+
skill: string;
|
|
127
|
+
licence: string | null;
|
|
128
|
+
} | undefined;
|
|
129
|
+
skillKind?: "strategic-pattern" | "failure-lesson" | "contrastive" | "cross-instance" | undefined;
|
|
130
|
+
distillPromptSha256?: string | undefined;
|
|
131
|
+
distribution?: string | undefined;
|
|
132
|
+
verifiabilityTier?: string | undefined;
|
|
133
|
+
distillModel?: string | undefined;
|
|
134
|
+
evidenceTokens?: number | undefined;
|
|
135
|
+
skillTokens?: number | undefined;
|
|
136
|
+
supersedes?: string | undefined;
|
|
137
|
+
deprecates?: boolean | undefined;
|
|
138
|
+
}, {
|
|
139
|
+
kind: "imported" | "distilled";
|
|
140
|
+
operator: {
|
|
141
|
+
safeAddress: string;
|
|
142
|
+
};
|
|
143
|
+
sourceEnvelopeCids: string[];
|
|
144
|
+
solverType?: string | undefined;
|
|
145
|
+
seed?: {
|
|
146
|
+
source: string;
|
|
147
|
+
skill: string;
|
|
148
|
+
licence: string | null;
|
|
149
|
+
} | undefined;
|
|
150
|
+
skillKind?: "strategic-pattern" | "failure-lesson" | "contrastive" | "cross-instance" | undefined;
|
|
151
|
+
distillPromptSha256?: string | undefined;
|
|
152
|
+
distribution?: string | undefined;
|
|
153
|
+
verifiabilityTier?: string | undefined;
|
|
154
|
+
distillModel?: string | undefined;
|
|
155
|
+
evidenceTokens?: number | undefined;
|
|
156
|
+
skillTokens?: number | undefined;
|
|
157
|
+
supersedes?: string | undefined;
|
|
158
|
+
deprecates?: boolean | undefined;
|
|
159
|
+
}>;
|
|
160
|
+
export declare const SkillArtifactV1Schema: z.ZodEffects<z.ZodObject<{
|
|
161
|
+
schemaVersion: z.ZodLiteral<"jinn.skill.v1">;
|
|
162
|
+
skill: z.ZodObject<{
|
|
163
|
+
name: z.ZodString;
|
|
164
|
+
description: z.ZodOptional<z.ZodString>;
|
|
165
|
+
skillMd: z.ZodString;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
name: string;
|
|
168
|
+
skillMd: string;
|
|
169
|
+
description?: string | undefined;
|
|
170
|
+
}, {
|
|
171
|
+
name: string;
|
|
172
|
+
skillMd: string;
|
|
173
|
+
description?: string | undefined;
|
|
174
|
+
}>;
|
|
175
|
+
files: z.ZodArray<z.ZodObject<{
|
|
176
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
177
|
+
contentBase64: z.ZodString;
|
|
178
|
+
sha256: z.ZodString;
|
|
179
|
+
}, "strip", z.ZodTypeAny, {
|
|
180
|
+
path: string;
|
|
181
|
+
sha256: string;
|
|
182
|
+
contentBase64: string;
|
|
183
|
+
}, {
|
|
184
|
+
path: string;
|
|
185
|
+
sha256: string;
|
|
186
|
+
contentBase64: string;
|
|
187
|
+
}>, "many">;
|
|
188
|
+
provenance: z.ZodObject<{
|
|
189
|
+
kind: z.ZodEnum<["imported", "distilled"]>;
|
|
190
|
+
/**
|
|
191
|
+
* Envelope CIDs the skill was distilled from ([] for seed imports).
|
|
192
|
+
* The "distilled from N traces" count is this array's length — never
|
|
193
|
+
* stored separately (anti-drift).
|
|
194
|
+
*/
|
|
195
|
+
sourceEnvelopeCids: z.ZodArray<z.ZodString, "many">;
|
|
196
|
+
operator: z.ZodObject<{
|
|
197
|
+
safeAddress: z.ZodString;
|
|
198
|
+
}, "strip", z.ZodTypeAny, {
|
|
199
|
+
safeAddress: string;
|
|
200
|
+
}, {
|
|
201
|
+
safeAddress: string;
|
|
202
|
+
}>;
|
|
203
|
+
solverType: z.ZodOptional<z.ZodString>;
|
|
204
|
+
/** Seed attribution, mirroring the seeded trace's `seed.attribution`. */
|
|
205
|
+
seed: z.ZodOptional<z.ZodObject<{
|
|
206
|
+
skill: z.ZodString;
|
|
207
|
+
source: z.ZodString;
|
|
208
|
+
licence: z.ZodNullable<z.ZodString>;
|
|
209
|
+
}, "strip", z.ZodTypeAny, {
|
|
210
|
+
source: string;
|
|
211
|
+
skill: string;
|
|
212
|
+
licence: string | null;
|
|
213
|
+
}, {
|
|
214
|
+
source: string;
|
|
215
|
+
skill: string;
|
|
216
|
+
licence: string | null;
|
|
217
|
+
}>>;
|
|
218
|
+
/**
|
|
219
|
+
* Success→strategic-pattern, failure→lesson, both-polarity→contrastive
|
|
220
|
+
* (spec §7, D10 + v0.5), or cross-instance corroboration→cross-instance
|
|
221
|
+
* (stage-2 meta-distill). `contrastive` and `cross-instance` are additive
|
|
222
|
+
* enum values: strict consumers (`extractSkill`) reject them until upgraded
|
|
223
|
+
* — acceptable at testnet volume, named in the spec.
|
|
224
|
+
*/
|
|
225
|
+
skillKind: z.ZodOptional<z.ZodEnum<["strategic-pattern", "failure-lesson", "contrastive", "cross-instance"]>>;
|
|
226
|
+
/** SHA-256 of the exact distill prompt that produced the skill (auditability, D4). */
|
|
227
|
+
distillPromptSha256: z.ZodOptional<z.ZodString>;
|
|
228
|
+
/** Task-distribution the skill targets (e.g. 'coding'). */
|
|
229
|
+
distribution: z.ZodOptional<z.ZodString>;
|
|
230
|
+
/** Verifiability tier of the source evidence (e.g. 'evaluator-verified'). */
|
|
231
|
+
verifiabilityTier: z.ZodOptional<z.ZodString>;
|
|
232
|
+
/**
|
|
233
|
+
* The model that ran distillation (spec §5, v0.5). Distillation quality is
|
|
234
|
+
* model-sensitive; recording it makes a skill's quality auditable.
|
|
235
|
+
*/
|
|
236
|
+
distillModel: z.ZodOptional<z.ZodString>;
|
|
237
|
+
/**
|
|
238
|
+
* Deterministic `ceil(utf8 chars / 4)` token estimates of the distiller
|
|
239
|
+
* input and the emitted body (spec §5, v0.5). The pair records the
|
|
240
|
+
* compression ratio (SkillRL operates at 10–20×); an auditable estimate
|
|
241
|
+
* serves that purpose better than an unreproducible exact count (the LLM
|
|
242
|
+
* port reports no usage).
|
|
243
|
+
*/
|
|
244
|
+
evidenceTokens: z.ZodOptional<z.ZodNumber>;
|
|
245
|
+
skillTokens: z.ZodOptional<z.ZodNumber>;
|
|
246
|
+
/**
|
|
247
|
+
* Envelope/manifest CID of a prior skill record this one replaces — the same
|
|
248
|
+
* identity space as `sourceEnvelopeCids` and a search-hit `ref`. Honored at
|
|
249
|
+
* read time ONLY when this record's operator matches the superseded record's
|
|
250
|
+
* operator (cross-operator supersedes are ignored); see the read-path head
|
|
251
|
+
* resolver in client/packages/harness-layer/src/consume.ts.
|
|
252
|
+
*/
|
|
253
|
+
supersedes: z.ZodOptional<z.ZodString>;
|
|
254
|
+
/**
|
|
255
|
+
* Pure retirement marker: retires this record's `supersedes` target with no
|
|
256
|
+
* replacement and hides this record itself from discovery. A deprecation
|
|
257
|
+
* record carries no successor skill content.
|
|
258
|
+
*/
|
|
259
|
+
deprecates: z.ZodOptional<z.ZodBoolean>;
|
|
260
|
+
}, "strip", z.ZodTypeAny, {
|
|
261
|
+
kind: "imported" | "distilled";
|
|
262
|
+
operator: {
|
|
263
|
+
safeAddress: string;
|
|
264
|
+
};
|
|
265
|
+
sourceEnvelopeCids: string[];
|
|
266
|
+
solverType?: string | undefined;
|
|
267
|
+
seed?: {
|
|
268
|
+
source: string;
|
|
269
|
+
skill: string;
|
|
270
|
+
licence: string | null;
|
|
271
|
+
} | undefined;
|
|
272
|
+
skillKind?: "strategic-pattern" | "failure-lesson" | "contrastive" | "cross-instance" | undefined;
|
|
273
|
+
distillPromptSha256?: string | undefined;
|
|
274
|
+
distribution?: string | undefined;
|
|
275
|
+
verifiabilityTier?: string | undefined;
|
|
276
|
+
distillModel?: string | undefined;
|
|
277
|
+
evidenceTokens?: number | undefined;
|
|
278
|
+
skillTokens?: number | undefined;
|
|
279
|
+
supersedes?: string | undefined;
|
|
280
|
+
deprecates?: boolean | undefined;
|
|
281
|
+
}, {
|
|
282
|
+
kind: "imported" | "distilled";
|
|
283
|
+
operator: {
|
|
284
|
+
safeAddress: string;
|
|
285
|
+
};
|
|
286
|
+
sourceEnvelopeCids: string[];
|
|
287
|
+
solverType?: string | undefined;
|
|
288
|
+
seed?: {
|
|
289
|
+
source: string;
|
|
290
|
+
skill: string;
|
|
291
|
+
licence: string | null;
|
|
292
|
+
} | undefined;
|
|
293
|
+
skillKind?: "strategic-pattern" | "failure-lesson" | "contrastive" | "cross-instance" | undefined;
|
|
294
|
+
distillPromptSha256?: string | undefined;
|
|
295
|
+
distribution?: string | undefined;
|
|
296
|
+
verifiabilityTier?: string | undefined;
|
|
297
|
+
distillModel?: string | undefined;
|
|
298
|
+
evidenceTokens?: number | undefined;
|
|
299
|
+
skillTokens?: number | undefined;
|
|
300
|
+
supersedes?: string | undefined;
|
|
301
|
+
deprecates?: boolean | undefined;
|
|
302
|
+
}>;
|
|
303
|
+
}, "strip", z.ZodTypeAny, {
|
|
304
|
+
schemaVersion: "jinn.skill.v1";
|
|
305
|
+
files: {
|
|
306
|
+
path: string;
|
|
307
|
+
sha256: string;
|
|
308
|
+
contentBase64: string;
|
|
309
|
+
}[];
|
|
310
|
+
skill: {
|
|
311
|
+
name: string;
|
|
312
|
+
skillMd: string;
|
|
313
|
+
description?: string | undefined;
|
|
314
|
+
};
|
|
315
|
+
provenance: {
|
|
316
|
+
kind: "imported" | "distilled";
|
|
317
|
+
operator: {
|
|
318
|
+
safeAddress: string;
|
|
319
|
+
};
|
|
320
|
+
sourceEnvelopeCids: string[];
|
|
321
|
+
solverType?: string | undefined;
|
|
322
|
+
seed?: {
|
|
323
|
+
source: string;
|
|
324
|
+
skill: string;
|
|
325
|
+
licence: string | null;
|
|
326
|
+
} | undefined;
|
|
327
|
+
skillKind?: "strategic-pattern" | "failure-lesson" | "contrastive" | "cross-instance" | undefined;
|
|
328
|
+
distillPromptSha256?: string | undefined;
|
|
329
|
+
distribution?: string | undefined;
|
|
330
|
+
verifiabilityTier?: string | undefined;
|
|
331
|
+
distillModel?: string | undefined;
|
|
332
|
+
evidenceTokens?: number | undefined;
|
|
333
|
+
skillTokens?: number | undefined;
|
|
334
|
+
supersedes?: string | undefined;
|
|
335
|
+
deprecates?: boolean | undefined;
|
|
336
|
+
};
|
|
337
|
+
}, {
|
|
338
|
+
schemaVersion: "jinn.skill.v1";
|
|
339
|
+
files: {
|
|
340
|
+
path: string;
|
|
341
|
+
sha256: string;
|
|
342
|
+
contentBase64: string;
|
|
343
|
+
}[];
|
|
344
|
+
skill: {
|
|
345
|
+
name: string;
|
|
346
|
+
skillMd: string;
|
|
347
|
+
description?: string | undefined;
|
|
348
|
+
};
|
|
349
|
+
provenance: {
|
|
350
|
+
kind: "imported" | "distilled";
|
|
351
|
+
operator: {
|
|
352
|
+
safeAddress: string;
|
|
353
|
+
};
|
|
354
|
+
sourceEnvelopeCids: string[];
|
|
355
|
+
solverType?: string | undefined;
|
|
356
|
+
seed?: {
|
|
357
|
+
source: string;
|
|
358
|
+
skill: string;
|
|
359
|
+
licence: string | null;
|
|
360
|
+
} | undefined;
|
|
361
|
+
skillKind?: "strategic-pattern" | "failure-lesson" | "contrastive" | "cross-instance" | undefined;
|
|
362
|
+
distillPromptSha256?: string | undefined;
|
|
363
|
+
distribution?: string | undefined;
|
|
364
|
+
verifiabilityTier?: string | undefined;
|
|
365
|
+
distillModel?: string | undefined;
|
|
366
|
+
evidenceTokens?: number | undefined;
|
|
367
|
+
skillTokens?: number | undefined;
|
|
368
|
+
supersedes?: string | undefined;
|
|
369
|
+
deprecates?: boolean | undefined;
|
|
370
|
+
};
|
|
371
|
+
}>, {
|
|
372
|
+
schemaVersion: "jinn.skill.v1";
|
|
373
|
+
files: {
|
|
374
|
+
path: string;
|
|
375
|
+
sha256: string;
|
|
376
|
+
contentBase64: string;
|
|
377
|
+
}[];
|
|
378
|
+
skill: {
|
|
379
|
+
name: string;
|
|
380
|
+
skillMd: string;
|
|
381
|
+
description?: string | undefined;
|
|
382
|
+
};
|
|
383
|
+
provenance: {
|
|
384
|
+
kind: "imported" | "distilled";
|
|
385
|
+
operator: {
|
|
386
|
+
safeAddress: string;
|
|
387
|
+
};
|
|
388
|
+
sourceEnvelopeCids: string[];
|
|
389
|
+
solverType?: string | undefined;
|
|
390
|
+
seed?: {
|
|
391
|
+
source: string;
|
|
392
|
+
skill: string;
|
|
393
|
+
licence: string | null;
|
|
394
|
+
} | undefined;
|
|
395
|
+
skillKind?: "strategic-pattern" | "failure-lesson" | "contrastive" | "cross-instance" | undefined;
|
|
396
|
+
distillPromptSha256?: string | undefined;
|
|
397
|
+
distribution?: string | undefined;
|
|
398
|
+
verifiabilityTier?: string | undefined;
|
|
399
|
+
distillModel?: string | undefined;
|
|
400
|
+
evidenceTokens?: number | undefined;
|
|
401
|
+
skillTokens?: number | undefined;
|
|
402
|
+
supersedes?: string | undefined;
|
|
403
|
+
deprecates?: boolean | undefined;
|
|
404
|
+
};
|
|
405
|
+
}, {
|
|
406
|
+
schemaVersion: "jinn.skill.v1";
|
|
407
|
+
files: {
|
|
408
|
+
path: string;
|
|
409
|
+
sha256: string;
|
|
410
|
+
contentBase64: string;
|
|
411
|
+
}[];
|
|
412
|
+
skill: {
|
|
413
|
+
name: string;
|
|
414
|
+
skillMd: string;
|
|
415
|
+
description?: string | undefined;
|
|
416
|
+
};
|
|
417
|
+
provenance: {
|
|
418
|
+
kind: "imported" | "distilled";
|
|
419
|
+
operator: {
|
|
420
|
+
safeAddress: string;
|
|
421
|
+
};
|
|
422
|
+
sourceEnvelopeCids: string[];
|
|
423
|
+
solverType?: string | undefined;
|
|
424
|
+
seed?: {
|
|
425
|
+
source: string;
|
|
426
|
+
skill: string;
|
|
427
|
+
licence: string | null;
|
|
428
|
+
} | undefined;
|
|
429
|
+
skillKind?: "strategic-pattern" | "failure-lesson" | "contrastive" | "cross-instance" | undefined;
|
|
430
|
+
distillPromptSha256?: string | undefined;
|
|
431
|
+
distribution?: string | undefined;
|
|
432
|
+
verifiabilityTier?: string | undefined;
|
|
433
|
+
distillModel?: string | undefined;
|
|
434
|
+
evidenceTokens?: number | undefined;
|
|
435
|
+
skillTokens?: number | undefined;
|
|
436
|
+
supersedes?: string | undefined;
|
|
437
|
+
deprecates?: boolean | undefined;
|
|
438
|
+
};
|
|
439
|
+
}>;
|
|
440
|
+
export type SkillCompanionFile = z.infer<typeof SkillCompanionFileSchema>;
|
|
441
|
+
export type SkillProvenance = z.infer<typeof SkillProvenanceSchema>;
|
|
442
|
+
export type SkillArtifactV1 = z.infer<typeof SkillArtifactV1Schema>;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { z } from 'zod/v3';
|
|
2
|
+
/**
|
|
3
|
+
* jinn.skill.v1 — first-class skill artifact (issue #1394).
|
|
4
|
+
*
|
|
5
|
+
* A skill (SKILL.md + optional companion files + machine-readable
|
|
6
|
+
* provenance) carried as one entry in the `jinn.execution.v1` wrapper
|
|
7
|
+
* envelope's `artifacts[]`. Carrier invariant by provenance kind:
|
|
8
|
+
* **imported** (seeds) publish ALONGSIDE the seeded layer-1 trace envelope
|
|
9
|
+
* (never instead of it); **distilled** skills have no trace of their own —
|
|
10
|
+
* their evidence is the referenced layer-1 envelopes in `sourceEnvelopeCids` —
|
|
11
|
+
* so they publish as a skill-only wrapper (`publishSkill()`,
|
|
12
|
+
* client/packages/harness-layer/src/publish-skill.ts, DR-2026-07-06).
|
|
13
|
+
* Access/pricing come from the enclosing Artifact
|
|
14
|
+
* entry (client/src/types/envelope.ts ArtifactSchema: sha256,
|
|
15
|
+
* access.endpoint, access.priceUsdc, metadata.tags).
|
|
16
|
+
*
|
|
17
|
+
* Frozen-caps review (AC3, additive): this schema is a NEW artifact payload
|
|
18
|
+
* type. It does not touch the frozen layer-1 evidence envelope
|
|
19
|
+
* (jinn.trace-envelope.v0 — client/packages/harness-layer/src/envelope.ts,
|
|
20
|
+
* caps in client/packages/harness-layer/docs/envelope-v0.md) and requires no
|
|
21
|
+
* change to the jinn.execution.v1 wrapper, whose artifacts[] already accepts
|
|
22
|
+
* any artifactType string. Companion-file content lives here, free of the
|
|
23
|
+
* trace envelope's 16 KiB step-attribute cap, under its own 1 MiB total cap.
|
|
24
|
+
*
|
|
25
|
+
* Precedent: client/src/trajectory/harness-bundle-schema.ts.
|
|
26
|
+
*/
|
|
27
|
+
export const SKILL_ARTIFACT_TYPE = 'jinn.skill.v1';
|
|
28
|
+
/** Max companion files per skill. */
|
|
29
|
+
export const MAX_SKILL_FILES = 64;
|
|
30
|
+
/** Max total decoded bytes (skillMd + all companion files): 1 MiB. */
|
|
31
|
+
export const MAX_SKILL_TOTAL_DECODED_BYTES = 1024 * 1024;
|
|
32
|
+
const HexAddressSchema = z.string().regex(/^0x[0-9a-fA-F]*$/);
|
|
33
|
+
/**
|
|
34
|
+
* Relative, traversal-free POSIX path — this is written to disk on install.
|
|
35
|
+
* Backslashes are rejected outright: on Windows `path.join` treats `\` as a
|
|
36
|
+
* separator, so a `..\` segment would bypass the '/'-split traversal check.
|
|
37
|
+
*/
|
|
38
|
+
const CompanionPathSchema = z
|
|
39
|
+
.string()
|
|
40
|
+
.min(1)
|
|
41
|
+
.refine((p) => !p.includes('\\') &&
|
|
42
|
+
!p.startsWith('/') &&
|
|
43
|
+
!/^[A-Za-z]:/.test(p) &&
|
|
44
|
+
!p.split('/').includes('..') &&
|
|
45
|
+
!p.split('/').includes(''), { message: 'companion file path must be a relative, traversal-free POSIX path' });
|
|
46
|
+
export const SkillCompanionFileSchema = z.object({
|
|
47
|
+
path: CompanionPathSchema,
|
|
48
|
+
contentBase64: z.string(),
|
|
49
|
+
sha256: z.string().regex(/^[0-9a-f]{64}$/),
|
|
50
|
+
});
|
|
51
|
+
export const SkillProvenanceSchema = z.object({
|
|
52
|
+
kind: z.enum(['imported', 'distilled']),
|
|
53
|
+
/**
|
|
54
|
+
* Envelope CIDs the skill was distilled from ([] for seed imports).
|
|
55
|
+
* The "distilled from N traces" count is this array's length — never
|
|
56
|
+
* stored separately (anti-drift).
|
|
57
|
+
*/
|
|
58
|
+
sourceEnvelopeCids: z.array(z.string().min(1)),
|
|
59
|
+
operator: z.object({ safeAddress: HexAddressSchema }),
|
|
60
|
+
solverType: z.string().min(1).optional(),
|
|
61
|
+
/** Seed attribution, mirroring the seeded trace's `seed.attribution`. */
|
|
62
|
+
seed: z
|
|
63
|
+
.object({
|
|
64
|
+
skill: z.string().min(1),
|
|
65
|
+
source: z.string().min(1),
|
|
66
|
+
licence: z.string().nullable(),
|
|
67
|
+
})
|
|
68
|
+
.optional(),
|
|
69
|
+
// --- distilled-skill fields (DR-2026-07-06, additive; producer is
|
|
70
|
+
// publishSkill() in client/packages/harness-layer/src/publish-skill.ts) ---
|
|
71
|
+
/**
|
|
72
|
+
* Success→strategic-pattern, failure→lesson, both-polarity→contrastive
|
|
73
|
+
* (spec §7, D10 + v0.5), or cross-instance corroboration→cross-instance
|
|
74
|
+
* (stage-2 meta-distill). `contrastive` and `cross-instance` are additive
|
|
75
|
+
* enum values: strict consumers (`extractSkill`) reject them until upgraded
|
|
76
|
+
* — acceptable at testnet volume, named in the spec.
|
|
77
|
+
*/
|
|
78
|
+
skillKind: z.enum(['strategic-pattern', 'failure-lesson', 'contrastive', 'cross-instance']).optional(),
|
|
79
|
+
/** SHA-256 of the exact distill prompt that produced the skill (auditability, D4). */
|
|
80
|
+
distillPromptSha256: z
|
|
81
|
+
.string()
|
|
82
|
+
.regex(/^[0-9a-f]{64}$/)
|
|
83
|
+
.optional(),
|
|
84
|
+
/** Task-distribution the skill targets (e.g. 'coding'). */
|
|
85
|
+
distribution: z.string().min(1).optional(),
|
|
86
|
+
/** Verifiability tier of the source evidence (e.g. 'evaluator-verified'). */
|
|
87
|
+
verifiabilityTier: z.string().min(1).optional(),
|
|
88
|
+
/**
|
|
89
|
+
* The model that ran distillation (spec §5, v0.5). Distillation quality is
|
|
90
|
+
* model-sensitive; recording it makes a skill's quality auditable.
|
|
91
|
+
*/
|
|
92
|
+
distillModel: z.string().min(1).optional(),
|
|
93
|
+
/**
|
|
94
|
+
* Deterministic `ceil(utf8 chars / 4)` token estimates of the distiller
|
|
95
|
+
* input and the emitted body (spec §5, v0.5). The pair records the
|
|
96
|
+
* compression ratio (SkillRL operates at 10–20×); an auditable estimate
|
|
97
|
+
* serves that purpose better than an unreproducible exact count (the LLM
|
|
98
|
+
* port reports no usage).
|
|
99
|
+
*/
|
|
100
|
+
evidenceTokens: z.number().int().nonnegative().optional(),
|
|
101
|
+
skillTokens: z.number().int().nonnegative().optional(),
|
|
102
|
+
// --- supersede lineage (issue #1462, additive) ---
|
|
103
|
+
/**
|
|
104
|
+
* Envelope/manifest CID of a prior skill record this one replaces — the same
|
|
105
|
+
* identity space as `sourceEnvelopeCids` and a search-hit `ref`. Honored at
|
|
106
|
+
* read time ONLY when this record's operator matches the superseded record's
|
|
107
|
+
* operator (cross-operator supersedes are ignored); see the read-path head
|
|
108
|
+
* resolver in client/packages/harness-layer/src/consume.ts.
|
|
109
|
+
*/
|
|
110
|
+
supersedes: z.string().min(1).optional(),
|
|
111
|
+
/**
|
|
112
|
+
* Pure retirement marker: retires this record's `supersedes` target with no
|
|
113
|
+
* replacement and hides this record itself from discovery. A deprecation
|
|
114
|
+
* record carries no successor skill content.
|
|
115
|
+
*/
|
|
116
|
+
deprecates: z.boolean().optional(),
|
|
117
|
+
});
|
|
118
|
+
/** Decoded size of a base64 string without decoding it. */
|
|
119
|
+
function base64DecodedBytes(b64) {
|
|
120
|
+
const padding = b64.endsWith('==') ? 2 : b64.endsWith('=') ? 1 : 0;
|
|
121
|
+
return Math.max(0, Math.floor((b64.length * 3) / 4) - padding);
|
|
122
|
+
}
|
|
123
|
+
export const SkillArtifactV1Schema = z
|
|
124
|
+
.object({
|
|
125
|
+
schemaVersion: z.literal(SKILL_ARTIFACT_TYPE),
|
|
126
|
+
skill: z.object({
|
|
127
|
+
name: z.string().min(1),
|
|
128
|
+
description: z.string().optional(),
|
|
129
|
+
skillMd: z.string().min(1),
|
|
130
|
+
}),
|
|
131
|
+
files: z.array(SkillCompanionFileSchema).max(MAX_SKILL_FILES),
|
|
132
|
+
provenance: SkillProvenanceSchema,
|
|
133
|
+
})
|
|
134
|
+
.refine((a) => new TextEncoder().encode(a.skill.skillMd).length +
|
|
135
|
+
a.files.reduce((n, f) => n + base64DecodedBytes(f.contentBase64), 0) <=
|
|
136
|
+
MAX_SKILL_TOTAL_DECODED_BYTES, { message: 'skill artifact exceeds the 1 MiB total decoded-content cap' });
|
|
137
|
+
//# sourceMappingURL=skill-artifact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-artifact.js","sourceRoot":"","sources":["../../src/types/skill-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAwB,CAAC;AAE5D,qCAAqC;AACrC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,sEAAsE;AACtE,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzD,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;AAE9D;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,CAAC;KAC1B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,MAAM,CACL,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;IACjB,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;IAClB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAC5B,EAAE,OAAO,EAAE,mEAAmE,EAAE,CACjF,CAAC;AAEJ,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,IAAI,EAAE,mBAAmB;IACzB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC;CAC3C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IACvC;;;;OAIG;IACH,kBAAkB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC9C,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;IACrD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACxC,yEAAyE;IACzE,IAAI,EAAE,CAAC;SACJ,MAAM,CAAC;QACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACxB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACzB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC/B,CAAC;SACD,QAAQ,EAAE;IACb,mEAAmE;IACnE,4EAA4E;IAC5E;;;;;;OAMG;IACH,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,CAAC,CAAC,CAAC,QAAQ,EAAE;IACtG,sFAAsF;IACtF,mBAAmB,EAAE,CAAC;SACnB,MAAM,EAAE;SACR,KAAK,CAAC,gBAAgB,CAAC;SACvB,QAAQ,EAAE;IACb,2DAA2D;IAC3D,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC1C,6EAA6E;IAC7E,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC/C;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC1C;;;;;;OAMG;IACH,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IACzD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IACtD,oDAAoD;IACpD;;;;;;OAMG;IACH,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACxC;;;;OAIG;IACH,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAEH,2DAA2D;AAC3D,SAAS,kBAAkB,CAAC,GAAW;IACrC,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC;KACnC,MAAM,CAAC;IACN,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC;IAC7C,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAClC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;KAC3B,CAAC;IACF,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC;IAC7D,UAAU,EAAE,qBAAqB;CAClC,CAAC;KACD,MAAM,CACL,CAAC,CAAC,EAAE,EAAE,CACJ,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM;IAC9C,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACtE,6BAA6B,EAC/B,EAAE,OAAO,EAAE,4DAA4D,EAAE,CAC1E,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only task-run port consumed by the status/build endpoints (#1584).
|
|
3
|
+
*
|
|
4
|
+
* The API build functions depend on this neutral interface rather than on the
|
|
5
|
+
* concrete `TaskRunPersistence` engine class. `TaskRunPersistence` structurally
|
|
6
|
+
* satisfies it; `Store.taskRunReadModel()` is the factory that hands one to the
|
|
7
|
+
* composition seam (`api/gather-status.ts`). This keeps `api/` free of any
|
|
8
|
+
* `harnesses/engine/persistence` import.
|
|
9
|
+
*/
|
|
10
|
+
import type { PersistedTaskRun, TaskRunState } from './task-run.js';
|
|
11
|
+
export interface TaskRunReadModel {
|
|
12
|
+
/** All in-flight task runs (not in any terminal state). */
|
|
13
|
+
getInFlight(): PersistedTaskRun[];
|
|
14
|
+
/** All task runs in a given state. */
|
|
15
|
+
getByState(state: TaskRunState): PersistedTaskRun[];
|
|
16
|
+
/** Minimal gating projection: phase evidence + delivery tx per completed run. */
|
|
17
|
+
getGatingRows(): Array<{
|
|
18
|
+
phasesJson: string | null;
|
|
19
|
+
deliveredTxHash: string | null;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-run-read-model.js","sourceRoot":"","sources":["../../src/types/task-run-read-model.ts"],"names":[],"mappings":""}
|