@agenticprimitives/service-host 0.0.0-alpha.1 → 0.0.0-alpha.10

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.
Files changed (61) hide show
  1. package/dist/cloudflare/index.d.ts +35 -6
  2. package/dist/cloudflare/index.d.ts.map +1 -1
  3. package/dist/cloudflare/index.js +53 -7
  4. package/dist/cloudflare/index.js.map +1 -1
  5. package/dist/host.d.ts +50 -0
  6. package/dist/host.d.ts.map +1 -0
  7. package/dist/host.js +36 -0
  8. package/dist/host.js.map +1 -0
  9. package/dist/index.d.ts +22 -3
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +12 -2
  12. package/dist/index.js.map +1 -1
  13. package/dist/provenance-sink.d.ts +48 -0
  14. package/dist/provenance-sink.d.ts.map +1 -0
  15. package/dist/provenance-sink.js +98 -0
  16. package/dist/provenance-sink.js.map +1 -0
  17. package/dist/routes.d.ts +64 -0
  18. package/dist/routes.d.ts.map +1 -0
  19. package/dist/routes.js +186 -0
  20. package/dist/routes.js.map +1 -0
  21. package/dist/run-store.d.ts +21 -1
  22. package/dist/run-store.d.ts.map +1 -1
  23. package/dist/run-store.js +18 -0
  24. package/dist/run-store.js.map +1 -1
  25. package/dist/run.d.ts +110 -0
  26. package/dist/run.d.ts.map +1 -0
  27. package/dist/run.js +135 -0
  28. package/dist/run.js.map +1 -0
  29. package/dist/storage.d.ts +58 -1
  30. package/dist/storage.d.ts.map +1 -1
  31. package/dist/storage.js +102 -2
  32. package/dist/storage.js.map +1 -1
  33. package/dist/surface.d.ts +27 -0
  34. package/dist/surface.d.ts.map +1 -0
  35. package/dist/surface.js +76 -0
  36. package/dist/surface.js.map +1 -0
  37. package/dist/tools/external.d.ts +28 -0
  38. package/dist/tools/external.d.ts.map +1 -0
  39. package/dist/tools/external.js +75 -0
  40. package/dist/tools/external.js.map +1 -0
  41. package/dist/tools/find.d.ts +39 -0
  42. package/dist/tools/find.d.ts.map +1 -0
  43. package/dist/tools/find.js +95 -0
  44. package/dist/tools/find.js.map +1 -0
  45. package/dist/tools/index.d.ts +8 -0
  46. package/dist/tools/index.d.ts.map +1 -0
  47. package/dist/tools/index.js +5 -0
  48. package/dist/tools/index.js.map +1 -0
  49. package/dist/tools/inspect.d.ts +6 -0
  50. package/dist/tools/inspect.d.ts.map +1 -0
  51. package/dist/tools/inspect.js +43 -0
  52. package/dist/tools/inspect.js.map +1 -0
  53. package/dist/tools/invoke.d.ts +59 -0
  54. package/dist/tools/invoke.d.ts.map +1 -0
  55. package/dist/tools/invoke.js +92 -0
  56. package/dist/tools/invoke.js.map +1 -0
  57. package/dist/wire-admission.d.ts +52 -0
  58. package/dist/wire-admission.d.ts.map +1 -0
  59. package/dist/wire-admission.js +49 -0
  60. package/dist/wire-admission.js.map +1 -0
  61. package/package.json +7 -4
@@ -1,14 +1,43 @@
1
- import { type RunStorage } from '../storage.js';
1
+ import { type RunStorage, type RunStorageOptions } from '../storage.js';
2
2
  import { type RunStore } from '../run-store.js';
3
3
  /** The path a DO answers the store on. The Worker-side client posts here; a DO's `fetch` routes it to `handle`. */
4
4
  export declare const RUN_STORE_PATH = "/internal/harness-run/";
5
- /** Inside the agent's Durable Object: the checkpoint + progress storage over `state.storage`. */
6
- export declare function durableObjectRunStorage(storage: DurableObjectStorage): RunStorage;
7
- /** The DO-side route: `fetch(request)` → `handleRunStoreRequest(request, runs)` for any `/internal/harness-run/<op>`.
8
- * Returns `null` when the request is not a run-store call, so the DO's own routing continues. The in-Worker marker that
9
- * gates this path is the app's (spec 341 §7) and is checked BEFORE this is called. */
5
+ /** The ops the store answers; anything else under the path is the host's own. */
6
+ export declare const RUN_STORE_OPS: ReadonlySet<string>;
7
+ /** Inside the agent's Durable Object: checkpoint + progress + record + counters + assertion storage over `state.storage`. */
8
+ export declare function durableObjectRunStorage(storage: DurableObjectStorage, options?: RunStorageOptions): RunStorage;
9
+ /** The DO-side route: `fetch(request)` → `handleRunStoreRequest(request, runs)` for any `/internal/harness-run/<op>` the
10
+ * store owns. Returns `null` for another path or an op the host owns, so the DO's own routing continues. The in-Worker
11
+ * marker that gates this path is the app's (spec 341 §7) and is checked BEFORE this is called. */
10
12
  export declare function handleRunStoreRequest(request: Request, runs: RunStorage): Promise<Response | null>;
11
13
  /** In the Worker: the `RunStore` over the agent's own stub, one DO per agent (`idFromName(agent)`). `headers` supplies
12
14
  * the in-Worker marker the DO requires — the app's secret, read through a function so it is never captured here. */
13
15
  export declare function durableObjectRunStore(ns: DurableObjectNamespace, headers: () => Record<string, string>): RunStore;
16
+ /**
17
+ * THE RUN DO — spec 433 W1 step 2 (census §2): the Durable Object core every service agent's runs live in. One object per
18
+ * agent (`idFromName(agent)`), holding the checkpoint, the progress lines, the run record (a week), the day's counters and
19
+ * the assertion ledger — all serving-plane, all a rebuild (ADR-0055). The record of record is the agent's vault.
20
+ *
21
+ * A host SUBCLASSES it: the runtime's task DO adds its own routes (triggers, routing, the search index on save) and calls
22
+ * `super.fetch` for everything under `/internal/harness-run/` it does not own. Two things the subclass supplies:
23
+ * · `isInternalCall(request)` — the in-Worker marker check (spec 341 §7): the marker is the app's secret, so the base
24
+ * class cannot know it and refuses every store call until the subclass says who is inside;
25
+ * · `runStorageOptions()` — retention and the hooks (what to index when a checkpoint or record lands).
26
+ * The class is exported, never a binding name: `wrangler.toml` binds it under whatever name the app chooses.
27
+ */
28
+ export declare abstract class HarnessRunDO<Env = unknown> {
29
+ protected readonly state: DurableObjectState;
30
+ protected readonly env: Env;
31
+ constructor(state: DurableObjectState, env: Env);
32
+ /** The in-Worker marker check. Fail closed: the base class admits nothing on its own. */
33
+ protected abstract isInternalCall(request: Request): boolean;
34
+ /** Retention and hooks; override to index what lands. */
35
+ protected runStorageOptions(): RunStorageOptions;
36
+ private _runs;
37
+ /** The storage over this object's `state.storage`, built once. */
38
+ protected get runs(): RunStorage;
39
+ /** Answers the store's ops under `/internal/harness-run/`; 404 for anything else, so a subclass routes its own first
40
+ * and delegates here last. */
41
+ fetch(request: Request): Promise<Response>;
42
+ }
14
43
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cloudflare/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAgB,KAAK,QAAQ,EAAmB,MAAM,iBAAiB,CAAC;AAG/E,mHAAmH;AACnH,eAAO,MAAM,cAAc,2BAA2B,CAAC;AAEvD,iGAAiG;AACjG,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,oBAAoB,GAAG,UAAU,CAEjF;AAED;;uFAEuF;AACvF,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAOxG;AAED;qHACqH;AACrH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,QAAQ,CAUjH"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cloudflare/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAc,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAgB,KAAK,QAAQ,EAAmB,MAAM,iBAAiB,CAAC;AAG/E,mHAAmH;AACnH,eAAO,MAAM,cAAc,2BAA2B,CAAC;AAEvD,iFAAiF;AACjF,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,CAE5C,CAAC;AAEH,6HAA6H;AAC7H,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,UAAU,CAE9G;AAED;;mGAEmG;AACnG,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAQxG;AAED;qHACqH;AACrH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,QAAQ,CAUjH;AAED;;;;;;;;;;;GAWG;AACH,8BAAsB,YAAY,CAAC,GAAG,GAAG,OAAO;IAClC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,kBAAkB;IAAE,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG;gBAAtD,KAAK,EAAE,kBAAkB,EAAqB,GAAG,EAAE,GAAG;IAErF,yFAAyF;IACzF,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;IAE5D,yDAAyD;IACzD,SAAS,CAAC,iBAAiB,IAAI,iBAAiB;IAEhD,OAAO,CAAC,KAAK,CAA2B;IACxC,kEAAkE;IAClE,SAAS,KAAK,IAAI,IAAI,UAAU,CAG/B;IAED;mCAC+B;IACzB,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;CAOjD"}
@@ -6,19 +6,25 @@ import { runStorage } from '../storage.js';
6
6
  import { runStoreOver } from '../run-store.js';
7
7
  /** The path a DO answers the store on. The Worker-side client posts here; a DO's `fetch` routes it to `handle`. */
8
8
  export const RUN_STORE_PATH = '/internal/harness-run/';
9
- /** Inside the agent's Durable Object: the checkpoint + progress storage over `state.storage`. */
10
- export function durableObjectRunStorage(storage) {
11
- return runStorage(storage);
9
+ /** The ops the store answers; anything else under the path is the host's own. */
10
+ export const RUN_STORE_OPS = new Set([
11
+ 'save', 'load', 'drop', 'list', 'progress-append', 'progress-read', 'record-put', 'record-get', 'record-list', 'budget-ask', 'budget-get', 'assertion-claim',
12
+ ]);
13
+ /** Inside the agent's Durable Object: checkpoint + progress + record + counters + assertion storage over `state.storage`. */
14
+ export function durableObjectRunStorage(storage, options) {
15
+ return runStorage(storage, options);
12
16
  }
13
- /** The DO-side route: `fetch(request)` → `handleRunStoreRequest(request, runs)` for any `/internal/harness-run/<op>`.
14
- * Returns `null` when the request is not a run-store call, so the DO's own routing continues. The in-Worker marker that
15
- * gates this path is the app's (spec 341 §7) and is checked BEFORE this is called. */
17
+ /** The DO-side route: `fetch(request)` → `handleRunStoreRequest(request, runs)` for any `/internal/harness-run/<op>` the
18
+ * store owns. Returns `null` for another path or an op the host owns, so the DO's own routing continues. The in-Worker
19
+ * marker that gates this path is the app's (spec 341 §7) and is checked BEFORE this is called. */
16
20
  export async function handleRunStoreRequest(request, runs) {
17
21
  const url = new URL(request.url);
18
22
  if (!url.pathname.startsWith(RUN_STORE_PATH))
19
23
  return null;
20
24
  const op = url.pathname.slice(RUN_STORE_PATH.length);
21
- const body = (await request.json().catch(() => null));
25
+ if (!RUN_STORE_OPS.has(op))
26
+ return null;
27
+ const body = (await request.clone().json().catch(() => null));
22
28
  const r = await runs.handle(op, body);
23
29
  return r.ok ? Response.json(r) : Response.json({ ok: false, error: r.error }, { status: r.status });
24
30
  }
@@ -36,4 +42,44 @@ export function durableObjectRunStore(ns, headers) {
36
42
  return out;
37
43
  });
38
44
  }
45
+ /**
46
+ * THE RUN DO — spec 433 W1 step 2 (census §2): the Durable Object core every service agent's runs live in. One object per
47
+ * agent (`idFromName(agent)`), holding the checkpoint, the progress lines, the run record (a week), the day's counters and
48
+ * the assertion ledger — all serving-plane, all a rebuild (ADR-0055). The record of record is the agent's vault.
49
+ *
50
+ * A host SUBCLASSES it: the runtime's task DO adds its own routes (triggers, routing, the search index on save) and calls
51
+ * `super.fetch` for everything under `/internal/harness-run/` it does not own. Two things the subclass supplies:
52
+ * · `isInternalCall(request)` — the in-Worker marker check (spec 341 §7): the marker is the app's secret, so the base
53
+ * class cannot know it and refuses every store call until the subclass says who is inside;
54
+ * · `runStorageOptions()` — retention and the hooks (what to index when a checkpoint or record lands).
55
+ * The class is exported, never a binding name: `wrangler.toml` binds it under whatever name the app chooses.
56
+ */
57
+ export class HarnessRunDO {
58
+ state;
59
+ env;
60
+ constructor(state, env) {
61
+ this.state = state;
62
+ this.env = env;
63
+ }
64
+ /** Retention and hooks; override to index what lands. */
65
+ runStorageOptions() { return {}; }
66
+ _runs = null;
67
+ /** The storage over this object's `state.storage`, built once. */
68
+ get runs() {
69
+ if (!this._runs)
70
+ this._runs = runStorage(this.state.storage, this.runStorageOptions());
71
+ return this._runs;
72
+ }
73
+ /** Answers the store's ops under `/internal/harness-run/`; 404 for anything else, so a subclass routes its own first
74
+ * and delegates here last. */
75
+ async fetch(request) {
76
+ const url = new URL(request.url);
77
+ if (!url.pathname.startsWith(RUN_STORE_PATH))
78
+ return Response.json({ ok: false, error: 'not found' }, { status: 404 });
79
+ if (!this.isInternalCall(request))
80
+ return Response.json({ ok: false, error: 'internal op — not authorized' }, { status: 403 });
81
+ const handled = await handleRunStoreRequest(request, this.runs);
82
+ return handled ?? Response.json({ ok: false, error: `unknown harness-run op: ${url.pathname.slice(RUN_STORE_PATH.length)}` }, { status: 404 });
83
+ }
84
+ }
39
85
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cloudflare/index.ts"],"names":[],"mappings":"AAAA,0HAA0H;AAC1H,wHAAwH;AACxH,0FAA0F;AAC1F,mDAAmD;AACnD,OAAO,EAAE,UAAU,EAAmB,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAkC,MAAM,iBAAiB,CAAC;AAG/E,mHAAmH;AACnH,MAAM,CAAC,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAEvD,iGAAiG;AACjG,MAAM,UAAU,uBAAuB,CAAC,OAA6B;IACnE,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAED;;uFAEuF;AACvF,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAgB,EAAE,IAAgB;IAC5E,MAAM,GAAG,GAAG,I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,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACvH,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;YAAE,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,8BAA8B,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QAC/H,MAAM,OAAO,GAAG,MAAM,qBAAqB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAChE,OAAO,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,2BAA2B,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IACjJ,CAAC;CACF"}
package/dist/host.d.ts ADDED
@@ -0,0 +1,50 @@
1
+ import type { Address } from '@agenticprimitives/types';
2
+ import type { ToolSpec, ToolInvoker, Planner, OrchestrationPorts } from '@agenticprimitives/orchestration';
3
+ import type { PlaybookView } from '@agenticprimitives/harness';
4
+ import type { Principal, StandardTaskStore } from '@agenticprimitives/a2a/standard';
5
+ import type { RunStore } from './run-store.js';
6
+ import { type AdmissionPorts, type AdmittedPrincipal } from './routes.js';
7
+ import { standardSurface } from './surface.js';
8
+ import type { TurnDeps } from './run.js';
9
+ import type { ProvenanceSinkDeps } from './provenance-sink.js';
10
+ export interface ServiceHostConfig {
11
+ /** The agent this host IS — read from the name's records by the app, never configured by hand twice. */
12
+ agent: Address;
13
+ /** The origin the surface is served at. */
14
+ origin: string;
15
+ /** The live card facts (name, description, skills from the definition, provider). */
16
+ card: Record<string, unknown>;
17
+ /** The playbook pinned by digest, loaded per request by the app (`loadPlaybook` through its record port), or fixed. */
18
+ playbook: (ctx: {
19
+ asker: AdmittedPrincipal;
20
+ }) => Promise<PlaybookView | null> | PlaybookView | null;
21
+ /** The tools this host offers before the playbook narrows them. */
22
+ tools: ReadonlyArray<ToolSpec>;
23
+ /** One invoker per tool id — the app's work; may depend on the asker (an engagement signs as them). */
24
+ invokers: (ctx: {
25
+ asker: AdmittedPrincipal;
26
+ }) => Readonly<Record<string, ToolInvoker>>;
27
+ /** The planner port; a deterministic service that only takes supplied plans may omit it. */
28
+ planner?: Planner;
29
+ /** Spec 350 — verifier · ladder · approvals · receipts · effects. */
30
+ ports?: Omit<OrchestrationPorts, 'events'>;
31
+ runStore: RunStore;
32
+ admission: AdmissionPorts;
33
+ /** The door's principal for `/api/a2a` (a wire-signed agent, a Home bearer). */
34
+ principal?: (request: Request) => Promise<Principal | null>;
35
+ /** A routed profile's forwarded credential, verified here as the receiver. */
36
+ verifyForwarded?: Parameters<typeof standardSurface>[0]['verifyForwarded'];
37
+ tasks?: StandardTaskStore;
38
+ provenance?: ProvenanceSinkDeps;
39
+ mayOversee?: (who: Address) => Promise<boolean>;
40
+ waitUntil?: (p: Promise<unknown>) => void;
41
+ /** The turn's words, composer, limits and clock. */
42
+ turn?: Pick<TurnDeps, 'say' | 'words' | 'maxSteps' | 'maxReplans' | 'now' | 'mandateRef' | 'newRunRef'>;
43
+ log?: (line: string) => void;
44
+ }
45
+ export interface ServiceHost {
46
+ /** The handler: `/health`, `/.well-known/agent-card.json`, `/api/a2a`, `/harness/*`; `null` for any other path. */
47
+ fetch(request: Request): Promise<Response | null>;
48
+ }
49
+ export declare function createServiceHost(config: ServiceHostConfig): ServiceHost;
50
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;A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AAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAC5D,8EAA8E;IAC9E,eAAe,CAAC,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;IAC3E,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC1C,oDAAoD;IACpD,IAAI,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,OAAO,GAAG,UAAU,GAAG,YAAY,GAAG,KAAK,GAAG,YAAY,GAAG,WAAW,CAAC,CAAC;IACxG,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,WAAW;IAC1B,mHAAmH;IACnH,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;CACnD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,WAAW,CA6BxE"}
package/dist/host.js ADDED
@@ -0,0 +1,36 @@
1
+ import { harnessRoutes } from './routes.js';
2
+ import { standardSurface } from './surface.js';
3
+ export function createServiceHost(config) {
4
+ const turnDeps = async (ctx) => ({
5
+ playbook: await config.playbook(ctx),
6
+ tools: config.tools,
7
+ invokers: config.invokers(ctx),
8
+ ...(config.planner ? { planner: config.planner } : {}),
9
+ ...(config.ports ? { ports: config.ports } : {}),
10
+ ...(config.log ? { log: config.log } : {}),
11
+ ...(config.turn ?? {}),
12
+ });
13
+ const surface = standardSurface({
14
+ agent: config.agent, card: config.card, origin: config.origin, runStore: config.runStore, turnDeps,
15
+ ...(config.principal ? { principal: config.principal } : {}), ...(config.admission.public ? { public: true } : {}),
16
+ ...(config.tasks ? { tasks: config.tasks } : {}), ...(config.verifyForwarded ? { verifyForwarded: config.verifyForwarded } : {}), ...(config.log ? { log: config.log } : {}),
17
+ });
18
+ const routes = {
19
+ agent: config.agent, admission: config.admission, runStore: config.runStore, turnDeps,
20
+ ...(config.provenance ? { provenance: config.provenance } : {}), ...(config.mayOversee ? { mayOversee: config.mayOversee } : {}),
21
+ ...(config.waitUntil ? { waitUntil: config.waitUntil } : {}), ...(config.log ? { log: config.log } : {}),
22
+ };
23
+ return {
24
+ async fetch(request) {
25
+ const path = new URL(request.url).pathname;
26
+ if (path === '/health')
27
+ return Response.json({ ok: true, agent: config.agent });
28
+ if (path === '/.well-known/agent-card.json')
29
+ return Response.json(surface.card());
30
+ if (path === '/api/a2a' || path.startsWith('/api/a2a/'))
31
+ return surface.handle(request);
32
+ return harnessRoutes(request, routes);
33
+ },
34
+ };
35
+ }
36
+ //# sourceMappingURL=host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAA+C,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAyC/C,MAAM,UAAU,iBAAiB,CAAC,MAAyB;IACzD,MAAM,QAAQ,GAAG,KAAK,EAAE,GAAiC,EAAuC,EAAE,CAAC,CAAC;QAClG,QAAQ,EAAE,MAAM,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QACpC,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC9B,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE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CHANGED
@@ -1,10 +1,29 @@
1
1
  export declare const PACKAGE_NAME: "@agenticprimitives/service-host";
2
- export declare const PACKAGE_STATUS: "w1-run-store";
2
+ export declare const PACKAGE_STATUS: "w1-host";
3
3
  export declare const SPEC_REF: "specs/433-service-apps-run-the-harness-service-host.md";
4
4
  export { mergeTurn, isExpired, expiryFor, liveRuns, completedStepsOf, canceledRecord, openRunOnThread, runStoreOver, AWAIT_WINDOW_MS, RUN_TTL_MS, } from './run-store.js';
5
5
  export type { HarnessRunCheckpointV1, SuspendedRunV1, SelectedOfferBindingV1, AwaitingKind, RunStore, RunStoreOp, RunStoreCall } from './run-store.js';
6
6
  export { toolWords, progressLine, PROGRESS_TTL_MS, PROGRESS_MAX_LINES } from './progress.js';
7
7
  export type { ProgressLineV1 } from './progress.js';
8
- export { runStorage, memoryRunKv, memoryRunStoreCall, RUN_KEY_PREFIX, PROGRESS_KEY_PREFIX } from './storage.js';
9
- export type { RunKv, RunStorage, RunStorageResult } from './storage.js';
8
+ export { runStorage, memoryRunKv, memoryRunStoreCall, RUN_KEY_PREFIX, PROGRESS_KEY_PREFIX, RECORD_KEY_PREFIX, BUDGET_KEY_PREFIX, ASSERTION_KEY_PREFIX, DEFAULT_RECORD_RETENTION_DAYS } from './storage.js';
9
+ export type { RunKv, RunStorage, RunStorageResult, RunStorageOptions, DayCountersV1, RunRecordListingV1 } from './storage.js';
10
+ export { runTurn, suppliedPlanner, defaultSay } from './run.js';
11
+ export type { AskReplyEnvelopeV1, TurnInput, TurnDeps, TurnOutcome, TurnCredentialV1 } from './run.js';
12
+ export { exportRunProvenance, provenanceGraphOf, provenanceJsonLdOf, provenanceProvNOf, provenanceViewOf, hasProvenanceRef, runAnchorRecordKey, runMeasuresRecordKey } from './provenance-sink.js';
13
+ export type { ProvenanceSinkDeps } from './provenance-sink.js';
14
+ export { admit, askRoute, runsRoute, recordsRoute, progressRoute, provenanceRoute, harnessRoutes } from './routes.js';
15
+ export type { AdmissionPorts, AdmittedPrincipal, HarnessRoutesDeps } from './routes.js';
16
+ export { standardSurface } from './surface.js';
17
+ export type { SurfaceDeps } from './surface.js';
18
+ export { createServiceHost } from './host.js';
19
+ export type { ServiceHostConfig, ServiceHost } from './host.js';
20
+ export { DISCOVERY_FIND_CAPABILITY, DISCOVERY_FIND_TOOL, planFind, discoveryFindInvoker } from './tools/find.js';
21
+ export type { ArdSearchBody, FoundAgent, FindDeps } from './tools/find.js';
22
+ export { DISCOVERY_INSPECT_CAPABILITY, DISCOVERY_INSPECT_TOOL, discoveryInspectInvoker } from './tools/inspect.js';
23
+ export { EXTERNAL_AGENT_CAPABILITY, EXTERNAL_AGENT_TOOL, TYPED_NAME, cardOfName, externalAgentInvoker } from './tools/external.js';
24
+ export type { ExternalAgentDeps, NameRecordsPort } from './tools/external.js';
25
+ export { ENGAGEMENT_INVOKE_CAPABILITY, ENGAGEMENT_INVOKE_TOOL, engagementInvokeInvoker, readSubjectReply } from './tools/invoke.js';
26
+ export type { InvokeDeps } from './tools/invoke.js';
27
+ export { HARNESS_READ_SKILL, skillForMethod, wireAdmission, wireReadRequest } from './wire-admission.js';
28
+ export type { WireAdmissionDeps } from './wire-admission.js';
10
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,EAAG,iCAA0C,CAAC;AACvE,eAAO,MAAM,cAAc,EAAG,cAAuB,CAAC;AACtD,eAAO,MAAM,QAAQ,EAAG,wDAAiE,CAAC;AAE1F,OAAO,EACL,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAC1G,eAAe,EAAE,UAAU,GAC5B,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,sBAAsB,EAAE,cAAc,EAAE,sBAAsB,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,Y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AqB,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACpI,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzG,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -1,9 +1,19 @@
1
1
  // @agenticprimitives/service-host — spec 433. The harness run pipeline a service agent embeds, promoted out of the
2
2
  // ap-home runtime in the census order (docs/architecture/service-host-census.md §8). W1 step 1: the run store.
3
3
  export const PACKAGE_NAME = '@agenticprimitives/service-host';
4
- export const PACKAGE_STATUS = 'w1-run-store';
4
+ export const PACKAGE_STATUS = 'w1-host';
5
5
  export const SPEC_REF = 'specs/433-service-apps-run-the-harness-service-host.md';
6
6
  export { mergeTurn, isExpired, expiryFor, liveRuns, completedStepsOf, canceledRecord, openRunOnThread, runStoreOver, AWAIT_WINDOW_MS, RUN_TTL_MS, } from './run-store.js';
7
7
  export { toolWords, progressLine, PROGRESS_TTL_MS, PROGRESS_MAX_LINES } from './progress.js';
8
- export { runStorage, memoryRunKv, memoryRunStoreCall, RUN_KEY_PREFIX, PROGRESS_KEY_PREFIX } from './storage.js';
8
+ export { runStorage, memoryRunKv, memoryRunStoreCall, RUN_KEY_PREFIX, PROGRESS_KEY_PREFIX, RECORD_KEY_PREFIX, BUDGET_KEY_PREFIX, ASSERTION_KEY_PREFIX, DEFAULT_RECORD_RETENTION_DAYS } from './storage.js';
9
+ export { runTurn, suppliedPlanner, defaultSay } from './run.js';
10
+ export { exportRunProvenance, provenanceGraphOf, provenanceJsonLdOf, provenanceProvNOf, provenanceViewOf, hasProvenanceRef, runAnchorRecordKey, runMeasuresRecordKey } from './provenance-sink.js';
11
+ export { admit, askRoute, runsRoute, recordsRoute, progressRoute, provenanceRoute, harnessRoutes } from './routes.js';
12
+ export { standardSurface } from './surface.js';
13
+ export { createServiceHost } from './host.js';
14
+ export { DISCOVERY_FIND_CAPABILITY, DISCOVERY_FIND_TOOL, planFind, discoveryFindInvoker } from './tools/find.js';
15
+ export { DISCOVERY_INSPECT_CAPABILITY, DISCOVERY_INSPECT_TOOL, discoveryInspectInvoker } from './tools/inspect.js';
16
+ export { EXTERNAL_AGENT_CAPABILITY, EXTERNAL_AGENT_TOOL, TYPED_NAME, cardOfName, externalAgentInvoker } from './tools/external.js';
17
+ export { ENGAGEMENT_INVOKE_CAPABILITY, ENGAGEMENT_INVOKE_TOOL, engagementInvokeInvoker, readSubjectReply } from './tools/invoke.js';
18
+ export { HARNESS_READ_SKILL, skillForMethod, wireAdmission, wireReadRequest } from './wire-admission.js';
9
19
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,+GAA+G;AAC/G,MAAM,CAAC,MAAM,YAAY,GAAG,iCAA0C,CAAC;AACvE,MAAM,CAAC,MAAM,cAAc,GAAG,cAAuB,CAAC;AACtD,MAAM,CAAC,MAAM,QAAQ,GAAG,wDAAiE,CAAC;AAE1F,OAAO,EACL,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAC1G,eAAe,EAAE,UAAU,GAC5B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAG7F,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,kBAAkB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"A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AAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,UAAU,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEnI,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEpI,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { type RunRecordV1, type RunExportReportV1 } from '@agenticprimitives/orchestration';
2
+ import { type ProvenanceRecordV1, type ProvenanceStorePort } from '@agenticprimitives/provenance';
3
+ import type { Address, Hex } from '@agenticprimitives/types';
4
+ export declare const runAnchorRecordKey: (runRef: string) => string;
5
+ export declare const runMeasuresRecordKey: (runRef: string) => string;
6
+ export interface ProvenanceSinkDeps {
7
+ /** Where the record is KEPT — the agent's vault through its own door. Absent ⇒ not kept, and the report says so. */
8
+ store?: ProvenanceStorePort;
9
+ /** The published JSON-LD `@context` for a run's provenance (the ontology's `RUN_PROVENANCE_CONTEXT['@context']`). */
10
+ context: Record<string, unknown>;
11
+ /** The chain the agents live on, so the record names them the way the public KB does. */
12
+ chainId?: number;
13
+ /** Spec 410 §4.4 — the estate this host belongs to. */
14
+ estate?: string;
15
+ /** Spec 406 W2 — anchor the bundle's digest on chain; absent ⇒ not anchored, said. */
16
+ anchor?: (digest: Hex, intentDigest: Hex, mandateRef: Hex) => Promise<{
17
+ txHash: Hex;
18
+ registry: Address;
19
+ anchoredBy: Address;
20
+ chainId?: number;
21
+ }>;
22
+ /** Spec 414 A2 — the measurements beside the provenance (the evaluation package's `measureRun`); absent ⇒ none, said. */
23
+ measures?: (record: RunRecordV1, agent: string) => Promise<{
24
+ count: number;
25
+ doc: Record<string, unknown>;
26
+ }>;
27
+ /** The bundle's digest, for the anchor (a deployment's `bundleDigest`: keccak over the canonical bytes). */
28
+ bundleDigest?: (bundle: Record<string, unknown>) => Hex;
29
+ now?: () => number;
30
+ }
31
+ /** The PROV-O graph of a run record, as the projector makes it from the firewalled view. */
32
+ export declare function provenanceGraphOf(record: RunRecordV1, agent: string, opts?: Pick<ProvenanceSinkDeps, 'chainId' | 'estate'>): Promise<ProvenanceRecordV1>;
33
+ /** The JSON-LD document that lands in the vault — a stock PROV tool loads it unchanged. */
34
+ export declare function provenanceJsonLdOf(record: RunRecordV1, agent: string, deps: Pick<ProvenanceSinkDeps, 'chainId' | 'estate' | 'context'>): Promise<Record<string, unknown>>;
35
+ /** The same record as PROV-N, for a reader that wants text. */
36
+ export declare function provenanceProvNOf(record: RunRecordV1, agent: string, opts?: Pick<ProvenanceSinkDeps, 'chainId' | 'estate'>): Promise<string>;
37
+ /** The inspector's RECORD form — the firewalled structural view (`provenanceOf`: digests, verdicts, the chain by reference;
38
+ * never arguments, results or words) plus what a reader of the run wants beside it: the chain, the bill, a cancel mark, each
39
+ * model call's step. What a Home's run inspector reads (`/harness/provenance` with `format: 'record'`). */
40
+ export declare function provenanceViewOf(record: RunRecordV1, agent: string, opts?: Pick<ProvenanceSinkDeps, 'chainId'>): Promise<Record<string, unknown>>;
41
+ /** A REFERENCE to a run's provenance, never the record: resolving it takes that agent's grant (ADR-0055). */
42
+ export declare function hasProvenanceRef(agent: string, runRef: string): {
43
+ agent: string;
44
+ recordType: string;
45
+ };
46
+ /** Export one finished run: the provenance to the vault, the anchor citation beside it, the measurements. */
47
+ export declare function exportRunProvenance(record: RunRecordV1, agent: string, deps: ProvenanceSinkDeps): Promise<RunExportReportV1>;
48
+ //# sourceMappingURL=provenance-sink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provenance-sink.d.ts","sourceRoot":"","sources":["../src/provenance-sink.ts"],"names":[],"mappings":"AASA,OAAO,EAAwC,KAAK,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAClI,OAAO,EAAkD,KAAK,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,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BAAkB,EAAE,SAAS,GAAG,QAAQ,CAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAGlK;AAED,2FAA2F;AAC3F,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAG/K;AAED,+DAA+D;AAC/D,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,QAAQ,CAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEtJ;AAED;;4GAE4G;AAC5G,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAK3J;AAED,6GAA6G;AAC7G,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAErG;AAED,6GAA6G;AAC7G,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAoClI"}
@@ -0,0 +1,98 @@
1
+ // THE RECORD — spec 433 W1 step 4 (census §3), promoted from the ap-home runtime's `run-export.ts`. A finished run's
2
+ // durable half goes into the vault of the agent whose authority was spent, through ITS door, under ITS grant (ADR-0055):
3
+ // `run.provenance:<runRef>` as the JSON-LD PROV-O / P-Plan bundle the Ring-0 projector makes (spec 389), the digest's
4
+ // anchor citation beside it when a chain anchor is bound (spec 406 W2), and the run's measurements when a measurer is
5
+ // bound (spec 414 A2). Off the run's path: a failed export is said on the report, never a failed ask.
6
+ //
7
+ // Every projection here is a package's already — orchestration's `provenanceOf` (the structural view: digests,
8
+ // verdicts, the chain by reference; never arguments, results or words), provenance's `projectHarnessRunProvenance` +
9
+ // `toJsonLd`. This module is the glue: the view, the record keys, the ports, the report.
10
+ import { provenanceOf, runProvenanceRecordKey } from '@agenticprimitives/orchestration';
11
+ import { projectHarnessRunProvenance, toJsonLd, toProvN } from '@agenticprimitives/provenance';
12
+ import { intentDigest } from '@agenticprimitives/delegation';
13
+ export const runAnchorRecordKey = (runRef) => `run.anchor:${runRef}`;
14
+ export const runMeasuresRecordKey = (runRef) => `run.measures:${runRef}`;
15
+ const ZERO32 = `0x${'0'.repeat(64)}`;
16
+ /** The PROV-O graph of a run record, as the projector makes it from the firewalled view. */
17
+ export async function provenanceGraphOf(record, agent, opts = {}) {
18
+ const view = await provenanceOf(record, agent);
19
+ return projectHarnessRunProvenance({ ...view, ...(opts.chainId ? { chainId: opts.chainId } : {}), ...(opts.estate ? { estate: opts.estate } : {}) });
20
+ }
21
+ /** The JSON-LD document that lands in the vault — a stock PROV tool loads it unchanged. */
22
+ export async function provenanceJsonLdOf(record, agent, deps) {
23
+ const graph = await provenanceGraphOf(record, agent, deps);
24
+ return toJsonLd(graph, { context: deps.context, ...(deps.chainId ? { chainId: deps.chainId } : {}) });
25
+ }
26
+ /** The same record as PROV-N, for a reader that wants text. */
27
+ export async function provenanceProvNOf(record, agent, opts = {}) {
28
+ return toProvN(await provenanceGraphOf(record, agent, opts), opts.chainId ? { chainId: opts.chainId } : {});
29
+ }
30
+ /** The inspector's RECORD form — the firewalled structural view (`provenanceOf`: digests, verdicts, the chain by reference;
31
+ * never arguments, results or words) plus what a reader of the run wants beside it: the chain, the bill, a cancel mark, each
32
+ * model call's step. What a Home's run inspector reads (`/harness/provenance` with `format: 'record'`). */
33
+ export async function provenanceViewOf(record, agent, opts = {}) {
34
+ const view = (await provenanceOf(record, agent));
35
+ const r = record;
36
+ const calls = view.modelCalls?.map((m, i) => { const c = r.modelCalls?.[i]; return { ...m, ...(c?.stepRef ? { stepRef: c.stepRef } : {}), ...(c?.failed ? { failed: true } : {}) }; });
37
+ return { ...view, ...(calls ? { modelCalls: calls } : {}), ...(opts.chainId ? { chainId: opts.chainId } : {}), ...(r.bill ? { bill: r.bill } : {}), ...(r.canceled ? { canceled: r.canceled } : {}) };
38
+ }
39
+ /** A REFERENCE to a run's provenance, never the record: resolving it takes that agent's grant (ADR-0055). */
40
+ export function hasProvenanceRef(agent, runRef) {
41
+ return { agent: agent.toLowerCase(), recordType: runProvenanceRecordKey(runRef) };
42
+ }
43
+ /** Export one finished run: the provenance to the vault, the anchor citation beside it, the measurements. */
44
+ export async function exportRunProvenance(record, agent, deps) {
45
+ const now = deps.now ?? Date.now;
46
+ const recordType = runProvenanceRecordKey(record.runRef);
47
+ const report = { at: now(), provenance: { written: false, recordType }, spans: { count: 0, sent: false } };
48
+ let doc = null;
49
+ if (deps.store) {
50
+ try {
51
+ doc = await provenanceJsonLdOf(record, agent, deps);
52
+ const out = await deps.store.put({ agent, key: recordType }, doc);
53
+ report.provenance.written = out.ok;
54
+ if (!out.ok)
55
+ report.provenance.error = out.error;
56
+ }
57
+ catch (e) {
58
+ report.provenance.error = e instanceof Error ? e.message : String(e);
59
+ }
60
+ }
61
+ else
62
+ report.provenance.error = 'no vault write door';
63
+ if (deps.anchor && deps.bundleDigest) {
64
+ try {
65
+ const digest = deps.bundleDigest(doc ?? (await provenanceJsonLdOf(record, agent, deps)));
66
+ const mandateRef = record.presented?.[0]?.ref ?? ZERO32;
67
+ const out = await deps.anchor(digest, intentDigest(record.intent), /^0x[0-9a-f]{64}$/i.test(mandateRef) ? mandateRef : ZERO32);
68
+ report.anchor = { digest, registry: out.registry, anchoredBy: out.anchoredBy, txHash: out.txHash, ...(out.chainId ? { chainId: out.chainId } : {}) };
69
+ if (deps.store) {
70
+ const key = runAnchorRecordKey(record.runRef);
71
+ const cite = { runRef: record.runRef, digest, registry: out.chainId ? `eip155:${out.chainId}:${out.registry}` : out.registry, anchoredBy: out.anchoredBy, txHash: out.txHash, ...(deps.estate ? { estate: deps.estate } : {}) };
72
+ try {
73
+ const w = await deps.store.put({ agent, key }, cite);
74
+ report.anchorRecord = { written: w.ok, recordType: key, ...(!w.ok ? { error: w.error } : {}) };
75
+ }
76
+ catch (e) {
77
+ report.anchorRecord = { written: false, recordType: key, error: e instanceof Error ? e.message : String(e) };
78
+ }
79
+ }
80
+ }
81
+ catch (e) {
82
+ report.anchor = { error: e instanceof Error ? e.message : String(e) };
83
+ }
84
+ }
85
+ if (deps.store && deps.measures) {
86
+ const key = runMeasuresRecordKey(record.runRef);
87
+ try {
88
+ const { count, doc: m } = await deps.measures(record, agent);
89
+ const w = await deps.store.put({ agent, key }, m);
90
+ report.measures = { written: w.ok, recordType: key, count, ...(!w.ok ? { error: w.error } : {}) };
91
+ }
92
+ catch (e) {
93
+ report.measures = { written: false, recordType: key, count: 0, error: e instanceof Error ? e.message : String(e) };
94
+ }
95
+ }
96
+ return report;
97
+ }
98
+ //# sourceMappingURL=provenance-sink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provenance-sink.js","sourceRoot":"","sources":["../src/provenance-sink.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,yHAAyH;AACzH,sHAAsH;AACtH,sHAAsH;AACtH,sGAAsG;AACtG,EAAE;AACF,+GAA+G;AAC/G,qHAAqH;AACrH,yFAAyF;AACzF,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAA4C,MAAM,kCAAkC,CAAC;AAClI,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,OAAO,EAAqD,MAAM,+BAA+B,CAAC;AAClJ,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAG7D,MAAM,CAAC,MAAM,kBAA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from './run.js';
4
+ import { type ProvenanceSinkDeps } from './provenance-sink.js';
5
+ export interface AdmittedPrincipal {
6
+ agent: Address;
7
+ credential: TurnCredentialV1;
8
+ }
9
+ export interface AdmissionPorts {
10
+ /** A Home session bearer → the person, or null. */
11
+ bearer?: (token: string) => Promise<{
12
+ agent: Address;
13
+ } | null>;
14
+ /** An `A2A-Session` request (the raw body is what the assertion hashed) → the person it acts for, or null. */
15
+ wire?: (request: Request, raw: string) => Promise<{
16
+ agent: Address;
17
+ } | null>;
18
+ /** The surface answers strangers (reads only; every act still parks). Default false — fail closed. */
19
+ public?: boolean;
20
+ }
21
+ export interface HarnessRoutesDeps {
22
+ /** The agent this host IS. */
23
+ agent: Address;
24
+ admission: AdmissionPorts;
25
+ runStore: RunStore;
26
+ /** Everything the turn needs but the input (playbook, tools, invokers, planner, ports, …). May depend on the asker. */
27
+ turnDeps: (ctx: {
28
+ asker: AdmittedPrincipal;
29
+ raw: string;
30
+ }) => Promise<Omit<TurnDeps, 'runStore'>> | Omit<TurnDeps, 'runStore'>;
31
+ /** Where a finished run's provenance goes (absent ⇒ runs are recorded on the object only, and the reply says so). */
32
+ provenance?: ProvenanceSinkDeps;
33
+ /** Who may see a run beside its asker — the agent's steward(s). Default: only the asker. */
34
+ mayOversee?: (who: Address) => Promise<boolean>;
35
+ /** Fire-and-forget work the platform should keep alive (Cloudflare `waitUntil`). */
36
+ waitUntil?: (p: Promise<unknown>) => void;
37
+ log?: (line: string) => void;
38
+ }
39
+ /** WHO IS ASKING — the one order, no fallback between mechanisms (ADR-0013): an `A2A-Session` header is judged as a wire
40
+ * and never as a session; a `session` in the body is judged as a session; neither ⇒ public or refused. */
41
+ export declare function admit(request: Request, raw: string, body: {
42
+ session?: string;
43
+ } | null, ports: AdmissionPorts, self: Address): Promise<{
44
+ ok: true;
45
+ who: AdmittedPrincipal;
46
+ } | {
47
+ ok: false;
48
+ status: number;
49
+ error: string;
50
+ }>;
51
+ /** `/harness/ask` — one turn. Also `/harness/run` (POST: the same, kept for callers that name it so). */
52
+ export declare function askRoute(request: Request, deps: HarnessRoutesDeps): Promise<Response>;
53
+ /** `/harness/runs` — the unfinished runs this person may pick up: their own; every run when they oversee the agent. */
54
+ export declare function runsRoute(request: Request, deps: HarnessRoutesDeps): Promise<Response>;
55
+ /** `/harness/records` — what this agent did (a week), listed without mandates; `/harness/run` GET-shaped read of one. */
56
+ export declare function recordsRoute(request: Request, deps: HarnessRoutesDeps): Promise<Response>;
57
+ /** `/harness/progress` — the run's lines after `after`, for the asker only (the store gates it). */
58
+ export declare function progressRoute(request: Request, deps: HarnessRoutesDeps): Promise<Response>;
59
+ /** `/harness/provenance` — the run's PROV-O record, projected from the record this object holds (the vault copy is the
60
+ * document of record; this is the same projection, served to whoever may see the run). */
61
+ export declare function provenanceRoute(request: Request, deps: HarnessRoutesDeps): Promise<Response>;
62
+ /** The whole `/harness/*` surface as one handler; `null` for any other path so the host's router continues. */
63
+ export declare function harnessRoutes(request: Request, deps: HarnessRoutesDeps): Promise<Response | null>;
64
+ //# sourceMappingURL=routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAIxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAW,KAAK,QAAQ,EAAkB,KAAK,gBAAgB,EAA2B,MAAM,UAAU,CAAC;AAClH,OAAO,EAA6D,KAAK,kBAAkB,EAAuC,MAAM,sBAAsB,CAAC;AAI/J,MAAM,WAAW,iBAAiB;IAAG,KAAK,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,gBAAgB,CAAA;CAAE;AAEnF,MAAM,WAAW,cAAc;IAC7B,mDAAmD;IACnD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO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