@agentproto/runtime 2.7.0 → 2.8.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/dist/index.d.ts CHANGED
@@ -536,6 +536,16 @@ interface ToolCallRecord {
536
536
  exitCode?: number;
537
537
  isError?: boolean;
538
538
  durationMs?: number;
539
+ /** The PR this call CREATED, when the call was a successful shell-shaped
540
+ * `gh pr create` (detected at write time via `detectShellPrCreate` in
541
+ * pr-provenance.ts, from the command string + the call's result text).
542
+ * This is the exact-attribution source the PR-provenance reconciler
543
+ * prefers over branch→PR guessing: the session whose events.jsonl holds
544
+ * this record IS the session that opened the PR, no matter what branch
545
+ * its cwd sits on by the time the turn ends. Absent for every other
546
+ * call. */
547
+ createdPrUrl?: string;
548
+ createdPrNumber?: number;
539
549
  ts: string;
540
550
  }
541
551
 
@@ -6382,12 +6392,22 @@ type GhRunner = (args: readonly string[], cwd: string) => Promise<{
6382
6392
  * footer is never applied.
6383
6393
  *
6384
6394
  * This closes that gap tool-agnostically: it subscribes to the session event
6385
- * bus and, at each executor session's turn-end / exit, resolves the OPEN PR for
6386
- * that session's branch (via the injected {@link OpenPrResolver} port) and
6387
- * stamps the same `@agentproto-bot` footer if it's missing — reusing
6388
- * {@link stampFooterOnPr}. Turn-end/exit are only poll checkpoints, never an
6389
- * assertion the PR is ready: the real predicate is "does an open PR for this
6390
- * branch now exist?", answered by the resolver, not by timing.
6395
+ * bus and, at each executor session's turn-end / exit, checks two lanes in
6396
+ * order and stamps the same `@agentproto-bot` footer if it's missing —
6397
+ * reusing {@link stampFooterOnPr}:
6398
+ *
6399
+ * A. EXACT the session's own recorded tool calls: the transcript writer
6400
+ * marks a successful `gh pr create` with the created PR's url/number
6401
+ * (`ToolCallRecord.createdPrUrl`), naming the author session directly.
6402
+ * Immune to branch switches and shared checkouts.
6403
+ * B. BRANCH — resolve the OPEN PR for the session cwd's current branch
6404
+ * (via the injected {@link OpenPrResolver} port), the fallback for
6405
+ * adapters whose tool calls aren't recorded.
6406
+ *
6407
+ * Turn-end/exit are only poll checkpoints, never an assertion the PR is
6408
+ * ready: the real predicate is "did this session create a PR / does an open
6409
+ * PR for this branch now exist?", answered by the records and resolver, not
6410
+ * by timing.
6391
6411
  *
6392
6412
  * Strictly best-effort: every handler is wrapped so a missing session, an
6393
6413
  * unreachable forge, or a failed `gh` can never throw out of a bus callback.
@@ -6439,6 +6459,10 @@ declare function createPrProvenanceReconciler(opts: {
6439
6459
  registry: ReconcilerRegistry;
6440
6460
  sessionEvents: SessionEventBus;
6441
6461
  resolveOpenPr: OpenPrResolver;
6462
+ /** Session's recorded tool calls, the exact-attribution source (lane A).
6463
+ * Defaults to reading the session's own events.jsonl via
6464
+ * {@link readToolCallRecords}; injectable for tests. */
6465
+ listToolCalls?: (sessionId: string) => Promise<ToolCallRecord[]>;
6442
6466
  run?: GhRunner;
6443
6467
  host?: string;
6444
6468
  }): PrProvenanceReconciler;
@@ -7837,6 +7861,12 @@ interface ConversationIndexRecord {
7837
7861
  cwd: string;
7838
7862
  adapterSlug: string;
7839
7863
  adapterSessionId: string;
7864
+ /** The session's isolated provider config dir at write time (see
7865
+ * `ResolveNativeLinkInput.adapterConfigDir`) — recorded so readers
7866
+ * that go through the store abstraction (`store.read`, not
7867
+ * `native.path`) can resolve the same isolated dir. Absent on
7868
+ * pre-#824 rows and native PTY sessions. */
7869
+ adapterConfigDir?: string;
7840
7870
  /** Absent when `adapterSlug` has no known native store (an adapter
7841
7871
  * outside claude-code/hermes) — the record still links session ↔
7842
7872
  * cwd ↔ adapterSessionId, it just can't point at a native file. */
@@ -7853,6 +7883,12 @@ interface ResolveNativeLinkInput {
7853
7883
  cwd: string;
7854
7884
  adapterSlug: string;
7855
7885
  adapterSessionId: string;
7886
+ /** The session's isolated provider config dir (`SessionDescriptor.
7887
+ * adapterConfigDir`): since #824 a daemon-spawned claude-code session
7888
+ * writes its transcripts under `<adapterConfigDir>/projects/<slug>`,
7889
+ * not `~/.claude/projects/<slug>`. Absent for a native PTY or a
7890
+ * pre-#824 row — the global dir applies. */
7891
+ adapterConfigDir?: string;
7856
7892
  }
7857
7893
  /**
7858
7894
  * Resolve where THIS provider keeps this conversation, computed once (at
@@ -8389,6 +8425,21 @@ interface CreateGatewayOptions {
8389
8425
  name?: string;
8390
8426
  /** Server version advertised over MCP. */
8391
8427
  version?: string;
8428
+ /** Build identity of the binary actually serving — surfaced verbatim via
8429
+ * `/health` and `daemon_health` so an operator can tell a workspace dist
8430
+ * from the published tarball of the same version. `sha`/`builtAt` are
8431
+ * stamped into the CLI at build time (tsup `define`); `source` is the
8432
+ * serve command's runtime judgement of where its own entry lives. */
8433
+ build?: {
8434
+ /** Short git sha of the checkout the dist was built from ("" when the
8435
+ * build ran outside git). */
8436
+ sha?: string;
8437
+ /** ISO timestamp of the build. */
8438
+ builtAt?: string;
8439
+ /** "workspace" (a checkout's dist), "published" (npm/npx install), or
8440
+ * "unknown". */
8441
+ source?: string;
8442
+ };
8392
8443
  /**
8393
8444
  * Run BOOT.md once at startup. Pass `false` to disable. Defaults to
8394
8445
  * `true`. The boot file is plain markdown — frontmatter-free; the