@motebit/protocol 0.8.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +198 -18
- package/NOTICE +19 -0
- package/README.md +37 -5
- package/dist/agent-settlement-anchor.d.ts +102 -0
- package/dist/agent-settlement-anchor.d.ts.map +1 -0
- package/dist/agent-settlement-anchor.js +18 -0
- package/dist/agent-settlement-anchor.js.map +1 -0
- package/dist/computer-use.d.ts +312 -0
- package/dist/computer-use.d.ts.map +1 -0
- package/dist/computer-use.js +86 -0
- package/dist/computer-use.js.map +1 -0
- package/dist/credential-anchor.d.ts +17 -2
- package/dist/credential-anchor.d.ts.map +1 -1
- package/dist/credential-anchor.js +3 -2
- package/dist/credential-anchor.js.map +1 -1
- package/dist/crypto-suite.d.ts +100 -0
- package/dist/crypto-suite.d.ts.map +1 -0
- package/dist/crypto-suite.js +93 -0
- package/dist/crypto-suite.js.map +1 -0
- package/dist/discovery.d.ts +87 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +9 -0
- package/dist/discovery.js.map +1 -0
- package/dist/dispute.d.ts +176 -0
- package/dist/dispute.d.ts.map +1 -0
- package/dist/dispute.js +9 -0
- package/dist/dispute.js.map +1 -0
- package/dist/goal-lifecycle.d.ts +129 -0
- package/dist/goal-lifecycle.d.ts.map +1 -0
- package/dist/goal-lifecycle.js +29 -0
- package/dist/goal-lifecycle.js.map +1 -0
- package/dist/index.d.ts +692 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -2
- package/dist/index.js.map +1 -1
- package/dist/memory-events.d.ts +140 -0
- package/dist/memory-events.d.ts.map +1 -0
- package/dist/memory-events.js +29 -0
- package/dist/memory-events.js.map +1 -0
- package/dist/migration.d.ts +180 -0
- package/dist/migration.d.ts.map +1 -0
- package/dist/migration.js +9 -0
- package/dist/migration.js.map +1 -0
- package/dist/plan-lifecycle.d.ts +147 -0
- package/dist/plan-lifecycle.d.ts.map +1 -0
- package/dist/plan-lifecycle.js +36 -0
- package/dist/plan-lifecycle.js.map +1 -0
- package/dist/semiring.d.ts +16 -0
- package/dist/semiring.d.ts.map +1 -1
- package/dist/semiring.js +21 -0
- package/dist/semiring.js.map +1 -1
- package/dist/settlement-mode.d.ts +68 -0
- package/dist/settlement-mode.d.ts.map +1 -0
- package/dist/settlement-mode.js +8 -0
- package/dist/settlement-mode.js.map +1 -0
- package/dist/tool-mode.d.ts +46 -0
- package/dist/tool-mode.d.ts.map +1 -0
- package/dist/tool-mode.js +50 -0
- package/dist/tool-mode.js.map +1 -0
- package/package.json +8 -5
- package/dist/__tests__/branded-ids.test.d.ts +0 -2
- package/dist/__tests__/branded-ids.test.d.ts.map +0 -1
- package/dist/__tests__/branded-ids.test.js +0 -70
- package/dist/__tests__/branded-ids.test.js.map +0 -1
- package/dist/__tests__/semiring-laws.test.d.ts +0 -25
- package/dist/__tests__/semiring-laws.test.d.ts.map +0 -1
- package/dist/__tests__/semiring-laws.test.js +0 -231
- package/dist/__tests__/semiring-laws.test.js.map +0 -1
- package/dist/__tests__/semiring.test.d.ts +0 -2
- package/dist/__tests__/semiring.test.d.ts.map +0 -1
- package/dist/__tests__/semiring.test.js +0 -201
- package/dist/__tests__/semiring.test.js.map +0 -1
- package/dist/__tests__/traversal.test.d.ts +0 -2
- package/dist/__tests__/traversal.test.d.ts.map +0 -1
- package/dist/__tests__/traversal.test.js +0 -331
- package/dist/__tests__/traversal.test.js.map +0 -1
- package/dist/__tests__/trust-algebra.test.d.ts +0 -2
- package/dist/__tests__/trust-algebra.test.d.ts.map +0 -1
- package/dist/__tests__/trust-algebra.test.js +0 -105
- package/dist/__tests__/trust-algebra.test.js.map +0 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cryptosuite registry — the protocol's open set of verification recipes.
|
|
3
|
+
*
|
|
4
|
+
* A cryptosuite is the complete specification of how a signature is
|
|
5
|
+
* produced and verified for a class of artifacts: which algorithm,
|
|
6
|
+
* which canonicalization, which signature and key encodings. Matches
|
|
7
|
+
* the pattern of W3C VC 2.0 (`cryptosuite: "eddsa-jcs-2022"`) and
|
|
8
|
+
* COSE/JOSE algorithm registries — one ID per full recipe, not just
|
|
9
|
+
* "which primitive."
|
|
10
|
+
*
|
|
11
|
+
* Every signed wire-format artifact in motebit MUST carry a `suite`
|
|
12
|
+
* field (see each artifact's `#### Wire format (foundation law)`
|
|
13
|
+
* subsection in `spec/*.md`). Verifiers dispatch on the suite value.
|
|
14
|
+
* Missing or unknown suites are rejected fail-closed. See the
|
|
15
|
+
* `check-suite-declared` (spec-side) and `check-suite-dispatch`
|
|
16
|
+
* (code-side) drift gates.
|
|
17
|
+
*
|
|
18
|
+
* Post-quantum migration becomes a new registry entry + dispatch arm
|
|
19
|
+
* in `@motebit/crypto/suite-dispatch.ts`, not a wire-format change.
|
|
20
|
+
*
|
|
21
|
+
* Permissive floor (Apache-2.0), type-only, zero runtime deps.
|
|
22
|
+
*/
|
|
23
|
+
export const SUITE_REGISTRY = Object.freeze({
|
|
24
|
+
"motebit-jcs-ed25519-b64-v1": {
|
|
25
|
+
id: "motebit-jcs-ed25519-b64-v1",
|
|
26
|
+
algorithm: "Ed25519",
|
|
27
|
+
canonicalization: "jcs",
|
|
28
|
+
signatureEncoding: "base64url",
|
|
29
|
+
publicKeyEncoding: "hex",
|
|
30
|
+
status: "preferred",
|
|
31
|
+
description: "RFC 8785 JCS canonicalization + Ed25519 signature + base64url. Execution receipts, delegation-lifecycle, dispute-lifecycle, migration-lifecycle artifacts.",
|
|
32
|
+
},
|
|
33
|
+
"motebit-jcs-ed25519-hex-v1": {
|
|
34
|
+
id: "motebit-jcs-ed25519-hex-v1",
|
|
35
|
+
algorithm: "Ed25519",
|
|
36
|
+
canonicalization: "jcs",
|
|
37
|
+
signatureEncoding: "hex",
|
|
38
|
+
publicKeyEncoding: "hex",
|
|
39
|
+
status: "preferred",
|
|
40
|
+
description: "RFC 8785 JCS canonicalization + Ed25519 signature + hex. Identity files, succession, guardian attestations, credential anchors, relay metadata.",
|
|
41
|
+
},
|
|
42
|
+
"motebit-jwt-ed25519-v1": {
|
|
43
|
+
id: "motebit-jwt-ed25519-v1",
|
|
44
|
+
algorithm: "Ed25519",
|
|
45
|
+
canonicalization: "json-stringify",
|
|
46
|
+
signatureEncoding: "base64url",
|
|
47
|
+
publicKeyEncoding: "hex",
|
|
48
|
+
status: "preferred",
|
|
49
|
+
description: "JWT-style bearer token (`base64url(payload).base64url(signature)`). Signed bearer tokens only; suite is a field of the JSON payload.",
|
|
50
|
+
},
|
|
51
|
+
"motebit-concat-ed25519-hex-v1": {
|
|
52
|
+
id: "motebit-concat-ed25519-hex-v1",
|
|
53
|
+
algorithm: "Ed25519",
|
|
54
|
+
canonicalization: "utf8-concat",
|
|
55
|
+
signatureEncoding: "hex",
|
|
56
|
+
publicKeyEncoding: "hex",
|
|
57
|
+
status: "preferred",
|
|
58
|
+
description: "UTF-8 concatenation of a fixed template + Ed25519 signature + hex. Federation handshake challenges and heartbeats.",
|
|
59
|
+
},
|
|
60
|
+
"eddsa-jcs-2022": {
|
|
61
|
+
id: "eddsa-jcs-2022",
|
|
62
|
+
algorithm: "Ed25519",
|
|
63
|
+
canonicalization: "jcs",
|
|
64
|
+
signatureEncoding: "multibase-base58btc",
|
|
65
|
+
publicKeyEncoding: "multibase-did-key",
|
|
66
|
+
status: "preferred",
|
|
67
|
+
description: "W3C Verifiable Credentials 2.0 Data Integrity cryptosuite (eddsa-jcs-2022). Verifiable Credentials and Presentations.",
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* Type guard — narrows `unknown` or arbitrary strings to `SuiteId`.
|
|
72
|
+
* Verifiers MUST call this before dispatching; an unchecked cast is a
|
|
73
|
+
* fail-open path that the `check-suite-dispatch` gate will flag.
|
|
74
|
+
*/
|
|
75
|
+
export function isSuiteId(value) {
|
|
76
|
+
return typeof value === "string" && value in SUITE_REGISTRY;
|
|
77
|
+
}
|
|
78
|
+
export function getSuiteEntry(id) {
|
|
79
|
+
return SUITE_REGISTRY[id];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Canonical list of all registered suite IDs, frozen. Consumers that
|
|
83
|
+
* need to iterate (tooling, docs, tests) should use this instead of
|
|
84
|
+
* `Object.keys(SUITE_REGISTRY)` so TypeScript sees the narrow union.
|
|
85
|
+
*/
|
|
86
|
+
export const ALL_SUITE_IDS = Object.freeze([
|
|
87
|
+
"motebit-jcs-ed25519-b64-v1",
|
|
88
|
+
"motebit-jcs-ed25519-hex-v1",
|
|
89
|
+
"motebit-jwt-ed25519-v1",
|
|
90
|
+
"motebit-concat-ed25519-hex-v1",
|
|
91
|
+
"eddsa-jcs-2022",
|
|
92
|
+
]);
|
|
93
|
+
//# sourceMappingURL=crypto-suite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-suite.js","sourceRoot":"","sources":["../src/crypto-suite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AA6EH,MAAM,CAAC,MAAM,cAAc,GAA0C,MAAM,CAAC,MAAM,CAAC;IACjF,4BAA4B,EAAE;QAC5B,EAAE,EAAE,4BAA4B;QAChC,SAAS,EAAE,SAAS;QACpB,gBAAgB,EAAE,KAAK;QACvB,iBAAiB,EAAE,WAAW;QAC9B,iBAAiB,EAAE,KAAK;QACxB,MAAM,EAAE,WAAW;QACnB,WAAW,EACT,4JAA4J;KAC/J;IACD,4BAA4B,EAAE;QAC5B,EAAE,EAAE,4BAA4B;QAChC,SAAS,EAAE,SAAS;QACpB,gBAAgB,EAAE,KAAK;QACvB,iBAAiB,EAAE,KAAK;QACxB,iBAAiB,EAAE,KAAK;QACxB,MAAM,EAAE,WAAW;QACnB,WAAW,EACT,iJAAiJ;KACpJ;IACD,wBAAwB,EAAE;QACxB,EAAE,EAAE,wBAAwB;QAC5B,SAAS,EAAE,SAAS;QACpB,gBAAgB,EAAE,gBAAgB;QAClC,iBAAiB,EAAE,WAAW;QAC9B,iBAAiB,EAAE,KAAK;QACxB,MAAM,EAAE,WAAW;QACnB,WAAW,EACT,sIAAsI;KACzI;IACD,+BAA+B,EAAE;QAC/B,EAAE,EAAE,+BAA+B;QACnC,SAAS,EAAE,SAAS;QACpB,gBAAgB,EAAE,aAAa;QAC/B,iBAAiB,EAAE,KAAK;QACxB,iBAAiB,EAAE,KAAK;QACxB,MAAM,EAAE,WAAW;QACnB,WAAW,EACT,oHAAoH;KACvH;IACD,gBAAgB,EAAE;QAChB,EAAE,EAAE,gBAAgB;QACpB,SAAS,EAAE,SAAS;QACpB,gBAAgB,EAAE,KAAK;QACvB,iBAAiB,EAAE,qBAAqB;QACxC,iBAAiB,EAAE,mBAAmB;QACtC,MAAM,EAAE,WAAW;QACnB,WAAW,EACT,uHAAuH;KAC1H;CACF,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,cAAc,CAAC;AAC9D,CAAC;AASD,MAAM,UAAU,aAAa,CAAC,EAAU;IACtC,OAAO,cAAc,CAAC,EAAa,CAAC,CAAC;AACvC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAuB,MAAM,CAAC,MAAM,CAAC;IAC7D,4BAA4B;IAC5B,4BAA4B;IAC5B,wBAAwB;IACxB,+BAA+B;IAC/B,gBAAgB;CACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discovery types — motebit/discovery@1.0.
|
|
3
|
+
*
|
|
4
|
+
* Permissive floor (Apache-2.0): these types define the interoperable format
|
|
5
|
+
* for relay discovery and agent resolution. Any implementation can produce
|
|
6
|
+
* and verify relay metadata and resolve agents using these types.
|
|
7
|
+
*/
|
|
8
|
+
/** Federation peer entry in relay metadata. */
|
|
9
|
+
export interface RelayMetadataPeer {
|
|
10
|
+
/** Peer relay's MotebitId. */
|
|
11
|
+
relay_id: string;
|
|
12
|
+
/** Peer relay's canonical HTTPS endpoint. */
|
|
13
|
+
endpoint_url: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Signed relay metadata served at /.well-known/motebit.json.
|
|
17
|
+
*
|
|
18
|
+
* Foundation Law (§3.5):
|
|
19
|
+
* - Path MUST be /.well-known/motebit.json
|
|
20
|
+
* - Response MUST include relay_id, public_key, endpoint_url, protocol_version, signature
|
|
21
|
+
* - Endpoint MUST be unauthenticated
|
|
22
|
+
* - Signature MUST be verifiable using only the public_key in the response
|
|
23
|
+
*/
|
|
24
|
+
export interface RelayMetadata {
|
|
25
|
+
/** Spec version (e.g., "1.0"). */
|
|
26
|
+
protocol_version: string;
|
|
27
|
+
/** Relay's MotebitId (UUID v7). */
|
|
28
|
+
relay_id: string;
|
|
29
|
+
/** Human-readable relay name. */
|
|
30
|
+
display_name?: string;
|
|
31
|
+
/** Hex-encoded Ed25519 public key (64 hex chars). */
|
|
32
|
+
public_key: string;
|
|
33
|
+
/** Canonical HTTPS base URL. */
|
|
34
|
+
endpoint_url: string;
|
|
35
|
+
/** Supported feature capabilities. */
|
|
36
|
+
capabilities?: string[];
|
|
37
|
+
/** Platform fee as decimal (0.05 = 5%). */
|
|
38
|
+
fee_rate?: number;
|
|
39
|
+
/** Known federation peers. */
|
|
40
|
+
federation_peers?: RelayMetadataPeer[];
|
|
41
|
+
/** Approximate number of registered agents. */
|
|
42
|
+
agent_count?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Cryptosuite discriminator. Always `"motebit-jcs-ed25519-hex-v1"` —
|
|
45
|
+
* JCS canonicalization of the unsigned metadata, Ed25519 primitive,
|
|
46
|
+
* hex signature encoding, hex public-key encoding. The field is
|
|
47
|
+
* included in the signed body; tampering with it breaks verification.
|
|
48
|
+
* Verifiers reject missing or unknown suite values fail-closed.
|
|
49
|
+
*/
|
|
50
|
+
suite: "motebit-jcs-ed25519-hex-v1";
|
|
51
|
+
/** Ed25519 signature over canonical JSON of all other fields. */
|
|
52
|
+
signature: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Result of resolving an agent's location across the federation.
|
|
56
|
+
*
|
|
57
|
+
* Foundation Law (§5.3):
|
|
58
|
+
* - Agent resolution MUST propagate through federation peers
|
|
59
|
+
* - visited_relays set MUST be forwarded for loop prevention
|
|
60
|
+
* - Agents with federation_visible: false MUST NOT appear in remote results
|
|
61
|
+
* - resolved_via chain MUST be included for auditability
|
|
62
|
+
*/
|
|
63
|
+
export interface AgentResolutionResult {
|
|
64
|
+
/** The queried agent's MotebitId. */
|
|
65
|
+
motebit_id: string;
|
|
66
|
+
/** Whether the agent was located. */
|
|
67
|
+
found: boolean;
|
|
68
|
+
/** Hosting relay's MotebitId (present if found). */
|
|
69
|
+
relay_id?: string;
|
|
70
|
+
/** HTTPS endpoint of the hosting relay (present if found). */
|
|
71
|
+
relay_url?: string;
|
|
72
|
+
/** Agent's advertised capabilities. */
|
|
73
|
+
capabilities?: string[];
|
|
74
|
+
/** Agent's hex-encoded Ed25519 public key (present if found). */
|
|
75
|
+
public_key?: string;
|
|
76
|
+
/** Agent's declared settlement address (e.g. Solana base58), if any. */
|
|
77
|
+
settlement_address?: string;
|
|
78
|
+
/** Settlement modes the agent accepts (e.g. ["relay", "p2p"]). */
|
|
79
|
+
settlement_modes?: string[];
|
|
80
|
+
/** Chain of relay_ids traversed during resolution (audit trail). */
|
|
81
|
+
resolved_via: string[];
|
|
82
|
+
/** Whether result came from cache. */
|
|
83
|
+
cached: boolean;
|
|
84
|
+
/** Seconds until this result should be re-resolved. */
|
|
85
|
+
ttl: number;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;A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M,EAAE,CAAC;IACvB,sCAAsC;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,uDAAuD;IACvD,GAAG,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discovery types — motebit/discovery@1.0.
|
|
3
|
+
*
|
|
4
|
+
* Permissive floor (Apache-2.0): these types define the interoperable format
|
|
5
|
+
* for relay discovery and agent resolution. Any implementation can produce
|
|
6
|
+
* and verify relay metadata and resolve agents using these types.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dispute types — motebit/dispute@1.0.
|
|
3
|
+
*
|
|
4
|
+
* Permissive floor (Apache-2.0): these types define the interoperable format
|
|
5
|
+
* for dispute resolution in agent-to-agent delegations. Any implementation can
|
|
6
|
+
* produce and verify dispute artifacts using these types.
|
|
7
|
+
*/
|
|
8
|
+
/** Dispute lifecycle states. Terminal states (final, expired) are irreversible. */
|
|
9
|
+
export type DisputeState = "opened" | "evidence" | "arbitration" | "resolved" | "appealed" | "final" | "expired";
|
|
10
|
+
/** Dispute resolution outcome. */
|
|
11
|
+
export type DisputeOutcome = "upheld" | "overturned" | "split";
|
|
12
|
+
/** Dispute category (§4.2). */
|
|
13
|
+
export type DisputeCategory = "quality" | "non_payment" | "receipt_invalid" | "unauthorized" | "other";
|
|
14
|
+
/** Fund action resulting from dispute resolution (§7.2). */
|
|
15
|
+
export type DisputeFundAction = "release_to_worker" | "refund_to_delegator" | "split";
|
|
16
|
+
/**
|
|
17
|
+
* Request to open a dispute on a completed task.
|
|
18
|
+
*
|
|
19
|
+
* Foundation Law (§4.4):
|
|
20
|
+
* - task_id and allocation_id are required — no economic binding, no dispute
|
|
21
|
+
* - Filing party must be a direct party to the referenced task
|
|
22
|
+
* - At least one evidence reference is required at filing time
|
|
23
|
+
* - A relay must not reject an eligible dispute
|
|
24
|
+
*/
|
|
25
|
+
export interface DisputeRequest {
|
|
26
|
+
/** UUID v7, generated by filing party. */
|
|
27
|
+
dispute_id: string;
|
|
28
|
+
/** Must reference an existing task. */
|
|
29
|
+
task_id: string;
|
|
30
|
+
/** Must reference the task's BudgetAllocation. */
|
|
31
|
+
allocation_id: string;
|
|
32
|
+
/** MotebitId of the filing party. */
|
|
33
|
+
filed_by: string;
|
|
34
|
+
/** MotebitId of the other task party. */
|
|
35
|
+
respondent: string;
|
|
36
|
+
/** Dispute category. */
|
|
37
|
+
category: DisputeCategory;
|
|
38
|
+
/** Human-readable explanation. */
|
|
39
|
+
description: string;
|
|
40
|
+
/** At least one reference to a signed artifact. */
|
|
41
|
+
evidence_refs: string[];
|
|
42
|
+
/** Unix ms. */
|
|
43
|
+
filed_at: number;
|
|
44
|
+
/**
|
|
45
|
+
* Cryptosuite discriminator. Always `"motebit-jcs-ed25519-b64-v1"` —
|
|
46
|
+
* JCS canonicalization, Ed25519 primitive, base64url signature
|
|
47
|
+
* encoding. Verifiers reject missing or unknown values fail-closed.
|
|
48
|
+
*/
|
|
49
|
+
suite: "motebit-jcs-ed25519-b64-v1";
|
|
50
|
+
/** Ed25519 over canonical JSON of all fields except signature. */
|
|
51
|
+
signature: string;
|
|
52
|
+
}
|
|
53
|
+
/** Evidence types that can be submitted in a dispute (§5.1). */
|
|
54
|
+
export type DisputeEvidenceType = "execution_receipt" | "credential" | "anchor_proof" | "settlement_proof" | "execution_ledger" | "attestation";
|
|
55
|
+
/**
|
|
56
|
+
* Evidence submitted in a dispute.
|
|
57
|
+
*
|
|
58
|
+
* Foundation Law (§5.4):
|
|
59
|
+
* - Evidence must be cryptographically verifiable
|
|
60
|
+
* - Both parties must have equal access to the evidence window
|
|
61
|
+
* - The relay must not tamper with or withhold submitted evidence
|
|
62
|
+
*/
|
|
63
|
+
export interface DisputeEvidence {
|
|
64
|
+
/** Must reference an open dispute. */
|
|
65
|
+
dispute_id: string;
|
|
66
|
+
/** MotebitId of the submitting party. */
|
|
67
|
+
submitted_by: string;
|
|
68
|
+
/** Evidence type. */
|
|
69
|
+
evidence_type: DisputeEvidenceType;
|
|
70
|
+
/** The signed artifact itself. */
|
|
71
|
+
evidence_data: Record<string, unknown>;
|
|
72
|
+
/** What this evidence demonstrates. */
|
|
73
|
+
description: string;
|
|
74
|
+
/** Unix ms. */
|
|
75
|
+
submitted_at: number;
|
|
76
|
+
/**
|
|
77
|
+
* Cryptosuite discriminator. Always `"motebit-jcs-ed25519-b64-v1"`
|
|
78
|
+
* (see DisputeRequest for the full recipe).
|
|
79
|
+
*/
|
|
80
|
+
suite: "motebit-jcs-ed25519-b64-v1";
|
|
81
|
+
/** Ed25519 over canonical JSON of all fields except signature. */
|
|
82
|
+
signature: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Individual vote by a federation peer in federation adjudication (§6.2).
|
|
86
|
+
*
|
|
87
|
+
* Foundation Law (§6.5):
|
|
88
|
+
* - Federation resolution must include individual AdjudicatorVote entries
|
|
89
|
+
* - Aggregated-only verdicts are rejected
|
|
90
|
+
* - Each vote signature MUST cover `dispute_id` — votes are not portable
|
|
91
|
+
* across disputes (a malicious adjudicator collecting old votes from
|
|
92
|
+
* other disputes cannot stuff them into a new resolution because the
|
|
93
|
+
* dispute_id binding breaks the signature).
|
|
94
|
+
*/
|
|
95
|
+
export interface AdjudicatorVote {
|
|
96
|
+
/**
|
|
97
|
+
* Dispute this vote applies to. Signature-bound: the canonical body
|
|
98
|
+
* includes this field, so a vote signed for dispute A is rejected
|
|
99
|
+
* on submission to dispute B (the relay/aggregator reconstructs the
|
|
100
|
+
* canonical bytes against the target dispute_id and the signature
|
|
101
|
+
* fails to verify against the wrong binding).
|
|
102
|
+
*/
|
|
103
|
+
dispute_id: string;
|
|
104
|
+
/** Federation peer MotebitId. */
|
|
105
|
+
peer_id: string;
|
|
106
|
+
/** Vote outcome. */
|
|
107
|
+
vote: DisputeOutcome;
|
|
108
|
+
/** Per-peer explanation. */
|
|
109
|
+
rationale: string;
|
|
110
|
+
/**
|
|
111
|
+
* Cryptosuite discriminator. Always `"motebit-jcs-ed25519-b64-v1"`
|
|
112
|
+
* (see DisputeRequest for the full recipe).
|
|
113
|
+
*/
|
|
114
|
+
suite: "motebit-jcs-ed25519-b64-v1";
|
|
115
|
+
/** Ed25519 by the voting peer over canonical JSON of all fields except signature. */
|
|
116
|
+
signature: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Dispute resolution by adjudicator.
|
|
120
|
+
*
|
|
121
|
+
* Foundation Law (§6.5):
|
|
122
|
+
* - Resolution must include a signed rationale
|
|
123
|
+
* - A relay must not self-adjudicate when it is the defendant
|
|
124
|
+
*/
|
|
125
|
+
export interface DisputeResolution {
|
|
126
|
+
/** Must reference the dispute. */
|
|
127
|
+
dispute_id: string;
|
|
128
|
+
/** Resolution outcome. */
|
|
129
|
+
resolution: DisputeOutcome;
|
|
130
|
+
/** Signed explanation of the decision. */
|
|
131
|
+
rationale: string;
|
|
132
|
+
/** How funds are distributed. */
|
|
133
|
+
fund_action: DisputeFundAction;
|
|
134
|
+
/** [0, 1], worker's portion. 1.0 = all to worker. */
|
|
135
|
+
split_ratio: number;
|
|
136
|
+
/** MotebitId or relay ID of the adjudicating entity. */
|
|
137
|
+
adjudicator: string;
|
|
138
|
+
/** For federation — empty for single-relay. */
|
|
139
|
+
adjudicator_votes: AdjudicatorVote[];
|
|
140
|
+
/** Unix ms. */
|
|
141
|
+
resolved_at: number;
|
|
142
|
+
/**
|
|
143
|
+
* Cryptosuite discriminator. Always `"motebit-jcs-ed25519-b64-v1"`
|
|
144
|
+
* (see DisputeRequest for the full recipe).
|
|
145
|
+
*/
|
|
146
|
+
suite: "motebit-jcs-ed25519-b64-v1";
|
|
147
|
+
/** Ed25519 over canonical JSON of all fields except signature. */
|
|
148
|
+
signature: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Appeal filed against a dispute resolution.
|
|
152
|
+
*
|
|
153
|
+
* Foundation Law (§8.4):
|
|
154
|
+
* - One appeal per dispute — final state after appeal is terminal
|
|
155
|
+
* - New evidence may be submitted with the appeal
|
|
156
|
+
*/
|
|
157
|
+
export interface DisputeAppeal {
|
|
158
|
+
/** Must reference a resolved dispute. */
|
|
159
|
+
dispute_id: string;
|
|
160
|
+
/** MotebitId of the appealing party. */
|
|
161
|
+
appealed_by: string;
|
|
162
|
+
/** Why the resolution is incorrect. */
|
|
163
|
+
reason: string;
|
|
164
|
+
/** Optional: new evidence references. */
|
|
165
|
+
additional_evidence?: string[];
|
|
166
|
+
/** Unix ms. */
|
|
167
|
+
appealed_at: number;
|
|
168
|
+
/**
|
|
169
|
+
* Cryptosuite discriminator. Always `"motebit-jcs-ed25519-b64-v1"`
|
|
170
|
+
* (see DisputeRequest for the full recipe).
|
|
171
|
+
*/
|
|
172
|
+
suite: "motebit-jcs-ed25519-b64-v1";
|
|
173
|
+
/** Ed25519 over canonical JSON of all fields except signature. */
|
|
174
|
+
signature: string;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=dispute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispute.d.ts","sourceRoot":"","sources":["../src/dispute.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,mFAAmF;AACnF,MAAM,MAAM,YAAY,GACpB,QAAQ,GACR,UAAU,GACV,aAAa,GACb,UAAU,GACV,UAAU,GACV,OAAO,GACP,SAAS,CAAC;AAEd,kCAAkC;AAClC,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,YAAY,GAAG,OAAO,CAAC;AAE/D,+BAA+B;AAC/B,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,aAAa,GACb,iBAAiB,GACjB,cAAc,GACd,OAA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
1
|
+
/**
|
|
2
|
+
* Dispute types — motebit/dispute@1.0.
|
|
3
|
+
*
|
|
4
|
+
* Permissive floor (Apache-2.0): these types define the interoperable format
|
|
5
|
+
* for dispute resolution in agent-to-agent delegations. Any implementation can
|
|
6
|
+
* produce and verify dispute artifacts using these types.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=dispute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispute.js","sourceRoot":"","sources":["../src/dispute.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Goal-lifecycle event payload types — wire format for `goal-lifecycle-v1.md`.
|
|
3
|
+
*
|
|
4
|
+
* A goal is the unit of intent a motebit owns: a prompt plus scheduling +
|
|
5
|
+
* progress metadata. Goals sync across a user's devices via the event log
|
|
6
|
+
* substrate — a second device joining the identity replays the ledger and
|
|
7
|
+
* reconstructs the goal set without contacting the originating device
|
|
8
|
+
* directly. Because the ledger crosses device boundaries, the payload of
|
|
9
|
+
* every goal-lifecycle event must be pinned as a wire-format type so a
|
|
10
|
+
* non-TypeScript implementer (Python daemon, Go federation peer, browser
|
|
11
|
+
* worker that doesn't bundle this package) validates payloads against the
|
|
12
|
+
* committed JSON Schema rather than TypeScript's structural view.
|
|
13
|
+
*
|
|
14
|
+
* Five event types cover the full lifecycle:
|
|
15
|
+
* 1. `goal_created` — initial declaration OR a yaml-driven revision
|
|
16
|
+
* 2. `goal_executed` — a run completed with a summary, tool count, etc.
|
|
17
|
+
* 3. `goal_progress` — narrative progress note emitted mid-run
|
|
18
|
+
* 4. `goal_completed` — goal reached its terminal state (success / failure)
|
|
19
|
+
* 5. `goal_removed` — goal deleted, either user-initiated or yaml-pruned
|
|
20
|
+
*
|
|
21
|
+
* Every type named here is referenced by a `### X.Y — Name` section under a
|
|
22
|
+
* `#### Wire format (foundation law)` block in `spec/goal-lifecycle-v1.md`,
|
|
23
|
+
* so `check-spec-coverage` (invariant #9) keeps the spec and types in
|
|
24
|
+
* lockstep. Implementing package declaration lives in
|
|
25
|
+
* `packages/runtime/package.json`'s `motebit.implements` array, enforced by
|
|
26
|
+
* `check-spec-impl-coverage` (invariant #31).
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Emitted when a goal is declared. Two shapes in current emitters:
|
|
30
|
+
*
|
|
31
|
+
* - **Initial creation** — carries `prompt` (the intent text) plus optional
|
|
32
|
+
* scheduler metadata.
|
|
33
|
+
* - **Revision** — carries `update: true` alongside `goal_id` and the
|
|
34
|
+
* updated routine metadata. `prompt` MAY be absent when only scheduling
|
|
35
|
+
* metadata changed.
|
|
36
|
+
*
|
|
37
|
+
* The distinction is in-band via the `update` marker. A future spec
|
|
38
|
+
* revision MAY split these into two event types (`goal_created` vs
|
|
39
|
+
* `goal_updated`), but v1 keeps them merged to match the shipping emitter
|
|
40
|
+
* flow in `apps/cli/src/subcommands/up.ts`.
|
|
41
|
+
*/
|
|
42
|
+
export interface GoalCreatedPayload {
|
|
43
|
+
/** Stable identifier of the goal. UUID v4 at creation; stable across revisions. */
|
|
44
|
+
readonly goal_id: string;
|
|
45
|
+
/** Natural-language goal text. REQUIRED on initial creation; MAY be absent on revision. */
|
|
46
|
+
readonly prompt?: string;
|
|
47
|
+
/** Scheduling cadence in milliseconds. MAY be absent for one-shot goals. */
|
|
48
|
+
readonly interval_ms?: number;
|
|
49
|
+
/** Scheduling mode — `"recurring"`, `"once"`, or a future-reserved variant. */
|
|
50
|
+
readonly mode?: string;
|
|
51
|
+
/** Wall-clock anchor for the first run (Unix milliseconds). */
|
|
52
|
+
readonly wall_clock_ms?: number;
|
|
53
|
+
/** User-facing project grouping, opaque to the protocol. */
|
|
54
|
+
readonly project_id?: string;
|
|
55
|
+
/** Source routine id when the goal was materialized from a motebit.yaml routine. */
|
|
56
|
+
readonly routine_id?: string;
|
|
57
|
+
/** Free-text source attribution for the routine (e.g. yaml file path). */
|
|
58
|
+
readonly routine_source?: string;
|
|
59
|
+
/** Canonical hash of the source routine. Used by revision flows to detect drift. */
|
|
60
|
+
readonly routine_hash?: string;
|
|
61
|
+
/** Marker set on yaml-driven revisions; absent on initial creation. */
|
|
62
|
+
readonly update?: true;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Emitted when a goal run finishes. Carries either the success metrics
|
|
66
|
+
* (summary / tool_calls / memories) or an `error` string — the presence
|
|
67
|
+
* of `error` distinguishes a failed run from a successful one. Distinct
|
|
68
|
+
* from `goal_completed`: `goal_executed` records each run's outcome,
|
|
69
|
+
* `goal_completed` records the terminal transition of a one-shot goal or
|
|
70
|
+
* a user-initiated completion. A recurring goal can emit many
|
|
71
|
+
* `goal_executed` events (successes + failures) and at most one
|
|
72
|
+
* `goal_completed`.
|
|
73
|
+
*/
|
|
74
|
+
export interface GoalExecutedPayload {
|
|
75
|
+
readonly goal_id: string;
|
|
76
|
+
/** Up to ~200 characters of the agent's response text for this run. Present on success. */
|
|
77
|
+
readonly summary?: string;
|
|
78
|
+
/** Number of tool calls performed during the run. Present on success. */
|
|
79
|
+
readonly tool_calls?: number;
|
|
80
|
+
/** Number of memory nodes formed during the run. Present on success. */
|
|
81
|
+
readonly memories?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Error message for a failed run. Present iff the run terminated in
|
|
84
|
+
* failure. Consumers MUST NOT parse it semantically — treat as opaque
|
|
85
|
+
* free-text. A future spec version MAY add structured error codes;
|
|
86
|
+
* receivers MUST tolerate their absence.
|
|
87
|
+
*/
|
|
88
|
+
readonly error?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Narrative progress note emitted by the `report_progress` tool during a
|
|
92
|
+
* goal run. Distinct from `goal_executed`: progress notes are events
|
|
93
|
+
* within a run; `goal_executed` records the run's terminal outcome.
|
|
94
|
+
*/
|
|
95
|
+
export interface GoalProgressPayload {
|
|
96
|
+
readonly goal_id: string;
|
|
97
|
+
/** Free-text progress narration from the agent. */
|
|
98
|
+
readonly note: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Emitted when a goal reaches its terminal state. Two paths today:
|
|
102
|
+
*
|
|
103
|
+
* - Agent-driven: the `complete_goal` tool is invoked with a `reason`.
|
|
104
|
+
* - One-shot auto-complete: a one-shot goal finishes its single run
|
|
105
|
+
* without the agent invoking the tool; the scheduler emits the event
|
|
106
|
+
* with `reason: "one-shot auto-complete"`.
|
|
107
|
+
*
|
|
108
|
+
* Recurring goals do not emit `goal_completed` until the user removes
|
|
109
|
+
* them (→ `goal_removed`).
|
|
110
|
+
*/
|
|
111
|
+
export interface GoalCompletedPayload {
|
|
112
|
+
readonly goal_id: string;
|
|
113
|
+
/** Free-text rationale for completion. Consumers MUST NOT parse it semantically. */
|
|
114
|
+
readonly reason?: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Emitted when a goal is deleted. Sources include the `motebit goal
|
|
118
|
+
* remove` CLI command and yaml re-apply operations that prune goals no
|
|
119
|
+
* longer declared in the source routine file. The original `goal_created`
|
|
120
|
+
* event persists in the log; storage adapters MUST retain it.
|
|
121
|
+
*/
|
|
122
|
+
export interface GoalRemovedPayload {
|
|
123
|
+
readonly goal_id: string;
|
|
124
|
+
/** Source routine id when the removal was yaml-pruned. */
|
|
125
|
+
readonly routine_id?: string;
|
|
126
|
+
/** Free-text rationale (e.g. `"yaml_pruned"` or a user reason). */
|
|
127
|
+
readonly reason?: string;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=goal-lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goal-lifecycle.d.ts","sourceRoot":"","sources":["../src/goal-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,kBAAkB;IACjC,mFAAmF;IACnF,QAAQ,CAAC,OA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,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Goal-lifecycle event payload types — wire format for `goal-lifecycle-v1.md`.
|
|
3
|
+
*
|
|
4
|
+
* A goal is the unit of intent a motebit owns: a prompt plus scheduling +
|
|
5
|
+
* progress metadata. Goals sync across a user's devices via the event log
|
|
6
|
+
* substrate — a second device joining the identity replays the ledger and
|
|
7
|
+
* reconstructs the goal set without contacting the originating device
|
|
8
|
+
* directly. Because the ledger crosses device boundaries, the payload of
|
|
9
|
+
* every goal-lifecycle event must be pinned as a wire-format type so a
|
|
10
|
+
* non-TypeScript implementer (Python daemon, Go federation peer, browser
|
|
11
|
+
* worker that doesn't bundle this package) validates payloads against the
|
|
12
|
+
* committed JSON Schema rather than TypeScript's structural view.
|
|
13
|
+
*
|
|
14
|
+
* Five event types cover the full lifecycle:
|
|
15
|
+
* 1. `goal_created` — initial declaration OR a yaml-driven revision
|
|
16
|
+
* 2. `goal_executed` — a run completed with a summary, tool count, etc.
|
|
17
|
+
* 3. `goal_progress` — narrative progress note emitted mid-run
|
|
18
|
+
* 4. `goal_completed` — goal reached its terminal state (success / failure)
|
|
19
|
+
* 5. `goal_removed` — goal deleted, either user-initiated or yaml-pruned
|
|
20
|
+
*
|
|
21
|
+
* Every type named here is referenced by a `### X.Y — Name` section under a
|
|
22
|
+
* `#### Wire format (foundation law)` block in `spec/goal-lifecycle-v1.md`,
|
|
23
|
+
* so `check-spec-coverage` (invariant #9) keeps the spec and types in
|
|
24
|
+
* lockstep. Implementing package declaration lives in
|
|
25
|
+
* `packages/runtime/package.json`'s `motebit.implements` array, enforced by
|
|
26
|
+
* `check-spec-impl-coverage` (invariant #31).
|
|
27
|
+
*/
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=goal-lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goal-lifecycle.js","sourceRoot":"","sources":["../src/goal-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG"}
|