@ref0/sdk 0.7.0 → 0.9.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 WorkflowAskClosed, A as ConnectionCallAnswer, B as EventRunInput, Cn as WorkflowOwn, Ct as SandboxExec, Dn as WorkflowPasskeyRead, Dt as SandboxPush, En as WorkflowPasskeyEnded, Et as SandboxOpenAnswer, Fn as WorkflowStartState, G as GetIssueInput, H as ForkAnswer$1, Ht as ThreadStage, In as WorkflowText, Ln as WorkflowThreadStart, Mn as WorkflowPullRequestOpen, On as WorkflowPasskeyState, Ot as SandboxPushAnswer, Pn as WorkflowStartEnded, Rn as WorkflowTrigger, Rt as StartActor$1, Sn as WorkflowFilters, Tn as WorkflowPasskeyAsked, Tt as SandboxOpen, U as ForkCreate, Xt as WorkflowActionAnswer, Yt as WorkflowAction, _ as CheckOwn, _n as WorkflowCheckStatesAnswer, an as WorkflowCallRefused, b as CheckTreeEntry, bn as WorkflowConnections, cn as WorkflowCheckRefusal, dn as WorkflowCheckResultsAnswer, en as WorkflowCall, fn as WorkflowCheckRun, g as CheckOn, gn as WorkflowCheckStates, hn as WorkflowCheckStartAnswer, in as WorkflowCallRefusal, jn as WorkflowPullRequestAnswer, k as ConnectionCall, kn as WorkflowPermissions, ln as WorkflowCheckRefused, mn as WorkflowCheckStart, nn as WorkflowCallEnded, on as WorkflowCalledState, pn as WorkflowCheckRunEnded, rn as WorkflowCallInput, sn as WorkflowCalledStateAnswer, tn as WorkflowCallAnswer, un as WorkflowCheckResults, v as CheckRunError, vn as WorkflowCheckWhere, vt as Ref0Owned, wn as WorkflowPasskeyAsk, wt as SandboxExecAnswer, xn as WorkflowEvent, y as CheckRunParams, yn as WorkflowComment, zt as StartRun$1 } from "./index-Vb8-1Zk-.mjs";
1
+ import { $t as WorkflowAskClosed, A as ConnectionCallAnswer, B as EventRunInput, Cn as WorkflowOwn, Ct as SandboxExec, Dn as WorkflowPasskeyRead, Dt as SandboxPush, En as WorkflowPasskeyEnded, Et as SandboxOpenAnswer, Fn as WorkflowStartState, G as GetIssueInput, H as ForkAnswer$1, Ht as ThreadStage, In as WorkflowText, Ln as WorkflowThreadStart, Mn as WorkflowPullRequestOpen, On as WorkflowPasskeyState, Ot as SandboxPushAnswer, Pn as WorkflowStartEnded, Rn as WorkflowTrigger, Rt as StartActor$1, Sn as WorkflowFilters, Tn as WorkflowPasskeyAsked, Tt as SandboxOpen, U as ForkCreate, Xt as WorkflowActionAnswer, Yt as WorkflowAction, _ as CheckOwn, _n as WorkflowCheckStatesAnswer, an as WorkflowCallRefused, b as CheckTreeEntry, bn as WorkflowConnections, cn as WorkflowCheckRefusal, dn as WorkflowCheckResultsAnswer, en as WorkflowCall, fn as WorkflowCheckRun, g as CheckOn, gn as WorkflowCheckStates, hn as WorkflowCheckStartAnswer, in as WorkflowCallRefusal, jn as WorkflowPullRequestAnswer, k as ConnectionCall, kn as WorkflowPermissions, ln as WorkflowCheckRefused, mn as WorkflowCheckStart, nn as WorkflowCallEnded, on as WorkflowCalledState, pn as WorkflowCheckRunEnded, rn as WorkflowCallInput, sn as WorkflowCalledStateAnswer, tn as WorkflowCallAnswer, un as WorkflowCheckResults, v as CheckRunError, vn as WorkflowCheckWhere, vt as Ref0Owned, wn as WorkflowPasskeyAsk, wt as SandboxExecAnswer, xn as WorkflowEvent, y as CheckRunParams, yn as WorkflowComment, zt as StartRun$1 } from "./index-Db86z11q.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/needs.d.ts
4
4
  /**
@@ -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-CLwrVDwR.d.mts.map
674
+ //# sourceMappingURL=browse-DS1tiHAR.d.mts.map
@@ -1,4 +1,4 @@
1
- import { t as Browser } from "./browse-CLwrVDwR.mjs";
1
+ import { t as Browser } from "./browse-DS1tiHAR.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 MirrorEntry, An as WorkflowPreview, At as ScopeAction, Bn as commandLine, Bt as StatementView, C as ConnectAgent, D as ConnectOptions, E as ConnectFolderOption, F as ConsentAsked, Ft as SignInDestination, Gn as isRef0Path, Gt as TrackThread, Hn as encodeSecret, Ht as ThreadStage, I as ConsentClient, It as SignedIn, J as LiveTicket, Jn as repoNameKey, Jt as Welcome, K as Harness, Kn as liveSocketUrl, Kt as TypedApprovalCode, L as ConsentProject, Lt as SocketUrl, M as ConnectionKind, Mt as SentryOrg, N as ConnectionName, Nt as SentryRegion, O as ConnectableAgent, P as ConnectionView, Pt as SentryToken, Q as MirrorChoice, R as CredentialView, S as ClientGranted, St as RequestFolder, T as ConnectFolderChoices, Un as hookTokenPrefix, Ut as TrackClosed, V as FoldersConnected, Vn as connectEndpoint, Vt as ThreadId, Wn as hookUrl, Wt as TrackSession, X as LiveTrackName, Y as LiveTicketRequest, Yn as surfaceOf, Z as MachineConnected, _t as ReadEvent, a as Api, at as OwnerTrackMessage, bt as RepoUrl, c as ApprovalId, ct as PasskeyCreationOptions, d as ApprovalView, dt as PasskeyRequestOptions, et as MirrorView, f as AttachmentFailed, ft as PreviewEcho, gt as RanOf, ht as ProjectTrackMessage, i as AgentView, it as OwnerThreadView, j as ConnectionChanged, jt as SecretHash, l as ApprovalPreview, m as Authorization, mt as ProjectName, n as AgentPermissionChoice, nt as OwnerName, o as ApiOrigin, ot as PasskeyAsserted, p as AttachmentRequestView, pt as PreviewUnavailable, q as ImportFailure, qn as projectParts, r as AgentPermissionSetting, rt as OwnerThreadPage, s as ApprovalAnswer, st as PasskeyCreated, t as AgentHandle, tt as OwnerId, u as ApprovalState, w as ConnectChosen, x as ClientAccess, xt as RepoView, yt as RepoName, z as EndpointName, zn as WrittenProject } from "./index-Vb8-1Zk-.mjs";
1
+ import { $ as MirrorEntry, An as WorkflowPreview, At as ScopeAction, Bn as commandLine, Bt as StatementView, C as ConnectAgent, D as ConnectOptions, E as ConnectFolderOption, F as ConsentAsked, Ft as SignInDestination, Gn as isRef0Path, Gt as TrackThread, Hn as encodeSecret, Ht as ThreadStage, I as ConsentClient, It as SignedIn, J as LiveTicket, Jn as repoNameKey, Jt as Welcome, K as Harness, Kn as liveSocketUrl, Kt as TypedApprovalCode, L as ConsentProject, Lt as SocketUrl, M as ConnectionKind, Mt as SentryOrg, N as ConnectionName, Nt as SentryRegion, O as ConnectableAgent, P as ConnectionView, Pt as SentryToken, Q as MirrorChoice, R as CredentialView, S as ClientGranted, St as RequestFolder, T as ConnectFolderChoices, Un as hookTokenPrefix, Ut as TrackClosed, V as FoldersConnected, Vn as connectEndpoint, Vt as ThreadId, Wn as hookUrl, Wt as TrackSession, X as LiveTrackName, Y as LiveTicketRequest, Yn as surfaceOf, Z as MachineConnected, _t as ReadEvent, a as Api, at as OwnerTrackMessage, bt as RepoUrl, c as ApprovalId, ct as PasskeyCreationOptions, d as ApprovalView, dt as PasskeyRequestOptions, et as MirrorView, f as AttachmentFailed, ft as PreviewEcho, gt as RanOf, ht as ProjectTrackMessage, i as AgentView, it as OwnerThreadView, j as ConnectionChanged, jt as SecretHash, l as ApprovalPreview, m as Authorization, mt as ProjectName, n as AgentPermissionChoice, nt as OwnerName, o as ApiOrigin, ot as PasskeyAsserted, p as AttachmentRequestView, pt as PreviewUnavailable, q as ImportFailure, qn as projectParts, r as AgentPermissionSetting, rt as OwnerThreadPage, s as ApprovalAnswer, st as PasskeyCreated, t as AgentHandle, tt as OwnerId, u as ApprovalState, w as ConnectChosen, x as ClientAccess, xt as RepoView, yt as RepoName, z as EndpointName, zn as WrittenProject } from "./index-Db86z11q.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";
package/dist/client.mjs CHANGED
@@ -6419,8 +6419,15 @@ var PasskeyRefused = class extends Schema.TaggedError()("PasskeyRefused", { next
6419
6419
  //#endregion
6420
6420
  //#region ../contracts/src/attachments.ts
6421
6421
  /** A machine asks, a signed-in person claims and approves, and the answer returns to its terminal. */
6422
+ /**
6423
+ * What could reorder or hide the text around it, such as U+202E: a control, format, surrogate,
6424
+ * private-use or unassigned character, or a line or paragraph separator.
6425
+ */
6426
+ const hiddenCharacters = String.raw`\p{C}\p{Zl}\p{Zp}`;
6427
+ /** Text with none of them, which reads as it's written wherever it's shown. */
6428
+ const shownAsWritten = Schema.isPattern(new RegExp(`^[^${hiddenCharacters}]+$`, "u"));
6422
6429
  /** A machine's own word for itself: shown to the person as what it says, never as fact. */
6423
- const MachineName = Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(64));
6430
+ const MachineName = Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(64), shownAsWritten);
6424
6431
  /** The harness a machine says it connects for, never proof of what it runs. */
6425
6432
  const ConnectHarness = Schema.Literals(["claude-code", "codex"]);
6426
6433
  /** The machine's loopback listener; no caller may choose its host. */
@@ -6432,7 +6439,7 @@ const AttachmentCallback = Schema.Struct({
6432
6439
  state: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_-]{22}$/))
6433
6440
  });
6434
6441
  /** A config folder's path, as the machine shows it, never proof of its location. */
6435
- const ConfigFolderPath = Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(200), Schema.isPattern(/^[^\p{C}\p{Zl}\p{Zp}]+$/u));
6442
+ const ConfigFolderPath = Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(200), shownAsWritten);
6436
6443
  const uniqueFolderPaths = Schema.makeFilter((folders) => new Set(folders.map((folder) => folder.path)).size === folders.length, { expected: "unique config folder paths" });
6437
6444
  const RequestFolder = Schema.Struct({
6438
6445
  path: ConfigFolderPath,
@@ -11693,10 +11700,12 @@ Schema.Union([
11693
11700
  NotPermitted
11694
11701
  ]);
11695
11702
  /**
11696
- * A session's fork's path on ref0's host. Its thread's, `/{owner}/{project}/threads/{n}/{repo}.git`
11697
- * on a project's thread and `/{owner}/threads/{n}/{repo}.git` on an org thread, reaches the fork
11698
- * of the session whose token asks, and takes its pushes. A session's,
11699
- * `…/threads/{n}/sessions/{m}/{repo}.git`, reads that session's fork, and takes no push.
11703
+ * A fork's path on ref0's host. Its thread's, `/{owner}/{project}/threads/{n}/{repo}.git` on a
11704
+ * project's thread and `/{owner}/threads/{n}/{repo}.git` on an org thread, reaches the fork of the
11705
+ * session whose token asks, and takes its pushes. A session's,
11706
+ * `…/threads/{n}/sessions/{m}/{repo}.git`, reads that session's current fork, and a fork's,
11707
+ * `…/threads/{n}/forks/{fork}/{repo}.git`, reads that fork when it holds thread `n`'s work, a
11708
+ * session's on it or a run's whose pull request is on it. Neither takes a push.
11700
11709
  */
11701
11710
  const ForkPath = Schema.String.check(Schema.isPattern(/^\/[^\s]+\.git$/), Schema.isMaxLength(512)).pipe(Schema.brand("ForkPath"));
11702
11711
  /** A session's fork's URL on the app's one origin: the one a notice names, and a clone pushes to. */
@@ -11718,17 +11727,21 @@ const ForkView = Schema.Struct({
11718
11727
  /** On the app's one origin, whichever host was asked. */
11719
11728
  url: ForkUrl
11720
11729
  });
11721
- Schema.Struct({
11730
+ /**
11731
+ * For a reader that sees only threads it holds a grant on, those threads: a fork of a thread
11732
+ * stacked, at any depth, on any other is refused, since it holds that thread's work. Unset for one
11733
+ * that reads the project as a whole.
11734
+ */
11735
+ const readerSees = { only: Schema.optionalKey(Schema.Array(ThreadId)) };
11736
+ Schema.Union([Schema.Struct({
11722
11737
  session: SessionId,
11723
- fork: Schema.optionalKey(ForkId),
11724
- /**
11725
- * For a reader that sees only threads it holds a grant on, those threads: a fork of a thread
11726
- * stacked, at any depth, on any other is refused, since it holds that thread's work. Unset for
11727
- * one that reads the project as a whole.
11728
- */
11729
- only: Schema.optionalKey(Schema.Array(ThreadId))
11730
- });
11731
- /** A session's fork in Artifacts, as Git reaches it: where it is, and which Git repository. */
11738
+ ...readerSees
11739
+ }), Schema.Struct({
11740
+ fork: ForkId,
11741
+ thread: ThreadId,
11742
+ ...readerSees
11743
+ })]);
11744
+ /** A fork in Artifacts, as Git reaches it: where it is, and which Git repository. */
11732
11745
  const ForkPlace = Schema.Struct({
11733
11746
  ...CurrentBaseline.fields,
11734
11747
  gitRepository: GitRepositoryId
@@ -11759,19 +11772,16 @@ const SessionBase = Schema.Struct({
11759
11772
  commit: CommitOid,
11760
11773
  /**
11761
11774
  * Where to fetch it from, on ref0's origin: the repo's own path, as `ref0 clone` cloned it, for
11762
- * `main`; for a stack, the path of the fork that holds the pin.
11775
+ * `main`; for a stack, the path of the fork that holds the pin, by its ID under the thread below.
11763
11776
  */
11764
11777
  path: Schema.String.check(Schema.isPattern(/^\/[^\s]+\.git$/), Schema.isMaxLength(512)),
11765
11778
  /** `path` on the app's one origin. A client checks it's a fork of its own repo there. */
11766
11779
  url: Schema.String,
11767
11780
  ref: Schema.Literal("refs/heads/main")
11768
11781
  });
11769
- /**
11770
- * No base to fetch: `main` has no commit yet, or the pin of the thread below is in a workflow
11771
- * run's fork, which has no session's path to fetch from.
11772
- */
11782
+ /** No base to fetch: `main` has no commit yet. */
11773
11783
  var NoBase = class extends Schema.TaggedError()("NoBase", {
11774
- why: Schema.Literals(["main empty", "held by a run"]),
11784
+ why: Schema.Literal("main empty"),
11775
11785
  nextStep: Schema.String
11776
11786
  }, { httpApiStatus: 404 }) {};
11777
11787
  Schema.Struct({
@@ -11789,15 +11799,14 @@ const BaseOnMain = Schema.Struct({
11789
11799
  commit: CommitOid
11790
11800
  });
11791
11801
  /**
11792
- * The base on the thread below, `lower`: its pin's commit, the fork that holds it, and that
11793
- * fork's session, or none for a workflow run's fork.
11802
+ * The base on the thread below, `lower`: its pin's commit, and the fork that holds it, a session's
11803
+ * on that thread or a run's whose pull request is on it.
11794
11804
  */
11795
11805
  const BaseOnStack = Schema.Struct({
11796
11806
  on: Schema.Literal("stack"),
11797
11807
  lower: ThreadId,
11798
11808
  commit: CommitOid,
11799
- fork: ForkId,
11800
- session: Schema.NullOr(SessionId)
11809
+ fork: ForkId
11801
11810
  });
11802
11811
  Schema.Union([
11803
11812
  BaseOnMain,
@@ -14903,6 +14912,11 @@ var ApprovalSecret = class extends HttpApiMiddleware.Service()("ref0/contracts/A
14903
14912
  security: { bearer: HttpApiSecurity.bearer },
14904
14913
  error: [Unauthenticated]
14905
14914
  }) {};
14915
+ /**
14916
+ * A machine's request whose name its contract refuses, answered as `CommandRefused`, which says
14917
+ * what to change. Any other part that fails its contract is answered with Effect's empty 400.
14918
+ */
14919
+ var MachineNameRefusal = class extends HttpApiMiddleware.Service()("ref0/contracts/MachineNameRefusal", { error: CommandRefused }) {};
14906
14920
  const idempotency = { "idempotency-key": RequestId };
14907
14921
  const inProject = {
14908
14922
  owner: OwnerRef,
@@ -15026,7 +15040,7 @@ var MachineAttachmentsGroup = class extends HttpApiGroup.make("machineAttachment
15026
15040
  SlowDown,
15027
15041
  AuthorityUnavailable
15028
15042
  ]
15029
- }), HttpApiEndpoint.post("collect", "/v1/attachments/requests/:approval/result", {
15043
+ }).middleware(MachineNameRefusal), HttpApiEndpoint.post("collect", "/v1/attachments/requests/:approval/result", {
15030
15044
  params: { approval: ApprovalId },
15031
15045
  payload: Schema.Struct({ answerCode: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(64))) }),
15032
15046
  success: RequestState,