@ref0/sdk 0.5.0 → 0.6.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.
@@ -1,4 +1,4 @@
1
- import { $t as WorkflowCallRefused, An as WorkflowText, B as GetIssueInput, Cn as WorkflowPermissions, E as ConnectionCallAnswer, En as WorkflowPullRequestOpen, I as EventRunInput, It as ThreadStage, Jt as WorkflowCall, L as ForkAnswer$1, Mn as WorkflowTrigger, Mt as StartActor$1, Nt as StartRun$1, On as WorkflowStartEnded, Qt as WorkflowCallRefusal, R as ForkCreate, Sn as WorkflowPasskeyState, St as SandboxPushAnswer, T as ConnectionCall, Tn as WorkflowPullRequestAnswer, Ut as WorkflowAction, Wt as WorkflowActionAnswer, Xt as WorkflowCallEnded, Yt as WorkflowCallAnswer, Zt as WorkflowCallInput, _ as CheckRunError, _n as WorkflowOwn, _t as SandboxExec, an as WorkflowCheckResultsAnswer, bn as WorkflowPasskeyEnded, bt as SandboxOpenAnswer, cn as WorkflowCheckStart, dn as WorkflowCheckStatesAnswer, en as WorkflowCalledState, fn as WorkflowCheckWhere, g as CheckOwn, gn as WorkflowFilters, h as CheckOn, hn as WorkflowEvent, in as WorkflowCheckResults, jn as WorkflowThreadStart, kn as WorkflowStartState, ln as WorkflowCheckStartAnswer, mn as WorkflowConnections, nn as WorkflowCheckRefusal, on as WorkflowCheckRun, pn as WorkflowComment, pt as Ref0Owned, qt as WorkflowAskClosed, rn as WorkflowCheckRefused, sn as WorkflowCheckRunEnded, tn as WorkflowCalledStateAnswer, un as WorkflowCheckStates, v as CheckRunParams, vn as WorkflowPasskeyAsk, vt as SandboxExecAnswer, xn as WorkflowPasskeyRead, xt as SandboxPush, y as CheckTreeEntry, yn as WorkflowPasskeyAsked, yt as SandboxOpen } from "./index-Dns8tCkT.mjs";
1
+ import { $t as WorkflowCallRefusal, An as WorkflowStartState, Cn as WorkflowPasskeyState, Ct as SandboxPushAnswer, D as ConnectionCallAnswer, Dn as WorkflowPullRequestOpen, E as ConnectionCall, En as WorkflowPullRequestAnswer, Gt as WorkflowActionAnswer, Jt as WorkflowAskClosed, L as EventRunInput, Lt as ThreadStage, Mn as WorkflowThreadStart, Nn as WorkflowTrigger, Nt as StartActor$1, Pt as StartRun$1, Qt as WorkflowCallInput, R as ForkAnswer$1, Sn as WorkflowPasskeyRead, St as SandboxPush, V as GetIssueInput, Wt as WorkflowAction, Xt as WorkflowCallAnswer, Yt as WorkflowCall, Zt as WorkflowCallEnded, _ as CheckOwn, _n as WorkflowFilters, an as WorkflowCheckResults, b as CheckTreeEntry, bn as WorkflowPasskeyAsked, bt as SandboxOpen, cn as WorkflowCheckRunEnded, dn as WorkflowCheckStates, en as WorkflowCallRefused, fn as WorkflowCheckStatesAnswer, g as CheckOn, gn as WorkflowEvent, hn as WorkflowConnections, in as WorkflowCheckRefused, jn as WorkflowText, kn as WorkflowStartEnded, ln as WorkflowCheckStart, mn as WorkflowComment, mt as Ref0Owned, nn as WorkflowCalledStateAnswer, on as WorkflowCheckResultsAnswer, pn as WorkflowCheckWhere, rn as WorkflowCheckRefusal, sn as WorkflowCheckRun, tn as WorkflowCalledState, un as WorkflowCheckStartAnswer, v as CheckRunError, vn as WorkflowOwn, vt as SandboxExec, wn as WorkflowPermissions, xn as WorkflowPasskeyEnded, xt as SandboxOpenAnswer, y as CheckRunParams, yn as WorkflowPasskeyAsk, yt as SandboxExecAnswer, z as ForkCreate } from "./index-CJGX88qF.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/needs.d.ts
4
4
  /**
@@ -551,10 +551,10 @@ interface CheckSpec<Params extends z.ZodObject, Output> {
551
551
  /** For the whole check run, 45 minutes unless it says, and 6 hours at most. */
552
552
  readonly timeout?: DurationText;
553
553
  /**
554
- * When ref0 starts it itself, each once: `'change'`, on each change before it joins `main`;
555
- * `'tip'`, on the merge queue's tip before `main` moves, so it guards `main`; `'deployed'`, on
556
- * what deployed. `['change', 'tip']` unless it says, and `[]` for ref0 never to start it, so only
557
- * other code and people do, as its start rule lets them.
554
+ * When ref0 starts it itself, each once: `'change'`, on each change before it joins `main`; or
555
+ * `'tip'`, on the merge queue's tip before `main` moves, so it guards `main`. `['change', 'tip']`
556
+ * unless it says, and `[]` for ref0 never to start it, so only other code and people do, as its
557
+ * start rule lets them.
558
558
  */
559
559
  readonly on?: CheckOn;
560
560
  /**
@@ -671,4 +671,4 @@ interface Browser {
671
671
  }
672
672
  //#endregion
673
673
  export { StartActor as $, ForkOptions as A, WorkflowContext as B, Comment as C, EventWorkflow as D, EventOf as E, StepConfig as F, CalledWorkflow as G, text as H, StepContext as I, TreeEntry as J, JsonValue as K, ThreadStart as L, PullRequestAnswer as M, PullRequestOptions as N, EventWorkflowSpec as O, Ref0Actions as P, Refusal as Q, WaitType as R, CheckRunEnded as S, Duration as T, workflow as U, WorkflowStep as V, CalledRunFailed as W, Allow as X, TreeRead as Y, CalledRun as Z, ActionAnswer as _, CheckRunOptions as a, allow as at, CalledContext as b, CheckRunResult as c, Need as ct, OneOfValues as d, StartContext as et, OutputResult as f, oneOf as g, check as h, CheckResult as i, StartRun as it, NeedAddOptions as j, ForkAnswer as k, CheckSpec as l, Step as m, Check as n, StartOutput as nt, CheckRunReference as o, refuse as ot, OutputSchema as p, Tree as q, CheckContext as r, StartRule as rt, CheckRunRefused as s, CheckNeed as st, Browser as t, StartItem as tt, DurationText as u, CallAnswer as v, ConnectionsOf as w, CalledWorkflowSpec as x, CallEnded as y, WaitedEvent as z };
674
- //# sourceMappingURL=browse-DBqoeS-u.d.mts.map
674
+ //# sourceMappingURL=browse-DHgV6DTF.d.mts.map
@@ -1,4 +1,4 @@
1
- import { t as Browser } from "./browse-DBqoeS-u.mjs";
1
+ import { t as Browser } from "./browse-DHgV6DTF.mjs";
2
2
  import { BrowserContext, BrowserContext as BrowserContext$1, BrowserContextOptions, Locator, Page, Page as Page$1, Request, Response } from "@cloudflare/playwright";
3
3
  import { expect as expect$1 } from "@cloudflare/playwright/test";
4
4
  //#region src/browser-stub.d.ts
package/dist/client.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as OwnerThreadView, A as ConnectionView, At as SignedIn, Bn as liveSocketUrl, Bt as TypedApprovalCode, C as ConnectChosen, D as ConnectionChanged, Dt as SentryRegion, Et as SentryOrg, F as EndpointName, Fn as connectEndpoint, Ft as ThreadId, G as LiveTrackName, H as ImportFailure, Hn as repoNameKey, Ht as Welcome, In as encodeSecret, It as ThreadStage, J as MirrorEntry, K as MachineConnected, Ln as hookTokenPrefix, Lt as TrackClosed, M as ConsentClient, N as ConsentProject, Nn as WrittenProject, O as ConnectionKind, Ot as SentryToken, P as CredentialView, Pn as commandLine, Pt as StatementView, Q as OwnerThreadPage, Rn as hookUrl, Rt as TrackSession, S as ConnectAgent, Tt as SecretHash, U as LiveTicket, Un as surfaceOf, V as Harness, Vn as projectParts, W as LiveTicketRequest, X as OwnerId, Y as MirrorView, Z as OwnerName, a as Api, b as ClientAccess, c as ApprovalPreview, ct as PreviewUnavailable, d as AttachmentFailed, dt as RanOf, et as OwnerTrackMessage, f as AttachmentRequestView, ft as ReadEvent, gt as RepoView, ht as RepoUrl, i as AgentView, j as ConsentAsked, jt as SocketUrl, k as ConnectionName, kt as SignInDestination, l as ApprovalState, lt as ProjectName, mt as RepoName, n as AgentPermissionChoice, nt as PasskeyCreated, o as ApiOrigin, ot as PasskeyRequestOptions, p as Authorization, q as MirrorChoice, r as AgentPermissionSetting, rt as PasskeyCreationOptions, s as ApprovalId, st as PreviewEcho, t as AgentHandle, tt as PasskeyAsserted, u as ApprovalView, ut as ProjectTrackMessage, w as ConnectableAgent, wn as WorkflowPreview, wt as ScopeAction, x as ClientGranted, zn as isRef0Path, zt as TrackThread } from "./index-Dns8tCkT.mjs";
1
+ import { $ as OwnerThreadPage, A as ConnectionName, At as SignInDestination, Bn as isRef0Path, Bt as TrackThread, C as ConnectAgent, Dt as SentryOrg, Et as SecretHash, F as CredentialView, Fn as commandLine, Ft as StatementView, G as LiveTicketRequest, H as Harness, Hn as projectParts, I as EndpointName, In as connectEndpoint, It as ThreadId, J as MirrorChoice, K as LiveTrackName, Ln as encodeSecret, Lt as ThreadStage, M as ConsentAsked, Mt as SocketUrl, N as ConsentClient, O as ConnectionChanged, Ot as SentryRegion, P as ConsentProject, Pn as WrittenProject, Q as OwnerName, Rn as hookTokenPrefix, Rt as TrackClosed, S as ClientGranted, T as ConnectableAgent, Tn as WorkflowPreview, Tt as ScopeAction, U as ImportFailure, Un as repoNameKey, Ut as Welcome, Vn as liveSocketUrl, Vt as TypedApprovalCode, W as LiveTicket, Wn as surfaceOf, X as MirrorView, Y as MirrorEntry, Z as OwnerId, _t as RepoView, a as Api, c as ApprovalId, ct as PreviewEcho, d as ApprovalView, dt as ProjectTrackMessage, et as OwnerThreadView, f as AttachmentFailed, ft as RanOf, gt as RepoUrl, ht as RepoName, i as AgentView, it as PasskeyCreationOptions, j as ConnectionView, jt as SignedIn, k as ConnectionKind, kt as SentryToken, l as ApprovalPreview, lt as PreviewUnavailable, m as Authorization, n as AgentPermissionChoice, nt as PasskeyAsserted, o as ApiOrigin, p as AttachmentRequestView, pt as ReadEvent, q as MachineConnected, r as AgentPermissionSetting, rt as PasskeyCreated, s as ApprovalAnswer, st as PasskeyRequestOptions, t as AgentHandle, tt as OwnerTrackMessage, u as ApprovalState, ut as ProjectName, w as ConnectChosen, x as ClientAccess, zn as hookUrl, zt as TrackSession } from "./index-CJGX88qF.mjs";
2
2
  import { Effect, Layer, Option, Redacted, Schema, Stream } from "effect";
3
3
  import { HttpApi, HttpApiClient, HttpApiGroup, HttpApiMiddleware } from "effect/http-api";
4
4
  import { HttpBody, HttpClient } from "effect/http";
@@ -90,5 +90,5 @@ export declare const startGitHubSignIn: (landing: {
90
90
  */
91
91
  export declare const signOut: (origin?: ApiOrigin) => Effect.Effect<void, import("effect/http/HttpClientError").HttpClientError, HttpClient.HttpClient>;
92
92
  //#endregion
93
- export { AgentHandle, type AgentPermissionChoice, type AgentPermissionSetting, type AgentView, ApiOrigin, type ApprovalId, type ApprovalPreview, type ApprovalState, type ApprovalView, AttachmentFailed, type AttachmentRequestView, ClientAccess, ClientGranted, type ConnectAgent, type ConnectChosen, type ConnectableAgent, ConnectionChanged, ConnectionKind, ConnectionName, type ConnectionView, type ConsentAsked, type ConsentClient, ConsentProject, type CredentialView, type Harness, type ImportFailure, type LiveTicket, type LiveTicketRequest, LiveTrackName, MachineConnected, type MirrorChoice, type MirrorEntry, type MirrorView, type OwnerId, OwnerName, type OwnerThreadPage, type OwnerThreadView, OwnerTrackMessage, PasskeyAsserted, PasskeyCreated, type PasskeyCreationOptions, type PasskeyRequestOptions, type PreviewEcho, PreviewUnavailable, ProjectName, ProjectTrackMessage, type ReadEvent, type Ref0Client, RepoName, RepoUrl, type RepoView, type ScopeAction, SecretHash, SentryOrg, SentryRegion, SentryToken, type SettledApproval, SignInDestination, type StatementView, ThreadId, ThreadStage, type TrackClosed, type TrackSession, type TrackThread, TypedApprovalCode, type Welcome, WorkflowPreview, WrittenProject, commandLine, connectEndpoint, encodeSecret, hookTokenPrefix, hookUrl, isRef0Path, liveSocketUrl, projectParts, repoNameKey, surfaceOf };
93
+ export { AgentHandle, type AgentPermissionChoice, type AgentPermissionSetting, type AgentView, ApiOrigin, type ApprovalAnswer, type ApprovalId, type ApprovalPreview, type ApprovalState, type ApprovalView, AttachmentFailed, type AttachmentRequestView, ClientAccess, ClientGranted, type ConnectAgent, type ConnectChosen, type ConnectableAgent, ConnectionChanged, ConnectionKind, ConnectionName, type ConnectionView, type ConsentAsked, type ConsentClient, ConsentProject, type CredentialView, type Harness, type ImportFailure, type LiveTicket, type LiveTicketRequest, LiveTrackName, MachineConnected, type MirrorChoice, type MirrorEntry, type MirrorView, type OwnerId, OwnerName, type OwnerThreadPage, type OwnerThreadView, OwnerTrackMessage, PasskeyAsserted, PasskeyCreated, type PasskeyCreationOptions, type PasskeyRequestOptions, type PreviewEcho, PreviewUnavailable, ProjectName, ProjectTrackMessage, type ReadEvent, type Ref0Client, RepoName, RepoUrl, type RepoView, type ScopeAction, SecretHash, SentryOrg, SentryRegion, SentryToken, type SettledApproval, SignInDestination, type StatementView, ThreadId, ThreadStage, type TrackClosed, type TrackSession, type TrackThread, TypedApprovalCode, type Welcome, WorkflowPreview, WrittenProject, commandLine, connectEndpoint, encodeSecret, hookTokenPrefix, hookUrl, isRef0Path, liveSocketUrl, projectParts, repoNameKey, surfaceOf };
94
94
  //# sourceMappingURL=client.d.mts.map
package/dist/client.mjs CHANGED
@@ -3353,14 +3353,10 @@ const durationOf = (least, most, bounds) => Schema.String.check(Schema.makeFilte
3353
3353
  /** A check run's timeout, as its file writes it: 45 minutes unless it says, and 6 hours at most. */
3354
3354
  const CheckRunTimeout = durationOf(1, 21600, "from a second to 6 hours");
3355
3355
  /**
3356
- * When ref0 starts a check itself: on each `change`, before the change joins `main`; on the
3357
- * merge queue's `tip`, before `main` moves, so it guards `main`; or on what `deployed`.
3356
+ * When ref0 starts a check itself: on each `change`, before the change joins `main`; or on the
3357
+ * merge queue's `tip`, before `main` moves, so it guards `main`.
3358
3358
  */
3359
- const CheckTrigger = Schema.Literals([
3360
- "change",
3361
- "tip",
3362
- "deployed"
3363
- ]);
3359
+ const CheckTrigger = Schema.Literals(["change", "tip"]);
3364
3360
  /**
3365
3361
  * Each time ref0 starts a check itself, each once: `['change', 'tip']` unless its file says, and
3366
3362
  * `[]` for a check other code calls or people run by hand. Whether any other start may make a new
@@ -6420,30 +6416,29 @@ const PasskeyList = Schema.Struct({
6420
6416
  var PasskeyRefused = class extends Schema.TaggedError()("PasskeyRefused", { nextStep: Schema.String }, { httpApiStatus: 400 }) {};
6421
6417
  //#endregion
6422
6418
  //#region ../contracts/src/attachments.ts
6423
- /**
6424
- * `ref0 connect`, as agent-connect builds it: a machine asks first, with no credential, to connect
6425
- * to one of an owner's agents, and its terminal shows a code; the owner's person types it under
6426
- * Waiting on you and answers, with their passkey for a yes; and the machine collects its host
6427
- * grant with a secret it made.
6428
- */
6419
+ /** A machine asks, a signed-in person claims and approves, and the answer returns to its terminal. */
6429
6420
  /** A machine's own word for itself: shown to the person as what it says, never as fact. */
6430
6421
  const MachineName = Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(64));
6431
6422
  /** The harness a machine says it connects for, never proof of what it runs. */
6432
6423
  const ConnectHarness = Schema.Literals(["claude-code", "codex"]);
6433
6424
  /**
6434
- * An attachment request: `ref0 connect --owner <name>` asking, with no credential, to connect this
6435
- * machine to one of that owner's agents. It names the owner, the machine, and the hashes of two
6436
- * secrets it made: the host grant's, which ref0 first sees when the grant is used, and another it
6437
- * collects with, so the grant's own secret never goes to ref0 before then. Its terminal shows the
6438
- * code its answer gives, which the owner's person types under Waiting on you.
6425
+ * A machine asks with no owner and sends hashes of its grant, collecting and link secrets.
6426
+ * The optional callback names only a loopback port and a random state segment, never a host.
6439
6427
  */
6440
6428
  const RequestAttachment = Schema.Struct({
6441
- owner: OwnerName,
6442
6429
  machine: MachineId,
6443
6430
  machineName: MachineName,
6444
6431
  harness: Schema.optionalKey(ConnectHarness),
6445
6432
  secretHash: SecretHash,
6446
- collectHash: SecretHash
6433
+ collectHash: SecretHash,
6434
+ linkHash: SecretHash,
6435
+ callback: Schema.optionalKey(Schema.Struct({
6436
+ port: Schema.Int.check(Schema.isBetween({
6437
+ minimum: 1024,
6438
+ maximum: 65535
6439
+ })),
6440
+ state: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_-]{22}$/))
6441
+ }))
6447
6442
  });
6448
6443
  /** An attachment request, as its person reads it once they type its code. */
6449
6444
  const AttachmentRequestView = Schema.Struct({
@@ -6776,7 +6771,7 @@ const ApprovalsWaiting = Schema.Struct({
6776
6771
  requests: Schema.Array(AttachmentRequestView)
6777
6772
  });
6778
6773
  /** Finding a terminal's request by the code it showed. */
6779
- const FindApproval = Schema.Struct({ code: TypedApprovalCode });
6774
+ const FindApproval = Schema.Union([Schema.Struct({ code: TypedApprovalCode }), Schema.Struct({ link: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_-]{22}$/)) })]);
6780
6775
  /**
6781
6776
  * Asking for the passkey's options to answer a request: a terminal's request needs its code
6782
6777
  * again, so its ID alone, which travels where its code doesn't, never answers it. A machine's
@@ -6846,6 +6841,18 @@ const ApprovalState = Schema.Union([
6846
6841
  ...Ran.fields
6847
6842
  })
6848
6843
  ]);
6844
+ /** Only the answering browser receives a machine's answer code; state reads never carry it. */
6845
+ const ApprovalAnswer = Schema.Union([
6846
+ Schema.Struct({
6847
+ ...ApprovalState.members[1].fields,
6848
+ answerCode: ApprovalCode
6849
+ }),
6850
+ Schema.Struct({
6851
+ ...ApprovalState.members[4].fields,
6852
+ answerCode: ApprovalCode
6853
+ }),
6854
+ ApprovalState
6855
+ ]);
6849
6856
  /** A request that isn't there, or isn't the caller's to see, answers the same. */
6850
6857
  var ApprovalNotFound = class extends Schema.TaggedError()("ApprovalNotFound", { nextStep: Schema.String }, { httpApiStatus: 404 }) {};
6851
6858
  /** Too many asked, or too many codes typed, from here in the last hour. */
@@ -6865,6 +6872,8 @@ Schema.Struct({
6865
6872
  /** When the request expires, in epoch milliseconds. */
6866
6873
  deadline: Schema.Int,
6867
6874
  challenge: Schema.String,
6875
+ /** A machine answer retries only from its answering session, with this key. */
6876
+ answerKey: Schema.optionalKey(RequestId),
6868
6877
  /** An agent's ask: the credential it asked with, checked again before the answer counts. */
6869
6878
  asking: Schema.optionalKey(TokenId),
6870
6879
  /** The kind of action the person, answering, let agents take without asking from now on. */
@@ -6882,7 +6891,8 @@ Schema.Union([Schema.Struct({ denied: Schema.Literal(true) }), Schema.Struct({
6882
6891
  })]);
6883
6892
  Schema.Union([Schema.Struct({
6884
6893
  admitted: Schema.Literal(true),
6885
- admittedAt: Schema.Int
6894
+ admittedAt: Schema.Int,
6895
+ answerCode: Schema.optionalKey(ApprovalCode)
6886
6896
  }), Schema.Struct({
6887
6897
  admitted: Schema.Literal(false),
6888
6898
  reason: Schema.Literals([
@@ -10660,7 +10670,16 @@ const DeliveryTake = Schema.Struct({
10660
10670
  */
10661
10671
  requestKey: Schema.String.check(Schema.isBetweenLength(1, 256)),
10662
10672
  /** Its place in the session's order, so a take from a process that's been replaced is refused. */
10663
- seq: HookSeq
10673
+ seq: HookSeq,
10674
+ /**
10675
+ * The UTF-8 bytes `ref0 mcp` keeps in this hook's answer for text of its own, a notice of what
10676
+ * merged into the session's base, at most one item's. The ledger's items fit beside it, unless
10677
+ * one wouldn't: then they take the room, and the text waits whole for the next hook.
10678
+ */
10679
+ reserved: Schema.optionalKey(Schema.Int.check(Schema.isBetween({
10680
+ minimum: 1,
10681
+ maximum: 7600
10682
+ })))
10664
10683
  });
10665
10684
  /**
10666
10685
  * One item handed to a hook: its key, kind and text, rendered when it's taken, after who may
@@ -10689,6 +10708,15 @@ const DeliveriesTaken = Schema.Struct({
10689
10708
  left: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
10690
10709
  });
10691
10710
  /**
10711
+ * What a hook's take answers: what it hands, and whether the bytes it reserved are still free
10712
+ * beside that. Not when a ledger item needed them, so the text they were kept for waits whole
10713
+ * for the next hook. Kept when none were reserved.
10714
+ */
10715
+ const HookTaken = Schema.Struct({
10716
+ ...DeliveriesTaken.fields,
10717
+ reservedKept: Schema.Boolean
10718
+ });
10719
+ /**
10692
10720
  * A take refused: the session ended, or the hook message is older than one its session already
10693
10721
  * sent, from a `ref0 mcp` that's since been replaced. Nothing is handed over.
10694
10722
  */
@@ -10708,8 +10736,8 @@ Schema.Struct({
10708
10736
  Schema.Union([DeliveriesTaken, TakeRefused]);
10709
10737
  /**
10710
10738
  * Where a take's notices may go once the Project DO has handed its own: the UTF-8 bytes left
10711
- * in the hook's answer, and the repos whose Repo DOs owe the session one. Absent when the hook
10712
- * can't carry a notice.
10739
+ * in the hook's answer, past any it kept reserved, and the repos whose Repo DOs owe the session
10740
+ * one. Absent when the hook can't carry a notice.
10713
10741
  */
10714
10742
  const NoticeRoom = Schema.Struct({
10715
10743
  room: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
@@ -10719,7 +10747,7 @@ const NoticeRoom = Schema.Struct({
10719
10747
  });
10720
10748
  /** What the Project DO's take answers the Worker: its own attempts, and where notices may go. */
10721
10749
  const ProjectDeliveriesTaken = Schema.Struct({
10722
- ...DeliveriesTaken.fields,
10750
+ ...HookTaken.fields,
10723
10751
  notices: Schema.optionalKey(NoticeRoom)
10724
10752
  });
10725
10753
  Schema.Union([ProjectDeliveriesTaken, TakeRefused]);
@@ -11658,6 +11686,70 @@ Schema.Union([
11658
11686
  NotPermitted
11659
11687
  ]);
11660
11688
  //#endregion
11689
+ //#region ../contracts/src/session-base.ts
11690
+ /**
11691
+ * A session's base in a repo: what its work there builds on now, read from its live fork. That's
11692
+ * the pin of the thread its thread is stacked on, when that thread has one in the repo, and
11693
+ * otherwise `main`. `ref0 sync` merges it, and the local check checks the agent's work against it.
11694
+ */
11695
+ /** What a base is: `main`, or the thread this one is stacked on, by its number. */
11696
+ const BaseOn = Schema.Union([Schema.Literal("main"), Schema.Struct({ thread: ThreadNumber })]);
11697
+ /** A session's base, as `GET /v1/sessions/{session}/repos/{repo}/base` answers it. */
11698
+ const SessionBase = Schema.Struct({
11699
+ on: BaseOn,
11700
+ /** `main`'s tip, or the pin's commit: what `ref` reaches once fetched. */
11701
+ commit: CommitOid,
11702
+ /**
11703
+ * Where to fetch it from, on ref0's origin: the repo's own path, as `ref0 clone` cloned it, for
11704
+ * `main`; for a stack, the path of the fork that holds the pin.
11705
+ */
11706
+ path: Schema.String.check(Schema.isPattern(/^\/[^\s]+\.git$/), Schema.isMaxLength(512)),
11707
+ /** `path` on the app's one origin. A client checks it's a fork of its own repo there. */
11708
+ url: Schema.String,
11709
+ ref: Schema.Literal("refs/heads/main")
11710
+ });
11711
+ /**
11712
+ * No base to fetch: `main` has no commit yet, or the pin of the thread below is in a workflow
11713
+ * run's fork, which has no session's path to fetch from.
11714
+ */
11715
+ var NoBase = class extends Schema.TaggedError()("NoBase", {
11716
+ why: Schema.Literals(["main empty", "held by a run"]),
11717
+ nextStep: Schema.String
11718
+ }, { httpApiStatus: 404 }) {};
11719
+ Schema.Struct({
11720
+ session: SessionId,
11721
+ /**
11722
+ * For an agent that sees only threads it holds a grant on, those threads: a session whose
11723
+ * thread is stacked, at any depth, on any other is refused, as its base holds that thread's
11724
+ * work. Unset for one that sees the project as a whole.
11725
+ */
11726
+ only: Schema.optionalKey(Schema.Array(ThreadId))
11727
+ });
11728
+ /** The base on `main`, at its tip. */
11729
+ const BaseOnMain = Schema.Struct({
11730
+ on: Schema.Literal("main"),
11731
+ commit: CommitOid
11732
+ });
11733
+ /**
11734
+ * The base on the thread below, `lower`: its pin's commit, the fork that holds it, and that
11735
+ * fork's session, or none for a workflow run's fork.
11736
+ */
11737
+ const BaseOnStack = Schema.Struct({
11738
+ on: Schema.Literal("stack"),
11739
+ lower: ThreadId,
11740
+ commit: CommitOid,
11741
+ fork: ForkId,
11742
+ session: Schema.NullOr(SessionId)
11743
+ });
11744
+ Schema.Union([
11745
+ BaseOnMain,
11746
+ BaseOnStack,
11747
+ NoFork,
11748
+ NoBase,
11749
+ RepoNotReady,
11750
+ NotPermitted
11751
+ ]);
11752
+ //#endregion
11661
11753
  //#region ../contracts/src/gate-views.ts
11662
11754
  /**
11663
11755
  * A pull request's gate, as `ref0 gate` reads it: its current version, whether its needs are
@@ -14870,12 +14962,14 @@ var MachineAttachmentsGroup = class extends HttpApiGroup.make("machineAttachment
14870
14962
  SlowDown,
14871
14963
  AuthorityUnavailable
14872
14964
  ]
14873
- }), HttpApiEndpoint.get("collect", "/v1/attachments/requests/:approval/result", {
14965
+ }), HttpApiEndpoint.post("collect", "/v1/attachments/requests/:approval/result", {
14874
14966
  params: { approval: ApprovalId },
14967
+ payload: Schema.Struct({ answerCode: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(64))) }),
14875
14968
  success: RequestState,
14876
14969
  error: [AttachmentNotFound, AuthorityUnavailable]
14877
14970
  }).middleware(ApprovalSecret), HttpApiEndpoint.post("confirm", "/v1/attachments/requests/:approval/collected", {
14878
14971
  params: { approval: ApprovalId },
14972
+ payload: Schema.Struct({ answerCode: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(64))) }),
14879
14973
  headers: idempotency,
14880
14974
  success: RequestConfirmed,
14881
14975
  error: [AttachmentNotFound, AuthorityUnavailable]
@@ -14925,7 +15019,7 @@ var ApprovalsGroup = class extends HttpApiGroup.make("approvals").add(HttpApiEnd
14925
15019
  params: { approval: ApprovalId },
14926
15020
  headers: idempotency,
14927
15021
  payload: AnswerApproval,
14928
- success: ApprovalState,
15022
+ success: ApprovalAnswer,
14929
15023
  error: [
14930
15024
  ApprovalNotFound,
14931
15025
  NotPermitted,
@@ -15154,6 +15248,19 @@ var SessionsGroup = class extends HttpApiGroup.make("sessions").add(HttpApiEndpo
15154
15248
  RepoNotReady,
15155
15249
  NotPermitted
15156
15250
  ]
15251
+ }), HttpApiEndpoint.get("base", "/:session/repos/:repo/base", {
15252
+ params: {
15253
+ session: SessionId,
15254
+ repo: RepoName
15255
+ },
15256
+ success: SessionBase,
15257
+ error: [
15258
+ RepoNotFound,
15259
+ RepoNotReady,
15260
+ NotPermitted,
15261
+ NoFork,
15262
+ NoBase
15263
+ ]
15157
15264
  }), HttpApiEndpoint.post("openPull", "/:session/repos/:repo/pulls", {
15158
15265
  params: {
15159
15266
  session: SessionId,
@@ -15272,7 +15379,7 @@ var SessionsGroup = class extends HttpApiGroup.make("sessions").add(HttpApiEndpo
15272
15379
  }), HttpApiEndpoint.post("take", "/:session/deliveries/take", {
15273
15380
  params: onSession,
15274
15381
  payload: DeliveryTake,
15275
- success: DeliveriesTaken,
15382
+ success: HookTaken,
15276
15383
  error: [TakeRefused, NotPermitted]
15277
15384
  }), HttpApiEndpoint.post("report", "/:session/deliveries/report", {
15278
15385
  params: onSession,
@@ -16863,6 +16970,15 @@ const ownSurfaces = {
16863
16970
  cli: "clone",
16864
16971
  mcp: "repo_fork"
16865
16972
  },
16973
+ "sessions.base": {
16974
+ action: "project:read",
16975
+ actors: "agent",
16976
+ target: "session",
16977
+ stepUp: "never",
16978
+ asks: "never",
16979
+ cli: "sync",
16980
+ mcp: null
16981
+ },
16866
16982
  "sessions.openPull": {
16867
16983
  action: "session:change",
16868
16984
  actors: "agent",
@@ -434,6 +434,32 @@ declare const ApprovalState: Schema.Union<readonly [Schema.Struct<{
434
434
  readonly endpoint: Schema.String;
435
435
  }>]>;
436
436
  type ApprovalState = typeof ApprovalState.Type;
437
+ /** Only the answering browser receives a machine's answer code; state reads never carry it. */
438
+ declare const ApprovalAnswer: Schema.Union<readonly [Schema.Struct<{
439
+ readonly state: Schema.Literal<"approved">;
440
+ readonly answerCode: Schema.String;
441
+ }>, Schema.Struct<{
442
+ readonly status: Schema.Int;
443
+ readonly result: Schema.Codec<Schema.Json, Schema.Json, never, never>;
444
+ readonly state: Schema.Literal<"ran">;
445
+ readonly endpoint: Schema.String;
446
+ readonly answerCode: Schema.String;
447
+ }>, Schema.Union<readonly [Schema.Struct<{
448
+ readonly state: Schema.Literal<"waiting">;
449
+ readonly expiresAt: Schema.DateTimeUtcFromString;
450
+ }>, Schema.Struct<{
451
+ readonly state: Schema.Literal<"approved">;
452
+ }>, Schema.Struct<{
453
+ readonly state: Schema.Literal<"refused">;
454
+ }>, Schema.Struct<{
455
+ readonly state: Schema.Literal<"expired">;
456
+ }>, Schema.Struct<{
457
+ readonly status: Schema.Int;
458
+ readonly result: Schema.Codec<Schema.Json, Schema.Json, never, never>;
459
+ readonly state: Schema.Literal<"ran">;
460
+ readonly endpoint: Schema.String;
461
+ }>]>]>;
462
+ type ApprovalAnswer = typeof ApprovalAnswer.Type;
437
463
  declare const ApprovalNotFound_base: Schema.Class<ApprovalNotFound, Schema.TaggedStruct<"ApprovalNotFound", {
438
464
  readonly nextStep: Schema.String;
439
465
  }>, import("effect/Cause").YieldableError>;
@@ -1144,6 +1170,52 @@ type ApprovalId = typeof ApprovalId.Type;
1144
1170
  */
1145
1171
  declare const ConnectionId: Schema.brand<Schema.TemplateLiteral<readonly ["connection_", Schema.String]>, "ConnectionId">;
1146
1172
  type ConnectionId = typeof ConnectionId.Type;
1173
+ declare const RepoNotReady_base: Schema.Class<RepoNotReady, Schema.TaggedStruct<"RepoNotReady", {
1174
+ readonly nextStep: Schema.String;
1175
+ }>, import("effect/Cause").YieldableError>;
1176
+ /** A repo whose baseline isn't readable yet: Git is told to try again in a few seconds. */
1177
+ declare class RepoNotReady extends RepoNotReady_base {}
1178
+ /** An owner's name, a person's or an organization's. One set of names for both, as on GitHub. */
1179
+ declare const OwnerName: Schema.brand<Schema.String, "OwnerName">;
1180
+ type OwnerName = typeof OwnerName.Type;
1181
+ /** A project's name. It shares one set of names with its owner's repos. */
1182
+ declare const ProjectName: Schema.brand<Schema.String, "ProjectName">;
1183
+ type ProjectName = typeof ProjectName.Type;
1184
+ declare const RepoName: Schema.brand<Schema.String, "RepoName">;
1185
+ type RepoName = typeof RepoName.Type;
1186
+ /** An agent's handle: unique within its owner, renamable, and always shown with whose it is. */
1187
+ declare const AgentHandle: Schema.brand<Schema.String, "AgentHandle">;
1188
+ type AgentHandle = typeof AgentHandle.Type;
1189
+ //#endregion
1190
+ //#region src/routes.d.ts
1191
+ /**
1192
+ * ref0's one origin, as a client is given it: `http` or `https`, a host and maybe a port, and no
1193
+ * credentials, path, query or fragment. That pattern alone lets through a host or port no URL has,
1194
+ * such as `https://1.2.3.999`, `https://[1::2::3]` or `https://ref0.test:99999`, so the platform's own URL parser must take
1195
+ * it too. It's kept as written, case and any default port too: every path here is appended to it
1196
+ * as it is.
1197
+ */
1198
+ declare const ApiOrigin: Schema.brand<Schema.String, "ApiOrigin">;
1199
+ type ApiOrigin = typeof ApiOrigin.Type;
1200
+ /**
1201
+ * Whether a path is Worker "server"'s to answer, not a page's: the API's, signing in's, a
1202
+ * connection's webhook, or OAuth's metadata.
1203
+ */
1204
+ declare const isRef0Path: (pathname: string) => boolean;
1205
+ declare const NoFork_base: Schema.Class<NoFork, Schema.TaggedStruct<"NoFork", {
1206
+ readonly nextStep: Schema.String;
1207
+ }>, import("effect/Cause").YieldableError>;
1208
+ /** No fork of this repo for that session: it hasn't asked for one. */
1209
+ declare class NoFork extends NoFork_base {}
1210
+ declare const NoBase_base: Schema.Class<NoBase, Schema.TaggedStruct<"NoBase", {
1211
+ readonly why: Schema.Literals<readonly ["main empty", "held by a run"]>;
1212
+ readonly nextStep: Schema.String;
1213
+ }>, import("effect/Cause").YieldableError>;
1214
+ /**
1215
+ * No base to fetch: `main` has no commit yet, or the pin of the thread below is in a workflow
1216
+ * run's fork, which has no session's path to fetch from.
1217
+ */
1218
+ declare class NoBase extends NoBase_base {}
1147
1219
  declare const PullRequestNotFound_base: Schema.Class<PullRequestNotFound, Schema.TaggedStruct<"PullRequestNotFound", {
1148
1220
  readonly nextStep: Schema.String;
1149
1221
  }>, import("effect/Cause").YieldableError>;
@@ -1408,11 +1480,6 @@ declare const AuthorizationNotFound_base: Schema.Class<AuthorizationNotFound, Sc
1408
1480
  }>, import("effect/Cause").YieldableError>;
1409
1481
  /** No such authorization: the attachment was never authorized here. */
1410
1482
  declare class AuthorizationNotFound extends AuthorizationNotFound_base {}
1411
- declare const RepoNotReady_base: Schema.Class<RepoNotReady, Schema.TaggedStruct<"RepoNotReady", {
1412
- readonly nextStep: Schema.String;
1413
- }>, import("effect/Cause").YieldableError>;
1414
- /** A repo whose baseline isn't readable yet: Git is told to try again in a few seconds. */
1415
- declare class RepoNotReady extends RepoNotReady_base {}
1416
1483
  declare const IntentSourceNotFound_base: Schema.Class<IntentSourceNotFound, Schema.TaggedStruct<"IntentSourceNotFound", {
1417
1484
  readonly nextStep: Schema.String;
1418
1485
  }>, import("effect/Cause").YieldableError>;
@@ -1433,17 +1500,6 @@ declare const CommentRecipientNotFound_base: Schema.Class<CommentRecipientNotFou
1433
1500
  }>, import("effect/Cause").YieldableError>;
1434
1501
  /** A session a comment is to that isn't one of this thread's. */
1435
1502
  declare class CommentRecipientNotFound extends CommentRecipientNotFound_base {}
1436
- /** An owner's name, a person's or an organization's. One set of names for both, as on GitHub. */
1437
- declare const OwnerName: Schema.brand<Schema.String, "OwnerName">;
1438
- type OwnerName = typeof OwnerName.Type;
1439
- /** A project's name. It shares one set of names with its owner's repos. */
1440
- declare const ProjectName: Schema.brand<Schema.String, "ProjectName">;
1441
- type ProjectName = typeof ProjectName.Type;
1442
- declare const RepoName: Schema.brand<Schema.String, "RepoName">;
1443
- type RepoName = typeof RepoName.Type;
1444
- /** An agent's handle: unique within its owner, renamable, and always shown with whose it is. */
1445
- declare const AgentHandle: Schema.brand<Schema.String, "AgentHandle">;
1446
- type AgentHandle = typeof AgentHandle.Type;
1447
1503
  //#endregion
1448
1504
  //#region src/repos.d.ts
1449
1505
  /**
@@ -1921,7 +1977,15 @@ declare const PasskeysGroup_base: HttpApiGroup.HttpApiGroup<"passkeys", HttpApiE
1921
1977
  }>>;
1922
1978
  readonly hints: Schema.optionalKey<Schema.$Array<Schema.Literals<readonly ["hybrid", "security-key", "client-device"]>>>;
1923
1979
  readonly attestation: Schema.optionalKey<Schema.Literals<readonly ["direct", "enterprise", "indirect", "none"]>>;
1924
- }>>, Schema.toCodecJson<typeof AuthorityUnavailable | typeof PasskeyRefused>, Authorization, never> | HttpApiEndpoint.HttpApiEndpoint<"enrolFirst", "POST", "/v1/me/passkeys/first", never, never, Schema.toCodecJson<Schema.Struct<{
1980
+ }>>, Schema.toCodecJson<typeof AuthorityUnavailable | typeof PasskeyRefused>, Authorization, never> | HttpApiEndpoint.HttpApiEndpoint<"list", "GET", "/v1/me/passkeys", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
1981
+ readonly passkeys: Schema.$Array<Schema.Struct<{
1982
+ readonly passkey: Schema.brand<Schema.TemplateLiteral<readonly ["passkey_", Schema.String]>, "PasskeyId">;
1983
+ readonly name: Schema.optionalKey<Schema.String>;
1984
+ readonly createdAt: Schema.String;
1985
+ readonly backedUp: Schema.Boolean;
1986
+ }>>;
1987
+ readonly approvesHere: Schema.Boolean;
1988
+ }>>, Schema.toCodecJson<typeof NotPermitted | typeof AuthorityUnavailable>, Authorization, never> | HttpApiEndpoint.HttpApiEndpoint<"enrolFirst", "POST", "/v1/me/passkeys/first", never, never, Schema.toCodecJson<Schema.Struct<{
1925
1989
  readonly id: Schema.String;
1926
1990
  readonly rawId: Schema.String;
1927
1991
  readonly type: Schema.Literal<"public-key">;
@@ -1943,15 +2007,7 @@ declare const PasskeysGroup_base: HttpApiGroup.HttpApiGroup<"passkeys", HttpApiE
1943
2007
  'idempotency-key': Schema.brand<Schema.TemplateLiteral<readonly ["request_", Schema.String]>, "RequestId">;
1944
2008
  }>>, Schema.toCodecJson<Schema.Struct<{
1945
2009
  readonly passkey: Schema.brand<Schema.TemplateLiteral<readonly ["passkey_", Schema.String]>, "PasskeyId">;
1946
- }>>, Schema.toCodecJson<typeof AuthorityUnavailable | typeof PasskeyRefused>, Authorization, never> | HttpApiEndpoint.HttpApiEndpoint<"list", "GET", "/v1/me/passkeys", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
1947
- readonly passkeys: Schema.$Array<Schema.Struct<{
1948
- readonly passkey: Schema.brand<Schema.TemplateLiteral<readonly ["passkey_", Schema.String]>, "PasskeyId">;
1949
- readonly name: Schema.optionalKey<Schema.String>;
1950
- readonly createdAt: Schema.String;
1951
- readonly backedUp: Schema.Boolean;
1952
- }>>;
1953
- readonly approvesHere: Schema.Boolean;
1954
- }>>, Schema.toCodecJson<typeof NotPermitted | typeof AuthorityUnavailable>, Authorization, never>, false>;
2010
+ }>>, Schema.toCodecJson<typeof AuthorityUnavailable | typeof PasskeyRefused>, Authorization, never>, false>;
1955
2011
  /**
1956
2012
  * A person's passkeys: listing them, and enrolling the first, which signing in asks for straight
1957
2013
  * away and a browser session does on its own, once. Every passkey after is an approval.
@@ -2063,9 +2119,11 @@ declare const MachineAttachmentsGroup_base: HttpApiGroup.HttpApiGroup<"machineAt
2063
2119
  readonly state: Schema.Literal<"failed">;
2064
2120
  readonly reason: Schema.Literals<readonly ["agent not found", "agent turned off", "agent changed", "handle taken", "session ended", "recovered", "not confirmed"]>;
2065
2121
  readonly nextStep: Schema.String;
2066
- }>]>>, Schema.toCodecJson<typeof AuthorityUnavailable | typeof AttachmentNotFound>, ApprovalSecret, never> | HttpApiEndpoint.HttpApiEndpoint<"collect", "GET", "/v1/attachments/requests/:approval/result", Schema.toCodecStringTree<Schema.Struct<{
2122
+ }>]>>, Schema.toCodecJson<typeof AuthorityUnavailable | typeof AttachmentNotFound>, ApprovalSecret, never> | HttpApiEndpoint.HttpApiEndpoint<"collect", "POST", "/v1/attachments/requests/:approval/result", Schema.toCodecStringTree<Schema.Struct<{
2067
2123
  approval: Schema.brand<Schema.TemplateLiteral<readonly ["approval_", Schema.String]>, "ApprovalId">;
2068
- }>>, never, never, never, Schema.toCodecJson<Schema.Union<readonly [Schema.Struct<{
2124
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
2125
+ readonly answerCode: Schema.optionalKey<Schema.String>;
2126
+ }>>, never, Schema.toCodecJson<Schema.Union<readonly [Schema.Struct<{
2069
2127
  readonly state: Schema.Literal<"waiting">;
2070
2128
  readonly expiresAt: Schema.DateTimeUtcFromString;
2071
2129
  }>, Schema.Struct<{
@@ -2097,17 +2155,23 @@ declare const MachineAttachmentsGroup_base: HttpApiGroup.HttpApiGroup<"machineAt
2097
2155
  readonly nextStep: Schema.String;
2098
2156
  }>]>>, Schema.toCodecJson<typeof AuthorityUnavailable | typeof AttachmentNotFound>, ApprovalSecret, never> | HttpApiEndpoint.HttpApiEndpoint<"confirm", "POST", "/v1/attachments/requests/:approval/collected", Schema.toCodecStringTree<Schema.Struct<{
2099
2157
  approval: Schema.brand<Schema.TemplateLiteral<readonly ["approval_", Schema.String]>, "ApprovalId">;
2100
- }>>, never, never, Schema.toCodecStringTree<Schema.Struct<{
2158
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
2159
+ readonly answerCode: Schema.optionalKey<Schema.String>;
2160
+ }>>, Schema.toCodecStringTree<Schema.Struct<{
2101
2161
  'idempotency-key': Schema.brand<Schema.TemplateLiteral<readonly ["request_", Schema.String]>, "RequestId">;
2102
2162
  }>>, Schema.toCodecJson<Schema.Struct<{
2103
2163
  readonly confirmed: Schema.Boolean;
2104
2164
  }>>, Schema.toCodecJson<typeof AuthorityUnavailable | typeof AttachmentNotFound>, ApprovalSecret, never> | HttpApiEndpoint.HttpApiEndpoint<"request", "POST", "/v1/attachments/requests", never, never, Schema.toCodecJson<Schema.Struct<{
2105
- readonly owner: Schema.brand<Schema.String, "OwnerName">;
2106
2165
  readonly machine: Schema.brand<Schema.TemplateLiteral<readonly ["machine_", Schema.String]>, "MachineId">;
2107
2166
  readonly machineName: Schema.String;
2108
2167
  readonly harness: Schema.optionalKey<Schema.Literals<readonly ["claude-code", "codex"]>>;
2109
2168
  readonly secretHash: Schema.brand<Schema.String, "SecretHash">;
2110
2169
  readonly collectHash: Schema.brand<Schema.String, "SecretHash">;
2170
+ readonly linkHash: Schema.brand<Schema.String, "SecretHash">;
2171
+ readonly callback: Schema.optionalKey<Schema.Struct<{
2172
+ readonly port: Schema.Int;
2173
+ readonly state: Schema.String;
2174
+ }>>;
2111
2175
  }>>, Schema.toCodecStringTree<Schema.Struct<{
2112
2176
  'idempotency-key': Schema.brand<Schema.TemplateLiteral<readonly ["request_", Schema.String]>, "RequestId">;
2113
2177
  }>>, Schema.toCodecJson<Schema.Struct<{
@@ -2366,9 +2430,11 @@ declare const ApprovalsGroup_base: HttpApiGroup.HttpApiGroup<"approvals", HttpAp
2366
2430
  readonly askedAt: Schema.DateTimeUtcFromString;
2367
2431
  readonly expiresAt: Schema.DateTimeUtcFromString;
2368
2432
  }>>;
2369
- }>>, Schema.toCodecJson<typeof NotPermitted | typeof AuthorityUnavailable>, Authorization, never> | HttpApiEndpoint.HttpApiEndpoint<"find", "POST", "/v1/approvals/find", never, never, Schema.toCodecJson<Schema.Struct<{
2433
+ }>>, Schema.toCodecJson<typeof NotPermitted | typeof AuthorityUnavailable>, Authorization, never> | HttpApiEndpoint.HttpApiEndpoint<"find", "POST", "/v1/approvals/find", never, never, Schema.toCodecJson<Schema.Union<readonly [Schema.Struct<{
2370
2434
  readonly code: Schema.String;
2371
- }>>, Schema.toCodecStringTree<Schema.Struct<{
2435
+ }>, Schema.Struct<{
2436
+ readonly link: Schema.String;
2437
+ }>]>>, Schema.toCodecStringTree<Schema.Struct<{
2372
2438
  'idempotency-key': Schema.brand<Schema.TemplateLiteral<readonly ["request_", Schema.String]>, "RequestId">;
2373
2439
  }>>, Schema.toCodecJson<Schema.Union<readonly [Schema.Struct<{
2374
2440
  readonly approval: Schema.brand<Schema.TemplateLiteral<readonly ["approval_", Schema.String]>, "ApprovalId">;
@@ -2727,6 +2793,15 @@ declare const ApprovalsGroup_base: HttpApiGroup.HttpApiGroup<"approvals", HttpAp
2727
2793
  }>]>>, Schema.toCodecStringTree<Schema.Struct<{
2728
2794
  'idempotency-key': Schema.brand<Schema.TemplateLiteral<readonly ["request_", Schema.String]>, "RequestId">;
2729
2795
  }>>, Schema.toCodecJson<Schema.Union<readonly [Schema.Struct<{
2796
+ readonly state: Schema.Literal<"approved">;
2797
+ readonly answerCode: Schema.String;
2798
+ }>, Schema.Struct<{
2799
+ readonly status: Schema.Int;
2800
+ readonly result: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2801
+ readonly state: Schema.Literal<"ran">;
2802
+ readonly endpoint: Schema.String;
2803
+ readonly answerCode: Schema.String;
2804
+ }>, Schema.Union<readonly [Schema.Struct<{
2730
2805
  readonly state: Schema.Literal<"waiting">;
2731
2806
  readonly expiresAt: Schema.DateTimeUtcFromString;
2732
2807
  }>, Schema.Struct<{
@@ -2740,7 +2815,7 @@ declare const ApprovalsGroup_base: HttpApiGroup.HttpApiGroup<"approvals", HttpAp
2740
2815
  readonly result: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2741
2816
  readonly state: Schema.Literal<"ran">;
2742
2817
  readonly endpoint: Schema.String;
2743
- }>]>>, Schema.toCodecJson<typeof NotPermitted | typeof AuthorityUnavailable | typeof ApprovalStale | typeof PreviewNotReady | typeof PasskeyRefused | typeof ApprovalNotFound>, Authorization, never>, false>;
2818
+ }>]>]>>, Schema.toCodecJson<typeof NotPermitted | typeof AuthorityUnavailable | typeof ApprovalStale | typeof PreviewNotReady | typeof PasskeyRefused | typeof ApprovalNotFound>, Authorization, never>, false>;
2744
2819
  /**
2745
2820
  * A person's side of approvals, in an approving browser: what waits for them, finding a
2746
2821
  * terminal's request or a machine's attachment request by its code, and answering one, with
@@ -4343,7 +4418,18 @@ declare const OrgThreadsGroup_base: HttpApiGroup.HttpApiGroup<"orgThreads", Http
4343
4418
  * endpoint but the list, which is the owner's, `ownerThreads.list`.
4344
4419
  */
4345
4420
  declare class OrgThreadsGroup extends OrgThreadsGroup_base {}
4346
- declare const SessionsGroup_base: HttpApiGroup.HttpApiGroup<"sessions", HttpApiEndpoint.HttpApiEndpoint<"blockers", "GET", "/v1/sessions/:session/blockers", Schema.toCodecStringTree<Schema.Struct<{
4421
+ declare const SessionsGroup_base: HttpApiGroup.HttpApiGroup<"sessions", HttpApiEndpoint.HttpApiEndpoint<"base", "GET", "/v1/sessions/:session/repos/:repo/base", Schema.toCodecStringTree<Schema.Struct<{
4422
+ session: Schema.brand<Schema.TemplateLiteral<readonly ["session_", Schema.String]>, "SessionId">;
4423
+ repo: Schema.brand<Schema.String, "RepoName">;
4424
+ }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
4425
+ readonly on: Schema.Union<readonly [Schema.Literal<"main">, Schema.Struct<{
4426
+ readonly thread: Schema.Int;
4427
+ }>]>;
4428
+ readonly commit: Schema.brand<Schema.String, "CommitOid">;
4429
+ readonly path: Schema.String;
4430
+ readonly url: Schema.String;
4431
+ readonly ref: Schema.Literal<"refs/heads/main">;
4432
+ }>>, Schema.toCodecJson<typeof NotPermitted | typeof RepoNotFound | typeof RepoNotReady | typeof NoFork | typeof NoBase>, Authorization, never> | HttpApiEndpoint.HttpApiEndpoint<"blockers", "GET", "/v1/sessions/:session/blockers", Schema.toCodecStringTree<Schema.Struct<{
4347
4433
  session: Schema.brand<Schema.TemplateLiteral<readonly ["session_", Schema.String]>, "SessionId">;
4348
4434
  }>>, Schema.toCodecStringTree<Schema.Struct<{
4349
4435
  wait: Schema.optionalKey<Schema.Int>;
@@ -4801,6 +4887,7 @@ declare const SessionsGroup_base: HttpApiGroup.HttpApiGroup<"sessions", HttpApiE
4801
4887
  readonly generation: Schema.Int;
4802
4888
  readonly counter: Schema.Int;
4803
4889
  }>;
4890
+ readonly reserved: Schema.optionalKey<Schema.Int>;
4804
4891
  }>>, never, Schema.toCodecJson<Schema.Struct<{
4805
4892
  readonly attempts: Schema.$Array<Schema.Struct<{
4806
4893
  readonly key: Schema.Union<readonly [Schema.Struct<{
@@ -4822,6 +4909,7 @@ declare const SessionsGroup_base: HttpApiGroup.HttpApiGroup<"sessions", HttpApiE
4822
4909
  readonly mayRepeat: Schema.Boolean;
4823
4910
  }>>;
4824
4911
  readonly left: Schema.Int;
4912
+ readonly reservedKept: Schema.Boolean;
4825
4913
  }>>, Schema.toCodecJson<typeof NotPermitted | typeof TakeRefused>, Authorization, never> | HttpApiEndpoint.HttpApiEndpoint<"tasks", "PUT", "/v1/sessions/:session/tasks", Schema.toCodecStringTree<Schema.Struct<{
4826
4914
  session: Schema.brand<Schema.TemplateLiteral<readonly ["session_", Schema.String]>, "SessionId">;
4827
4915
  }>>, never, Schema.toCodecJson<Schema.Struct<{
@@ -19965,7 +20053,7 @@ interface GateOwn {
19965
20053
  * `[]` for a check other code calls or people run by hand. Whether any other start may make a new
19966
20054
  * run is its start rule's.
19967
20055
  */
19968
- declare const CheckOn: Schema.$Array<Schema.Literals<readonly ["change", "tip", "deployed"]>>;
20056
+ declare const CheckOn: Schema.$Array<Schema.Literals<readonly ["change", "tip"]>>;
19969
20057
  type CheckOn = typeof CheckOn.Type;
19970
20058
  /** A sandbox's size, each Cloudflare's instance type: `standard-1` unless its file says. */
19971
20059
  declare const SandboxSize: Schema.Literals<readonly ["standard-1", "standard-2", "standard-4"]>;
@@ -27115,22 +27203,6 @@ declare const ReadEvent: Schema.Union<readonly [Schema.Union<readonly [Schema.St
27115
27203
  readonly kind: Schema.String;
27116
27204
  }>]>;
27117
27205
  type ReadEvent = typeof ReadEvent.Type;
27118
- //#endregion
27119
- //#region src/routes.d.ts
27120
- /**
27121
- * ref0's one origin, as a client is given it: `http` or `https`, a host and maybe a port, and no
27122
- * credentials, path, query or fragment. That pattern alone lets through a host or port no URL has,
27123
- * such as `https://1.2.3.999`, `https://[1::2::3]` or `https://ref0.test:99999`, so the platform's own URL parser must take
27124
- * it too. It's kept as written, case and any default port too: every path here is appended to it
27125
- * as it is.
27126
- */
27127
- declare const ApiOrigin: Schema.brand<Schema.String, "ApiOrigin">;
27128
- type ApiOrigin = typeof ApiOrigin.Type;
27129
- /**
27130
- * Whether a path is Worker "server"'s to answer, not a page's: the API's, signing in's, a
27131
- * connection's webhook, or OAuth's metadata.
27132
- */
27133
- declare const isRef0Path: (pathname: string) => boolean;
27134
27206
  /**
27135
27207
  * A track as its socket's URL names it: `session:<session>`, `owner:<owner>`, and so on. Any
27136
27208
  * string crosses the wire as one; `trackFromName` says whether it names a track.
@@ -28909,5 +28981,5 @@ declare const SandboxExecAnswer: Schema.Union<readonly [Schema.Struct<{
28909
28981
  }>]>;
28910
28982
  type SandboxExecAnswer = typeof SandboxExecAnswer.Type;
28911
28983
  //#endregion
28912
- export { OwnerThreadView as $, WorkflowCallRefused as $t, ConnectionView as A, WorkflowText as An, SignedIn as At, GetIssueInput as B, liveSocketUrl as Bn, TypedApprovalCode as Bt, ConnectChosen as C, WorkflowPermissions as Cn, SandboxSize as Ct, ConnectionChanged as D, WorkflowRequestRefusal as Dn, SentryRegion as Dt, ConnectionCallAnswer as E, WorkflowPullRequestOpen as En, SentryOrg as Et, EndpointName as F, connectEndpoint as Fn, ThreadId as Ft, LiveTrackName as G, WorkflowAnswerer as Gt, ImportFailure as H, repoNameKey as Hn, Welcome as Ht, EventRunInput as I, encodeSecret as In, ThreadStage as It, MirrorEntry as J, WorkflowCall as Jt, MachineConnected as K, WorkflowAsk as Kt, ForkAnswer as L, hookTokenPrefix as Ln, TrackClosed as Lt, ConsentClient as M, WorkflowTrigger as Mn, StartActor as Mt, ConsentProject as N, WrittenProject as Nn, StartRun as Nt, ConnectionKind as O, WorkflowStartEnded as On, SentryToken as Ot, CredentialView as P, commandLine as Pn, StatementView as Pt, OwnerThreadPage as Q, WorkflowCallRefusal as Qt, ForkCreate as R, hookUrl as Rn, TrackSession as Rt, ConnectAgent as S, WorkflowPasskeyState as Sn, SandboxPushAnswer as St, ConnectionCall as T, WorkflowPullRequestAnswer as Tn, SecretHash as Tt, LiveTicket as U, surfaceOf as Un, WorkflowAction as Ut, Harness as V, projectParts as Vn, VersionFile as Vt, LiveTicketRequest as W, WorkflowActionAnswer as Wt, OwnerId as X, WorkflowCallEnded as Xt, MirrorView as Y, WorkflowCallAnswer as Yt, OwnerName as Z, WorkflowCallInput as Zt, CheckRunError as _, WorkflowOwn as _n, SandboxExec as _t, Api as a, WorkflowCheckResultsAnswer as an, PasskeyRefusal as at, ClientAccess as b, WorkflowPasskeyEnded as bn, SandboxOpenAnswer as bt, ApprovalPreview as c, WorkflowCheckStart as cn, PreviewUnavailable as ct, AttachmentFailed as d, WorkflowCheckStatesAnswer as dn, RanOf as dt, WorkflowCalledState as en, OwnerTrackMessage as et, AttachmentRequestView as f, WorkflowCheckWhere as fn, ReadEvent as ft, CheckOwn as g, WorkflowFilters as gn, RepoView as gt, CheckOn as h, WorkflowEvent as hn, RepoUrl as ht, AgentView as i, WorkflowCheckResults as in, PasskeyFrom as it, ConsentAsked as j, WorkflowThreadStart as jn, SocketUrl as jt, ConnectionName as k, WorkflowStartState as kn, SignInDestination as kt, ApprovalState as l, WorkflowCheckStartAnswer as ln, ProjectName as lt, ChangeAuthor as m, WorkflowConnections as mn, RepoName as mt, AgentPermissionChoice as n, WorkflowCheckRefusal as nn, PasskeyCreated as nt, ApiOrigin as o, WorkflowCheckRun as on, PasskeyRequestOptions as ot, Authorization as p, WorkflowComment as pn, Ref0Owned as pt, MirrorChoice as q, WorkflowAskClosed as qt, AgentPermissionSetting as r, WorkflowCheckRefused as rn, PasskeyCreationOptions as rt, ApprovalId as s, WorkflowCheckRunEnded as sn, PreviewEcho as st, AgentHandle as t, WorkflowCalledStateAnswer as tn, PasskeyAsserted as tt, ApprovalView as u, WorkflowCheckStates as un, ProjectTrackMessage as ut, CheckRunParams as v, WorkflowPasskeyAsk as vn, SandboxExecAnswer as vt, ConnectableAgent as w, WorkflowPreview as wn, ScopeAction as wt, ClientGranted as x, WorkflowPasskeyRead as xn, SandboxPush as xt, CheckTreeEntry as y, WorkflowPasskeyAsked as yn, SandboxOpen as yt, GateOwn as z, isRef0Path as zn, TrackThread as zt };
28913
- //# sourceMappingURL=index-Dns8tCkT.d.mts.map
28984
+ export { OwnerThreadPage as $, WorkflowCallRefusal as $t, ConnectionName as A, WorkflowStartState as An, SignInDestination as At, GateOwn as B, isRef0Path as Bn, TrackThread as Bt, ConnectAgent as C, WorkflowPasskeyState as Cn, SandboxPushAnswer as Ct, ConnectionCallAnswer as D, WorkflowPullRequestOpen as Dn, SentryOrg as Dt, ConnectionCall as E, WorkflowPullRequestAnswer as En, SecretHash as Et, CredentialView as F, commandLine as Fn, StatementView as Ft, LiveTicketRequest as G, WorkflowActionAnswer as Gt, Harness as H, projectParts as Hn, VersionFile as Ht, EndpointName as I, connectEndpoint as In, ThreadId as It, MirrorChoice as J, WorkflowAskClosed as Jt, LiveTrackName as K, WorkflowAnswerer as Kt, EventRunInput as L, encodeSecret as Ln, ThreadStage as Lt, ConsentAsked as M, WorkflowThreadStart as Mn, SocketUrl as Mt, ConsentClient as N, WorkflowTrigger as Nn, StartActor as Nt, ConnectionChanged as O, WorkflowRequestRefusal as On, SentryRegion as Ot, ConsentProject as P, WrittenProject as Pn, StartRun as Pt, OwnerName as Q, WorkflowCallInput as Qt, ForkAnswer as R, hookTokenPrefix as Rn, TrackClosed as Rt, ClientGranted as S, WorkflowPasskeyRead as Sn, SandboxPush as St, ConnectableAgent as T, WorkflowPreview as Tn, ScopeAction as Tt, ImportFailure as U, repoNameKey as Un, Welcome as Ut, GetIssueInput as V, liveSocketUrl as Vn, TypedApprovalCode as Vt, LiveTicket as W, surfaceOf as Wn, WorkflowAction as Wt, MirrorView as X, WorkflowCallAnswer as Xt, MirrorEntry as Y, WorkflowCall as Yt, OwnerId as Z, WorkflowCallEnded as Zt, CheckOwn as _, WorkflowFilters as _n, RepoView as _t, Api as a, WorkflowCheckResults as an, PasskeyFrom as at, CheckTreeEntry as b, WorkflowPasskeyAsked as bn, SandboxOpen as bt, ApprovalId as c, WorkflowCheckRunEnded as cn, PreviewEcho as ct, ApprovalView as d, WorkflowCheckStates as dn, ProjectTrackMessage as dt, WorkflowCallRefused as en, OwnerThreadView as et, AttachmentFailed as f, WorkflowCheckStatesAnswer as fn, RanOf as ft, CheckOn as g, WorkflowEvent as gn, RepoUrl as gt, ChangeAuthor as h, WorkflowConnections as hn, RepoName as ht, AgentView as i, WorkflowCheckRefused as in, PasskeyCreationOptions as it, ConnectionView as j, WorkflowText as jn, SignedIn as jt, ConnectionKind as k, WorkflowStartEnded as kn, SentryToken as kt, ApprovalPreview as l, WorkflowCheckStart as ln, PreviewUnavailable as lt, Authorization as m, WorkflowComment as mn, Ref0Owned as mt, AgentPermissionChoice as n, WorkflowCalledStateAnswer as nn, PasskeyAsserted as nt, ApiOrigin as o, WorkflowCheckResultsAnswer as on, PasskeyRefusal as ot, AttachmentRequestView as p, WorkflowCheckWhere as pn, ReadEvent as pt, MachineConnected as q, WorkflowAsk as qt, AgentPermissionSetting as r, WorkflowCheckRefusal as rn, PasskeyCreated as rt, ApprovalAnswer as s, WorkflowCheckRun as sn, PasskeyRequestOptions as st, AgentHandle as t, WorkflowCalledState as tn, OwnerTrackMessage as tt, ApprovalState as u, WorkflowCheckStartAnswer as un, ProjectName as ut, CheckRunError as v, WorkflowOwn as vn, SandboxExec as vt, ConnectChosen as w, WorkflowPermissions as wn, SandboxSize as wt, ClientAccess as x, WorkflowPasskeyEnded as xn, SandboxOpenAnswer as xt, CheckRunParams as y, WorkflowPasskeyAsk as yn, SandboxExecAnswer as yt, ForkCreate as z, hookUrl as zn, TrackSession as zt };
28985
+ //# sourceMappingURL=index-CJGX88qF.d.mts.map
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { An as WorkflowText, Ct as SandboxSize, Dn as WorkflowRequestRefusal, Gt as WorkflowAnswerer, Kt as WorkflowAsk, St as SandboxPushAnswer, Vt as VersionFile, at as PasskeyRefusal, it as PasskeyFrom$1, m as ChangeAuthor, pt as Ref0Owned, qt as WorkflowAskClosed, z as GateOwn } from "./index-Dns8tCkT.mjs";
2
- import { $ as StartActor, A as ForkOptions, B as WorkflowContext, C as Comment, D as EventWorkflow, E as EventOf, F as StepConfig, G as CalledWorkflow, H as text, I as StepContext, J as TreeEntry, K as JsonValue, L as ThreadStart, M as PullRequestAnswer, N as PullRequestOptions, O as EventWorkflowSpec, P as Ref0Actions, Q as Refusal, R as WaitType, S as CheckRunEnded, T as Duration, U as workflow, V as WorkflowStep, W as CalledRunFailed, X as Allow, Y as TreeRead, Z as CalledRun, _ as ActionAnswer, a as CheckRunOptions, at as allow, b as CalledContext, c as CheckRunResult, ct as Need, d as OneOfValues, et as StartContext, f as OutputResult, g as oneOf, h as check, i as CheckResult, it as StartRun, j as NeedAddOptions, k as ForkAnswer, l as CheckSpec, m as Step, n as Check, nt as StartOutput, o as CheckRunReference, ot as refuse, p as OutputSchema, q as Tree, r as CheckContext, rt as StartRule, s as CheckRunRefused, st as CheckNeed, t as Browser, tt as StartItem, u as DurationText, v as CallAnswer, w as ConnectionsOf, x as CalledWorkflowSpec, y as CallEnded, z as WaitedEvent } from "./browse-DBqoeS-u.mjs";
1
+ import { B as GateOwn, Ct as SandboxPushAnswer, Ht as VersionFile, Jt as WorkflowAskClosed, Kt as WorkflowAnswerer, On as WorkflowRequestRefusal, at as PasskeyFrom$1, h as ChangeAuthor, jn as WorkflowText, mt as Ref0Owned, ot as PasskeyRefusal, qt as WorkflowAsk, wt as SandboxSize } from "./index-CJGX88qF.mjs";
2
+ import { $ as StartActor, A as ForkOptions, B as WorkflowContext, C as Comment, D as EventWorkflow, E as EventOf, F as StepConfig, G as CalledWorkflow, H as text, I as StepContext, J as TreeEntry, K as JsonValue, L as ThreadStart, M as PullRequestAnswer, N as PullRequestOptions, O as EventWorkflowSpec, P as Ref0Actions, Q as Refusal, R as WaitType, S as CheckRunEnded, T as Duration, U as workflow, V as WorkflowStep, W as CalledRunFailed, X as Allow, Y as TreeRead, Z as CalledRun, _ as ActionAnswer, a as CheckRunOptions, at as allow, b as CalledContext, c as CheckRunResult, ct as Need, d as OneOfValues, et as StartContext, f as OutputResult, g as oneOf, h as check, i as CheckResult, it as StartRun, j as NeedAddOptions, k as ForkAnswer, l as CheckSpec, m as Step, n as Check, nt as StartOutput, o as CheckRunReference, ot as refuse, p as OutputSchema, q as Tree, r as CheckContext, rt as StartRule, s as CheckRunRefused, st as CheckNeed, t as Browser, tt as StartItem, u as DurationText, v as CallAnswer, w as ConnectionsOf, x as CalledWorkflowSpec, y as CallEnded, z as WaitedEvent } from "./browse-DHgV6DTF.mjs";
3
3
  //#region src/ask.d.ts
4
4
  /**
5
5
  * `ask`, ref0's leaf that asks someone a question and waits in the run for the answer, as a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ref0/sdk",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "What a repo's .ref0/ code imports to run on ref0, and ref0's HTTP client",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {