@motebit/protocol 1.0.0 → 1.2.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.
@@ -0,0 +1,334 @@
1
+ /**
2
+ * Skill manifest + envelope types — motebit/skills@1.0.
3
+ *
4
+ * Permissive floor (Apache-2.0): these types define the interoperable wire
5
+ * format for a motebit skill — agentskills.io-compatible frontmatter with
6
+ * motebit-namespaced extensions for cryptographic provenance, sensitivity-
7
+ * tiered loading, and hardware-attestation gating. See spec/skills-v1.md.
8
+ *
9
+ * The parsed frontmatter object (`SkillManifest`) is the wire artifact; the
10
+ * YAML in `SKILL.md` is the on-disk encoding only. JSON-over-wire and the
11
+ * `skill-envelope.json` wrapper both serialize to the types declared here.
12
+ *
13
+ * Audience-distinct from credentials (peer-issued reputation/trust attestations,
14
+ * spec/credential-v1.md) and execution receipts (per-invocation audit,
15
+ * spec/execution-ledger-v1.md). Phase 3 of skills-v1 will emit
16
+ * `SkillLoadReceipt` entries into the execution ledger; that schema lives in
17
+ * the ledger module, not here.
18
+ *
19
+ * Layer purity (per packages/protocol/CLAUDE.md): types only. Canonicalization
20
+ * and signature verification live in @motebit/crypto. Frontmatter parsing,
21
+ * registry, selector, and trust gate live in the BSL @motebit/skills package.
22
+ */
23
+ import type { SuiteId } from "./crypto-suite.js";
24
+ /**
25
+ * Sensitivity tier of the data a skill's procedure causes the agent to touch.
26
+ *
27
+ * Sensitivity describes data, not provenance — see spec/skills-v1.md §4.
28
+ * `medical`, `financial`, and `secret` skills are NEVER auto-loaded by the
29
+ * `SkillSelector` regardless of session tier; they require explicit per-turn
30
+ * opt-in or operator-mode session promotion.
31
+ */
32
+ export type SkillSensitivity = "none" | "personal" | "medical" | "financial" | "secret";
33
+ /** Frozen list of sensitivity tiers in increasing-restriction order. */
34
+ export declare const SKILL_SENSITIVITY_TIERS: readonly SkillSensitivity[];
35
+ /** Tiers that are auto-loadable when session tier permits. */
36
+ export declare const SKILL_AUTO_LOADABLE_TIERS: readonly SkillSensitivity[];
37
+ /** OS gate per agentskills.io `platforms` field. Empty/omitted = all platforms. */
38
+ export type SkillPlatform = "macos" | "linux" | "windows" | "ios" | "android";
39
+ /** Frozen list of recognized platform identifiers. */
40
+ export declare const SKILL_PLATFORMS: readonly SkillPlatform[];
41
+ /**
42
+ * Hardware-attestation gate for skill loading.
43
+ *
44
+ * Additive scoring per docs/doctrine/hardware-attestation.md — never a hard
45
+ * wall on the agent's own identity, but a skill MAY require its loading
46
+ * runtime to present a minimum HA score. Sibling pattern to the
47
+ * HardwareAttestationSemiring used in routing.
48
+ */
49
+ export interface SkillHardwareAttestationGate {
50
+ /** If `true`, loading agent must present an HA credential. Default `false`. */
51
+ required?: boolean;
52
+ /** Minimum score in `[0, 1]` required for load. Default `0`. */
53
+ minimum_score?: number;
54
+ }
55
+ /**
56
+ * Cryptographic provenance for a skill — sibling shape to other motebit
57
+ * signed artifacts (settlement anchor, migration, execution receipts, etc.).
58
+ *
59
+ * The signature value is over the canonical form defined in
60
+ * spec/skills-v1.md §5.1: `JCS(manifest_without_value) || 0x0A || lf_body`.
61
+ * v1 uses `motebit-jcs-ed25519-b64-v1` — same suite as execution receipts and
62
+ * other motebit-internal signed artifacts. Skills are NOT W3C `eddsa-jcs-2022`
63
+ * DataIntegrityProof artifacts; that suite is reserved for credentials,
64
+ * identity files, and presentations that need third-party W3C interop. Skills
65
+ * install and verify locally on motebit runtimes, so they use the simpler
66
+ * concat-bytes recipe consistent with the rest of the internal artifact
67
+ * surface. Future suites (incl. PQ) are registry additions per
68
+ * `architecture_cryptosuite_agility`.
69
+ */
70
+ export interface SkillSignature {
71
+ /** Cryptosuite discriminator. Verifiers reject unknown values fail-closed. */
72
+ suite: SuiteId;
73
+ /** Hex-encoded Ed25519 public key (32 bytes → 64 lowercase hex chars). */
74
+ public_key: string;
75
+ /** Base64url-encoded Ed25519 signature over the canonical bytes. */
76
+ value: string;
77
+ }
78
+ /**
79
+ * Free-form display metadata per agentskills.io.
80
+ *
81
+ * `author` is a presentation field — NOT cryptographically verified. The
82
+ * cryptographic author lives at `motebit.signature.public_key`. SDKs SHOULD
83
+ * lint-warn (not reject) when a `did:key`-shaped value here disagrees with
84
+ * the signature key. See spec/skills-v1.md §3.1.
85
+ */
86
+ export interface SkillManifestMetadata {
87
+ /** Free-form display string. Examples: `"Jane Doe"`, `"@janedoe"`, `"did:key:z6Mk..."`. */
88
+ author?: string;
89
+ /** Free-form category for UI grouping. Never load-bearing. */
90
+ category?: string;
91
+ /** Free-form tags for UI filtering. */
92
+ tags?: string[];
93
+ /**
94
+ * Per-skill configuration values. Keys and shapes are skill-defined; the
95
+ * runtime injects them via `skills.config.<key>` per agentskills.io
96
+ * conventions.
97
+ */
98
+ config?: Record<string, unknown>;
99
+ }
100
+ /**
101
+ * The motebit-namespaced extension block.
102
+ *
103
+ * Non-motebit agentskills.io runtimes ignore this entire object. Only
104
+ * `spec_version` is required — the rest defaults per spec/skills-v1.md §3.1
105
+ * (sensitivity → `"none"`, hardware_attestation → `{ required: false,
106
+ * minimum_score: 0 }`, signature absent → unsigned skill).
107
+ */
108
+ export interface SkillManifestMotebit {
109
+ /** Spec version. v1: `"1.0"`. Gates compatibility for future bumps. */
110
+ spec_version: "1.0";
111
+ /** Sensitivity tier. Defaults to `"none"` if undeclared. */
112
+ sensitivity?: SkillSensitivity;
113
+ /** Hardware-attestation gate. Defaults to `{ required: false, minimum_score: 0 }`. */
114
+ hardware_attestation?: SkillHardwareAttestationGate;
115
+ /** Cryptographic signature. Absent = unsigned skill (NEVER auto-loaded by selector). */
116
+ signature?: SkillSignature;
117
+ }
118
+ /**
119
+ * The full parsed SKILL.md frontmatter.
120
+ *
121
+ * Wire format for skills exchanged over network or registry boundaries.
122
+ * Defaults for optional fields are applied by the parser (BSL
123
+ * @motebit/skills); the protocol type matches the literal JSON shape with
124
+ * optionals where the spec marks them optional.
125
+ */
126
+ export interface SkillManifest {
127
+ /** Globally unique slug within an installation: `[a-z0-9-]+`. */
128
+ name: string;
129
+ /** One-line description. Read by the loader to decide skill relevance. */
130
+ description: string;
131
+ /** SemVer string. */
132
+ version: string;
133
+ /** OS gate. Empty/omitted = all platforms. */
134
+ platforms?: SkillPlatform[];
135
+ /** Free-form display metadata. */
136
+ metadata?: SkillManifestMetadata;
137
+ /** Motebit extension block. `spec_version` required; all other fields default. */
138
+ motebit: SkillManifestMotebit;
139
+ }
140
+ /**
141
+ * One file in the skill envelope's `files` list.
142
+ *
143
+ * Each entry pins a relative path to its hex-encoded SHA-256 hash. Install
144
+ * verifies envelope signature first, then re-derives every file hash from the
145
+ * unpacked tree and asserts equality. Any mismatch aborts install with no
146
+ * partial state (spec/skills-v1.md §6).
147
+ */
148
+ export interface SkillEnvelopeFile {
149
+ /** Path relative to the skill directory (e.g., `"scripts/run.sh"`). */
150
+ path: string;
151
+ /** Hex-encoded SHA-256 hash of the file bytes (lowercase, no `0x` prefix). */
152
+ hash: string;
153
+ }
154
+ /**
155
+ * Compact identity reference embedded in the envelope for indexing.
156
+ */
157
+ export interface SkillEnvelopeSkillRef {
158
+ /** Skill name (matches `SkillManifest.name`). */
159
+ name: string;
160
+ /** Skill version (matches `SkillManifest.version`). */
161
+ version: string;
162
+ /**
163
+ * Hex-encoded SHA-256 over `JCS(manifest) || 0x0A || lf_body`. Sibling to
164
+ * the `body_hash` field but covers the manifest as well — installers use
165
+ * this as the content-addressed identifier for the skill version.
166
+ */
167
+ content_hash: string;
168
+ }
169
+ /**
170
+ * Content-addressed signed wrapper for skill distribution and install.
171
+ *
172
+ * The envelope's `signature.value` is computed over JCS-canonicalized
173
+ * envelope bytes with `signature.value` removed (sibling to the manifest
174
+ * scheme in §5.1). Installers verify the envelope signature, then re-derive
175
+ * `body_hash` and every `files[].hash` from the unpacked tree.
176
+ */
177
+ export interface SkillEnvelope {
178
+ /** Spec version. v1: `"1.0"`. */
179
+ spec_version: "1.0";
180
+ /** Compact skill reference for indexing. */
181
+ skill: SkillEnvelopeSkillRef;
182
+ /** Full parsed manifest (the same object that is the source of truth in SKILL.md). */
183
+ manifest: SkillManifest;
184
+ /** Hex-encoded SHA-256 of the LF-normalized body bytes. */
185
+ body_hash: string;
186
+ /** Pinned hashes of every file in the skill directory beyond SKILL.md and skill-envelope.json. */
187
+ files: SkillEnvelopeFile[];
188
+ /** Envelope signature — same suite as the manifest signature. */
189
+ signature: SkillSignature;
190
+ }
191
+ /**
192
+ * Per-skill audit payload emitted by the runtime when the `SkillSelector`
193
+ * pulls a skill body into the agent's system context. One event per
194
+ * selected skill per turn, written to the agent's execution ledger as
195
+ * `EventType.SkillLoaded` (spec/skills-v1.md §7.4).
196
+ *
197
+ * The audit trail lets a user prove later: "the obsidian skill ran on
198
+ * date X with this exact signature value at session sensitivity Y." The
199
+ * `skill_signature` field is the envelope's `signature.value` — a
200
+ * content-addressed pointer to the exact bytes injected, recoverable by
201
+ * looking up the installed skill at `~/.motebit/skills/<name>/`.
202
+ *
203
+ * Wire-level event-envelope (timestamp, event_id, motebit_id) lives at
204
+ * `EventLogEntry`; the per-skill detail is here.
205
+ */
206
+ export interface SkillLoadPayload {
207
+ /** Composite identifier `"name@version"` — convenient for log queries. */
208
+ skill_id: string;
209
+ /** Skill slug (matches `SkillManifest.name`). */
210
+ skill_name: string;
211
+ /** Skill SemVer (matches `SkillManifest.version`). */
212
+ skill_version: string;
213
+ /**
214
+ * Base64url-encoded envelope signature value. Pins the audit entry to
215
+ * the exact bytes that were on disk at load time — re-signing the skill
216
+ * (e.g., via `pnpm --filter @motebit/skills build-reference-skill`)
217
+ * produces a different value, so a stale ledger entry whose signature
218
+ * doesn't resolve in the current registry is itself a useful audit
219
+ * signal. Empty string when the manifest is `trusted_unsigned` (operator-
220
+ * attested but no cryptographic signature exists to record).
221
+ */
222
+ skill_signature: string;
223
+ /** Provenance status at load time. Display-grade copy of `SkillProvenanceStatus`. */
224
+ provenance: "verified" | "trusted_unsigned";
225
+ /** BM25 relevance score against the user's turn. Higher = more relevant. */
226
+ score: number;
227
+ /**
228
+ * Run identifier the load is keyed to. Matches the `runId` passed to
229
+ * `runtime.sendMessage` / `sendMessageStreaming` — pairs every skill
230
+ * load with the turn that triggered it. Optional because the runtime
231
+ * may emit loads outside an explicit run context (e.g., proactive
232
+ * cycles, future).
233
+ */
234
+ run_id?: string;
235
+ /** Session sensitivity tier in effect when the skill loaded. */
236
+ session_sensitivity: SkillSensitivity;
237
+ }
238
+ /**
239
+ * One row in the relay-hosted skills registry. Returned in `discover`
240
+ * listings; one entry per submitted skill version.
241
+ *
242
+ * The display fields (`description`, `sensitivity`, `platforms`,
243
+ * `category`, `tags`, `author`) are denormalized from the embedded
244
+ * manifest so the discover query does not need to round-trip the full
245
+ * bundle for each row.
246
+ *
247
+ * `submitter_motebit_id` is canonical: derived from `envelope.signature.public_key`
248
+ * by the relay, never user-provided. Submitter spoofing is impossible.
249
+ */
250
+ export interface SkillRegistryEntry {
251
+ /** `did:key` derived from `envelope.signature.public_key`. */
252
+ submitter_motebit_id: string;
253
+ /** Slug. Matches `manifest.name`. */
254
+ name: string;
255
+ /** SemVer. Matches `manifest.version`. */
256
+ version: string;
257
+ /** 64 hex chars; SHA-256 over `JCS(manifest) || 0x0A || lf_body`. */
258
+ content_hash: string;
259
+ description: string;
260
+ sensitivity: SkillSensitivity;
261
+ platforms?: SkillPlatform[];
262
+ category?: string;
263
+ tags?: string[];
264
+ author?: string;
265
+ /** 64 hex chars; mirrors `envelope.signature.public_key`. */
266
+ signature_public_key: string;
267
+ /** True iff the submitter is in the relay's featured-submitters allowlist. */
268
+ featured: boolean;
269
+ /** Unix ms. */
270
+ submitted_at: number;
271
+ }
272
+ /**
273
+ * Body of `POST /api/v1/skills/submit`. Carries the full signed
274
+ * envelope plus body and aux files as base64 strings. The relay
275
+ * re-derives `body_hash` and per-file hashes and asserts they match
276
+ * the envelope before persisting.
277
+ *
278
+ * The submitter is NOT named in this payload — the relay computes it
279
+ * canonically from `envelope.signature.public_key`.
280
+ */
281
+ export interface SkillRegistrySubmitRequest {
282
+ envelope: SkillEnvelope;
283
+ /** Base64-encoded LF-normalized SKILL.md body bytes. */
284
+ body: string;
285
+ /** Base64-encoded auxiliary file bytes. Keys are the same paths as `envelope.files[].path`. */
286
+ files?: Record<string, string>;
287
+ }
288
+ /**
289
+ * Response body of `POST /api/v1/skills/submit` on success. Returns
290
+ * the canonical addressing tuple plus the relay-computed
291
+ * `submitter_motebit_id` so the caller can confirm the relay derived
292
+ * the same `did:key` it expected.
293
+ */
294
+ export interface SkillRegistrySubmitResponse {
295
+ /** `<submitter_motebit_id>/<name>@<version>`. */
296
+ skill_id: string;
297
+ submitter_motebit_id: string;
298
+ name: string;
299
+ version: string;
300
+ content_hash: string;
301
+ submitted_at: number;
302
+ }
303
+ /**
304
+ * Response body of `GET /api/v1/skills/discover`. A paginated page of
305
+ * `SkillRegistryEntry` rows plus pagination metadata.
306
+ */
307
+ export interface SkillRegistryListing {
308
+ entries: SkillRegistryEntry[];
309
+ /** Total rows matching the filter — not just this page. */
310
+ total: number;
311
+ /** Page size used (default 50, max 200). */
312
+ limit: number;
313
+ /** Page offset used (default 0). */
314
+ offset: number;
315
+ }
316
+ /**
317
+ * Response body of `GET /api/v1/skills/:submitter/:name/:version`.
318
+ * Carries the full signed envelope, body, and any auxiliary files as
319
+ * base64 strings. Same shape as `SkillRegistrySubmitRequest` plus a
320
+ * `submitter_motebit_id` echo so consumers can confirm the resolved
321
+ * address before re-verifying.
322
+ */
323
+ export interface SkillRegistryBundle {
324
+ /** Echoed from the route param; equals `publicKeyToDidKey(envelope.signature.public_key)`. */
325
+ submitter_motebit_id: string;
326
+ envelope: SkillEnvelope;
327
+ /** Base64-encoded LF-normalized SKILL.md body bytes. */
328
+ body: string;
329
+ /** Base64-encoded auxiliary file bytes. */
330
+ files?: Record<string, string>;
331
+ submitted_at: number;
332
+ featured: boolean;
333
+ }
334
+ //# sourceMappingURL=skills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../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ED;;;;;GAKG;AACH,MAAM,WAAW,2BAA2B;IAC1C,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,8FAA8F;IAC9F,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,aAAa,CAAC;IACxB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACnB"}
package/dist/skills.js ADDED
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Skill manifest + envelope types — motebit/skills@1.0.
3
+ *
4
+ * Permissive floor (Apache-2.0): these types define the interoperable wire
5
+ * format for a motebit skill — agentskills.io-compatible frontmatter with
6
+ * motebit-namespaced extensions for cryptographic provenance, sensitivity-
7
+ * tiered loading, and hardware-attestation gating. See spec/skills-v1.md.
8
+ *
9
+ * The parsed frontmatter object (`SkillManifest`) is the wire artifact; the
10
+ * YAML in `SKILL.md` is the on-disk encoding only. JSON-over-wire and the
11
+ * `skill-envelope.json` wrapper both serialize to the types declared here.
12
+ *
13
+ * Audience-distinct from credentials (peer-issued reputation/trust attestations,
14
+ * spec/credential-v1.md) and execution receipts (per-invocation audit,
15
+ * spec/execution-ledger-v1.md). Phase 3 of skills-v1 will emit
16
+ * `SkillLoadReceipt` entries into the execution ledger; that schema lives in
17
+ * the ledger module, not here.
18
+ *
19
+ * Layer purity (per packages/protocol/CLAUDE.md): types only. Canonicalization
20
+ * and signature verification live in @motebit/crypto. Frontmatter parsing,
21
+ * registry, selector, and trust gate live in the BSL @motebit/skills package.
22
+ */
23
+ /** Frozen list of sensitivity tiers in increasing-restriction order. */
24
+ export const SKILL_SENSITIVITY_TIERS = Object.freeze([
25
+ "none",
26
+ "personal",
27
+ "medical",
28
+ "financial",
29
+ "secret",
30
+ ]);
31
+ /** Tiers that are auto-loadable when session tier permits. */
32
+ export const SKILL_AUTO_LOADABLE_TIERS = Object.freeze([
33
+ "none",
34
+ "personal",
35
+ ]);
36
+ /** Frozen list of recognized platform identifiers. */
37
+ export const SKILL_PLATFORMS = Object.freeze([
38
+ "macos",
39
+ "linux",
40
+ "windows",
41
+ "ios",
42
+ "android",
43
+ ]);
44
+ //# sourceMappingURL=skills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.js","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAgBH,wEAAwE;AACxE,MAAM,CAAC,MAAM,uBAAuB,GAAgC,MAAM,CAAC,MAAM,CAAC;IAChF,MAAM;IACN,UAAU;IACV,SAAS;IACT,WAAW;IACX,QAAQ;CACT,CAAC,CAAC;AAEH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,yBAAyB,GAAgC,MAAM,CAAC,MAAM,CAAC;IAClF,MAAM;IACN,UAAU;CACX,CAAC,CAAC;AAOH,sDAAsD;AACtD,MAAM,CAAC,MAAM,eAAe,GAA6B,MAAM,CAAC,MAAM,CAAC;IACrE,OAAO;IACP,OAAO;IACP,SAAS;IACT,KAAK;IACL,SAAS;CACV,CAAC,CAAC"}
@@ -30,5 +30,20 @@ export declare function trustMultiply(a: number, b: number): number;
30
30
  export declare function composeTrustChain(scores: number[]): number;
31
31
  /** Fold parallel route scores with ⊕. No routes → 0.0 (identity). */
32
32
  export declare function joinParallelRoutes(scores: number[]): number;
33
+ export declare const REFERENCE_TRUST_THRESHOLDS: TrustTransitionThresholds;
34
+ /**
35
+ * @deprecated since 1.0.1, removed in 2.0.0. Use {@link REFERENCE_TRUST_THRESHOLDS} instead.
36
+ *
37
+ * Reason: the `DEFAULT_` prefix read as "THE value every motebit
38
+ * implementation uses," but trust-transition thresholds are motebit
39
+ * product tuning — they govern promotion and demotion policy, not
40
+ * protocol interop. A third-party motebit implementation may choose
41
+ * different thresholds and still interoperate correctly (the semiring
42
+ * algebra above is the interop contract). The `REFERENCE_` prefix
43
+ * signals "motebit's reference-implementation default; implementers
44
+ * MAY choose their own values." Rename-plus-deprecate so the naming
45
+ * correction ships without a breaking change; the old export is
46
+ * removed at 2.0.0.
47
+ */
33
48
  export declare const DEFAULT_TRUST_THRESHOLDS: TrustTransitionThresholds;
34
49
  //# sourceMappingURL=trust-algebra.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"trust-algebra.d.ts","sourceRoot":"","sources":["../src/trust-algebra.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAI7E;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAMrD,CAAC;AAEF,kDAAkD;AAClD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,GAAG,MAAM,CAEzE;AAED,yDAAyD;AACzD,eAAO,MAAM,UAAU,IAAI,CAAC;AAE5B,qCAAqC;AACrC,eAAO,MAAM,SAAS,IAAI,CAAC;AAE3B,+CAA+C;AAC/C,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,0CA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AM,wBAAwB,EAAE,yBAAsD,CAAC"}
@@ -46,8 +46,23 @@ export function composeTrustChain(scores) {
46
46
  export function joinParallelRoutes(scores) {
47
47
  return scores.reduce(trustAdd, TRUST_ZERO);
48
48
  }
49
- // ── Default Thresholds ─────────────────────────────────────────────
50
- export const DEFAULT_TRUST_THRESHOLDS = {
49
+ // ── Reference Thresholds ───────────────────────────────────────────
50
+ //
51
+ // These values are the motebit reference implementation's starting
52
+ // point for agent-trust transitions — they prioritize, not compute.
53
+ // The semiring algebra above (`trustAdd`, `trustMultiply`,
54
+ // `TRUST_LEVEL_SCORES`, `TRUST_ZERO`, `TRUST_ONE`) IS protocol law —
55
+ // two interoperating motebit implementations must compute trust the
56
+ // same way. Transition thresholds are NOT protocol law — a federated
57
+ // implementation may choose stricter or looser values and still
58
+ // exchange trust scores correctly.
59
+ //
60
+ // The `REFERENCE_` prefix is the signal: "this is A reference default,
61
+ // not THE mandated value." Exported from the permissive-floor package
62
+ // so third-party integrators can adopt motebit's exact defaults if
63
+ // they want to (one import, zero reinvention) — renaming alone
64
+ // clarifies the role.
65
+ export const REFERENCE_TRUST_THRESHOLDS = {
51
66
  promoteToVerified_minTasks: 5,
52
67
  promoteToVerified_minRate: 0.8,
53
68
  promoteToTrusted_minTasks: 20,
@@ -55,4 +70,19 @@ export const DEFAULT_TRUST_THRESHOLDS = {
55
70
  demote_belowRate: 0.5,
56
71
  demote_minTasks: 3,
57
72
  };
73
+ /**
74
+ * @deprecated since 1.0.1, removed in 2.0.0. Use {@link REFERENCE_TRUST_THRESHOLDS} instead.
75
+ *
76
+ * Reason: the `DEFAULT_` prefix read as "THE value every motebit
77
+ * implementation uses," but trust-transition thresholds are motebit
78
+ * product tuning — they govern promotion and demotion policy, not
79
+ * protocol interop. A third-party motebit implementation may choose
80
+ * different thresholds and still interoperate correctly (the semiring
81
+ * algebra above is the interop contract). The `REFERENCE_` prefix
82
+ * signals "motebit's reference-implementation default; implementers
83
+ * MAY choose their own values." Rename-plus-deprecate so the naming
84
+ * correction ships without a breaking change; the old export is
85
+ * removed at 2.0.0.
86
+ */
87
+ export const DEFAULT_TRUST_THRESHOLDS = REFERENCE_TRUST_THRESHOLDS;
58
88
  //# sourceMappingURL=trust-algebra.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"trust-algebra.js","sourceRoot":"","sources":["../src/trust-algebra.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,uEAAuE;AAEvE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA2B;IACxD,OAAO,EAAE,GAAG;IACZ,aAAa,EAAE,GAAG;IAClB,QAAQ,EAAE,GAAG;IACb,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,GAAG;CACb,CAAC;AAEF,kDAAkD;AAClD,MAAM,UAAU,iBAAiB,CAAC,KAA+B;IAC/D,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC;AAC1C,CAAC;AAED,yDAAyD;AACzD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAE5B,qCAAqC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC;AAE3B,+CAA+C;AAC/C,MAAM,UAAU,QAAQ,CAAC,CAAS,EAAE,CAAS;IAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxB,CAAC;AAED,0CAA0C;AAC1C,MAAM,UAAU,aAAa,CAAC,CAAS,EAAE,CAAS;IAChD,OAAO,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,iBAAiB,CAAC,MAAgB;IAChD,OAAO,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;AACjD,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,kBAAkB,CAAC,MAAgB;IACjD,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAC7C,CAAC;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M,CAAC,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAC7C,CAAC;AAED,sEAAsE;AACtE,EAAE;AACF,mEAAmE;AACnE,oEAAoE;AACpE,2DAA2D;AAC3D,qEAAqE;AACrE,oEAAoE;AACpE,qEAAqE;AACrE,gEAAgE;AAChE,mCAAmC;AACnC,EAAE;AACF,uEAAuE;AACvE,sEAAsE;AACtE,mEAAmE;AACnE,+DAA+D;AAC/D,sBAAsB;AAEtB,MAAM,CAAC,MAAM,0BAA0B,GAA8B;IACnE,0BAA0B,EAAE,CAAC;IAC7B,yBAAyB,EAAE,GAAG;IAC9B,yBAAyB,EAAE,EAAE;IAC7B,wBAAwB,EAAE,GAAG;IAC7B,gBAAgB,EAAE,GAAG;IACrB,eAAe,EAAE,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAA8B,0BAA0B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motebit/protocol",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Motebit protocol — identity, receipts, credentials, delegation, settlement, and trust algebra for sovereign AI agents. Types, semirings, routing primitives. Apache-2.0, zero dependencies.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",