@swirls/shuttle 0.0.0-stage → 0.1.1
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/CHANGELOG.md +18 -0
- package/LICENSE +190 -0
- package/NOTICE +5 -0
- package/README.md +42 -2
- package/dist/api/auth.d.ts +18 -0
- package/dist/api/auth.js +15 -0
- package/dist/api/common.d.ts +8 -0
- package/dist/api/common.js +4 -0
- package/dist/api/connections.d.ts +292 -0
- package/dist/api/connections.js +114 -0
- package/dist/api/github.d.ts +20 -0
- package/dist/api/github.js +13 -0
- package/dist/api/harness.d.ts +97 -0
- package/dist/api/harness.js +47 -0
- package/dist/api/index.d.ts +2059 -0
- package/dist/api/index.js +37 -0
- package/dist/api/runners.d.ts +93 -0
- package/dist/api/runners.js +45 -0
- package/dist/api/sandbox.d.ts +550 -0
- package/dist/api/sandbox.js +210 -0
- package/dist/api/sessions.d.ts +318 -0
- package/dist/api/sessions.js +154 -0
- package/dist/api/tenant.d.ts +54 -0
- package/dist/api/tenant.js +19 -0
- package/dist/api/timings.d.ts +36 -0
- package/dist/api/timings.js +48 -0
- package/dist/api/workspace.d.ts +738 -0
- package/dist/api/workspace.js +246 -0
- package/dist/core/pulls.d.ts +1001 -0
- package/dist/core/pulls.js +170 -0
- package/dist/core/workspace.d.ts +985 -0
- package/dist/core/workspace.js +174 -0
- package/dist/react/components/command-palette.d.ts +22 -0
- package/dist/react/components/command-palette.js +66 -0
- package/dist/react/components/follow-list.d.ts +20 -0
- package/dist/react/components/follow-list.js +98 -0
- package/dist/react/components/json-tree.d.ts +11 -0
- package/dist/react/components/json-tree.js +120 -0
- package/dist/react/components/markdown.d.ts +5 -0
- package/dist/react/components/markdown.js +29 -0
- package/dist/react/components/shuttle-mark.d.ts +7 -0
- package/dist/react/components/shuttle-mark.js +9 -0
- package/dist/react/components/status-dot.d.ts +9 -0
- package/dist/react/components/status-dot.js +27 -0
- package/dist/react/components/status.d.ts +6 -0
- package/dist/react/components/status.js +66 -0
- package/dist/react/components/ui/badge.d.ts +7 -0
- package/dist/react/components/ui/badge.js +19 -0
- package/dist/react/components/ui/button.d.ts +10 -0
- package/dist/react/components/ui/button.js +40 -0
- package/dist/react/components/ui/dialog.d.ts +19 -0
- package/dist/react/components/ui/dialog.js +34 -0
- package/dist/react/components/ui/dropdown-menu.d.ts +14 -0
- package/dist/react/components/ui/dropdown-menu.js +33 -0
- package/dist/react/components/ui/input.d.ts +3 -0
- package/dist/react/components/ui/input.js +6 -0
- package/dist/react/components/ui/panel.d.ts +18 -0
- package/dist/react/components/ui/panel.js +22 -0
- package/dist/react/components/ui/popover.d.ts +7 -0
- package/dist/react/components/ui/popover.js +16 -0
- package/dist/react/components/ui/resizable.d.ts +7 -0
- package/dist/react/components/ui/resizable.js +14 -0
- package/dist/react/components/ui/scroll-area.d.ts +14 -0
- package/dist/react/components/ui/scroll-area.js +12 -0
- package/dist/react/components/ui/select.d.ts +10 -0
- package/dist/react/components/ui/select.js +20 -0
- package/dist/react/components/ui/sheet.d.ts +8 -0
- package/dist/react/components/ui/sheet.js +20 -0
- package/dist/react/components/ui/tabs.d.ts +7 -0
- package/dist/react/components/ui/tabs.js +16 -0
- package/dist/react/components/ui/textarea.d.ts +3 -0
- package/dist/react/components/ui/textarea.js +6 -0
- package/dist/react/components/ui/tooltip.d.ts +8 -0
- package/dist/react/components/ui/tooltip.js +17 -0
- package/dist/react/features/artifacts/artifact-links.d.ts +9 -0
- package/dist/react/features/artifacts/artifact-links.js +38 -0
- package/dist/react/features/artifacts/artifact-pane.d.ts +19 -0
- package/dist/react/features/artifacts/artifact-pane.js +75 -0
- package/dist/react/features/artifacts/artifact-types.d.ts +59 -0
- package/dist/react/features/artifacts/artifact-types.js +69 -0
- package/dist/react/features/artifacts/browser-viewer.d.ts +5 -0
- package/dist/react/features/artifacts/browser-viewer.js +60 -0
- package/dist/react/features/artifacts/diff-style.d.ts +10 -0
- package/dist/react/features/artifacts/diff-style.js +21 -0
- package/dist/react/features/artifacts/file-pane.d.ts +13 -0
- package/dist/react/features/artifacts/file-pane.js +305 -0
- package/dist/react/features/artifacts/file-quick-open.d.ts +15 -0
- package/dist/react/features/artifacts/file-quick-open.js +74 -0
- package/dist/react/features/artifacts/file-search.d.ts +12 -0
- package/dist/react/features/artifacts/file-search.js +90 -0
- package/dist/react/features/artifacts/media-viewer.d.ts +8 -0
- package/dist/react/features/artifacts/media-viewer.js +41 -0
- package/dist/react/features/artifacts/review-diff.d.ts +19 -0
- package/dist/react/features/artifacts/review-diff.js +59 -0
- package/dist/react/features/artifacts/review-viewer.d.ts +4 -0
- package/dist/react/features/artifacts/review-viewer.js +337 -0
- package/dist/react/features/artifacts/sandbox.d.ts +43 -0
- package/dist/react/features/artifacts/sandbox.js +109 -0
- package/dist/react/features/artifacts/tab-strip.d.ts +11 -0
- package/dist/react/features/artifacts/tab-strip.js +55 -0
- package/dist/react/features/artifacts/terminal-theme.d.ts +34 -0
- package/dist/react/features/artifacts/terminal-theme.js +62 -0
- package/dist/react/features/artifacts/terminal-viewer.d.ts +5 -0
- package/dist/react/features/artifacts/terminal-viewer.js +209 -0
- package/dist/react/features/artifacts/unified-diff.d.ts +16 -0
- package/dist/react/features/artifacts/unified-diff.js +55 -0
- package/dist/react/features/artifacts/workspace-viewer.d.ts +16 -0
- package/dist/react/features/artifacts/workspace-viewer.js +275 -0
- package/dist/react/features/connections/agent-sign-in.d.ts +71 -0
- package/dist/react/features/connections/agent-sign-in.js +251 -0
- package/dist/react/features/connections/connections-panel.d.ts +8 -0
- package/dist/react/features/connections/connections-panel.js +42 -0
- package/dist/react/features/connections/login.d.ts +24 -0
- package/dist/react/features/connections/login.js +35 -0
- package/dist/react/features/connections/places.d.ts +20 -0
- package/dist/react/features/connections/places.js +27 -0
- package/dist/react/features/connections/queries.d.ts +28 -0
- package/dist/react/features/connections/queries.js +8 -0
- package/dist/react/features/events/event-cache.d.ts +4 -0
- package/dist/react/features/events/event-cache.js +29 -0
- package/dist/react/features/events/event-catalog.d.ts +17 -0
- package/dist/react/features/events/event-catalog.js +261 -0
- package/dist/react/features/events/event-inspector.d.ts +7 -0
- package/dist/react/features/events/event-inspector.js +29 -0
- package/dist/react/features/events/event-row.d.ts +21 -0
- package/dist/react/features/events/event-row.js +34 -0
- package/dist/react/features/events/event-stream.d.ts +18 -0
- package/dist/react/features/events/event-stream.js +58 -0
- package/dist/react/features/events/global-events.d.ts +122 -0
- package/dist/react/features/events/global-events.js +329 -0
- package/dist/react/features/events/shuttle-events.d.ts +7 -0
- package/dist/react/features/events/shuttle-events.js +1 -0
- package/dist/react/features/playbook/playbook-page.d.ts +2 -0
- package/dist/react/features/playbook/playbook-page.js +36 -0
- package/dist/react/features/playbook/playbook-query.d.ts +111 -0
- package/dist/react/features/playbook/playbook-query.js +17 -0
- package/dist/react/features/pulls/linked-session.d.ts +12 -0
- package/dist/react/features/pulls/linked-session.js +22 -0
- package/dist/react/features/pulls/pull-detail-sheet.d.ts +10 -0
- package/dist/react/features/pulls/pull-detail-sheet.js +41 -0
- package/dist/react/features/pulls/pull-fixtures.d.ts +8 -0
- package/dist/react/features/pulls/pull-fixtures.js +258 -0
- package/dist/react/features/pulls/pull-glyphs.d.ts +24 -0
- package/dist/react/features/pulls/pull-glyphs.js +89 -0
- package/dist/react/features/pulls/pull-inbox-list.d.ts +13 -0
- package/dist/react/features/pulls/pull-inbox-list.js +230 -0
- package/dist/react/features/pulls/pull-inbox-pref.d.ts +2 -0
- package/dist/react/features/pulls/pull-inbox-pref.js +19 -0
- package/dist/react/features/pulls/pull-inbox.d.ts +30 -0
- package/dist/react/features/pulls/pull-inbox.js +110 -0
- package/dist/react/features/pulls/pull-threads.d.ts +39 -0
- package/dist/react/features/pulls/pull-threads.js +145 -0
- package/dist/react/features/pulls/pulls.d.ts +120 -0
- package/dist/react/features/pulls/pulls.js +414 -0
- package/dist/react/features/pulls/session-pull-groups.d.ts +14 -0
- package/dist/react/features/pulls/session-pull-groups.js +29 -0
- package/dist/react/features/pulls/stack-ladder.d.ts +9 -0
- package/dist/react/features/pulls/stack-ladder.js +32 -0
- package/dist/react/features/sessions/agent-tree.d.ts +16 -0
- package/dist/react/features/sessions/agent-tree.js +100 -0
- package/dist/react/features/sessions/agents.d.ts +34 -0
- package/dist/react/features/sessions/agents.js +146 -0
- package/dist/react/features/sessions/attention.d.ts +32 -0
- package/dist/react/features/sessions/attention.js +42 -0
- package/dist/react/features/sessions/composer-attachments.d.ts +33 -0
- package/dist/react/features/sessions/composer-attachments.js +126 -0
- package/dist/react/features/sessions/composer.d.ts +15 -0
- package/dist/react/features/sessions/composer.js +327 -0
- package/dist/react/features/sessions/context-usage-meter.d.ts +5 -0
- package/dist/react/features/sessions/context-usage-meter.js +122 -0
- package/dist/react/features/sessions/context-usage.d.ts +54 -0
- package/dist/react/features/sessions/context-usage.js +206 -0
- package/dist/react/features/sessions/conversation.d.ts +21 -0
- package/dist/react/features/sessions/conversation.js +549 -0
- package/dist/react/features/sessions/harness-switcher.d.ts +26 -0
- package/dist/react/features/sessions/harness-switcher.js +118 -0
- package/dist/react/features/sessions/intake-heuristic.d.ts +5 -0
- package/dist/react/features/sessions/intake-heuristic.js +28 -0
- package/dist/react/features/sessions/interjection-routes.d.ts +13 -0
- package/dist/react/features/sessions/interjection-routes.js +72 -0
- package/dist/react/features/sessions/llm-models.d.ts +128 -0
- package/dist/react/features/sessions/llm-models.js +174 -0
- package/dist/react/features/sessions/media-strip.d.ts +25 -0
- package/dist/react/features/sessions/media-strip.js +56 -0
- package/dist/react/features/sessions/media.d.ts +43 -0
- package/dist/react/features/sessions/media.js +115 -0
- package/dist/react/features/sessions/model-search.d.ts +6 -0
- package/dist/react/features/sessions/model-search.js +16 -0
- package/dist/react/features/sessions/model-switcher.d.ts +16 -0
- package/dist/react/features/sessions/model-switcher.js +262 -0
- package/dist/react/features/sessions/open-pull-request.d.ts +20 -0
- package/dist/react/features/sessions/open-pull-request.js +92 -0
- package/dist/react/features/sessions/pull-publish-card.d.ts +14 -0
- package/dist/react/features/sessions/pull-publish-card.js +88 -0
- package/dist/react/features/sessions/recent-sessions.d.ts +11 -0
- package/dist/react/features/sessions/recent-sessions.js +29 -0
- package/dist/react/features/sessions/seen-sessions.d.ts +16 -0
- package/dist/react/features/sessions/seen-sessions.js +108 -0
- package/dist/react/features/sessions/session-activity.d.ts +95 -0
- package/dist/react/features/sessions/session-activity.js +785 -0
- package/dist/react/features/sessions/session-context.d.ts +8 -0
- package/dist/react/features/sessions/session-context.js +98 -0
- package/dist/react/features/sessions/session-feed.d.ts +243 -0
- package/dist/react/features/sessions/session-feed.js +883 -0
- package/dist/react/features/sessions/session-header.d.ts +24 -0
- package/dist/react/features/sessions/session-header.js +97 -0
- package/dist/react/features/sessions/session-layout.d.ts +7 -0
- package/dist/react/features/sessions/session-layout.js +87 -0
- package/dist/react/features/sessions/session-panes.d.ts +49 -0
- package/dist/react/features/sessions/session-panes.js +142 -0
- package/dist/react/features/sessions/session-parts.d.ts +35 -0
- package/dist/react/features/sessions/session-parts.js +74 -0
- package/dist/react/features/sessions/session-place.d.ts +9 -0
- package/dist/react/features/sessions/session-place.js +109 -0
- package/dist/react/features/sessions/session-pr-pills.d.ts +7 -0
- package/dist/react/features/sessions/session-pr-pills.js +28 -0
- package/dist/react/features/sessions/session-queries.d.ts +172 -0
- package/dist/react/features/sessions/session-queries.js +90 -0
- package/dist/react/features/sessions/session-repos.d.ts +8 -0
- package/dist/react/features/sessions/session-repos.js +15 -0
- package/dist/react/features/sessions/session-share.d.ts +8 -0
- package/dist/react/features/sessions/session-share.js +112 -0
- package/dist/react/features/sessions/session-tabs.d.ts +38 -0
- package/dist/react/features/sessions/session-tabs.js +191 -0
- package/dist/react/features/sessions/session.d.ts +103 -0
- package/dist/react/features/sessions/session.js +216 -0
- package/dist/react/features/sessions/signals.d.ts +13 -0
- package/dist/react/features/sessions/signals.js +34 -0
- package/dist/react/features/sessions/tab-set.d.ts +20 -0
- package/dist/react/features/sessions/tab-set.js +58 -0
- package/dist/react/features/sessions/team.d.ts +16 -0
- package/dist/react/features/sessions/team.js +35 -0
- package/dist/react/features/sessions/timeline.d.ts +53 -0
- package/dist/react/features/sessions/timeline.js +153 -0
- package/dist/react/features/sessions/use-session-tabs.d.ts +18 -0
- package/dist/react/features/sessions/use-session-tabs.js +119 -0
- package/dist/react/features/sessions/vendor-models.d.ts +23 -0
- package/dist/react/features/sessions/vendor-models.js +61 -0
- package/dist/react/features/workspace/activity-dot.d.ts +15 -0
- package/dist/react/features/workspace/activity-dot.js +36 -0
- package/dist/react/features/workspace/app-sidebar.d.ts +16 -0
- package/dist/react/features/workspace/app-sidebar.js +227 -0
- package/dist/react/features/workspace/fixture-toggle.d.ts +2 -0
- package/dist/react/features/workspace/fixture-toggle.js +72 -0
- package/dist/react/features/workspace/folder-group.d.ts +18 -0
- package/dist/react/features/workspace/folder-group.js +83 -0
- package/dist/react/features/workspace/inline-name-input.d.ts +10 -0
- package/dist/react/features/workspace/inline-name-input.js +33 -0
- package/dist/react/features/workspace/link-repo-dialog.d.ts +9 -0
- package/dist/react/features/workspace/link-repo-dialog.js +76 -0
- package/dist/react/features/workspace/repo-chip.d.ts +13 -0
- package/dist/react/features/workspace/repo-chip.js +15 -0
- package/dist/react/features/workspace/session-row.d.ts +20 -0
- package/dist/react/features/workspace/session-row.js +23 -0
- package/dist/react/features/workspace/use-debounced.d.ts +2 -0
- package/dist/react/features/workspace/use-debounced.js +10 -0
- package/dist/react/features/workspace/workspace-context.d.ts +45 -0
- package/dist/react/features/workspace/workspace-context.js +245 -0
- package/dist/react/features/workspace/workspace-fixtures.d.ts +16 -0
- package/dist/react/features/workspace/workspace-fixtures.js +175 -0
- package/dist/react/features/workspace/workspace-tree.d.ts +30 -0
- package/dist/react/features/workspace/workspace-tree.js +69 -0
- package/dist/react/features/workspace/workspace.d.ts +107 -0
- package/dist/react/features/workspace/workspace.js +458 -0
- package/dist/react/index.d.ts +33 -0
- package/dist/react/index.js +35 -0
- package/dist/react/lib/cn.d.ts +6 -0
- package/dist/react/lib/cn.js +20 -0
- package/dist/react/lib/initials.d.ts +6 -0
- package/dist/react/lib/initials.js +32 -0
- package/dist/react/lib/json.d.ts +33 -0
- package/dist/react/lib/json.js +101 -0
- package/dist/react/lib/time.d.ts +8 -0
- package/dist/react/lib/time.js +57 -0
- package/dist/react/lib/use-media-query.d.ts +1 -0
- package/dist/react/lib/use-media-query.js +9 -0
- package/dist/react/lib/use-now.d.ts +2 -0
- package/dist/react/lib/use-now.js +10 -0
- package/dist/react/lib/use-width-bucket.d.ts +6 -0
- package/dist/react/lib/use-width-bucket.js +28 -0
- package/dist/react/parts/index.d.ts +43 -0
- package/dist/react/parts/index.js +43 -0
- package/dist/react/shuttle/device.d.ts +42 -0
- package/dist/react/shuttle/device.js +10 -0
- package/dist/react/shuttle/host.d.ts +1126 -0
- package/dist/react/shuttle/host.js +93 -0
- package/dist/react/shuttle/identity.d.ts +31 -0
- package/dist/react/shuttle/identity.js +20 -0
- package/dist/react/shuttle/index.d.ts +14 -0
- package/dist/react/shuttle/index.js +13 -0
- package/dist/react/shuttle/provider.d.ts +41 -0
- package/dist/react/shuttle/provider.js +59 -0
- package/dist/react/shuttle/router.d.ts +43 -0
- package/dist/react/shuttle/router.js +1 -0
- package/dist/react/theme.css +456 -0
- package/dist/react/ui.d.ts +19 -0
- package/dist/react/ui.js +19 -0
- package/package.json +100 -4
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { oc } from '@orpc/contract';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { SessionParams } from './common.js';
|
|
4
|
+
/**
|
|
5
|
+
* Where a tab's contents came from: the running `sandbox`, the session's work as last `saved`
|
|
6
|
+
* while its sandbox sleeps, or nowhere because the sandbox is `asleep` with nothing saved.
|
|
7
|
+
*/
|
|
8
|
+
export const SandboxSource = z.object({
|
|
9
|
+
source: z.enum(['sandbox', 'saved', 'asleep']),
|
|
10
|
+
/** When the saved copy was saved, in milliseconds. Absent when read from the sandbox. */
|
|
11
|
+
savedAt: z.number().nullable().optional(),
|
|
12
|
+
});
|
|
13
|
+
export const SandboxFileEntry = z.object({ path: z.string(), kind: z.enum(['file', 'dir']) });
|
|
14
|
+
export const SandboxFiles = SandboxSource.extend({
|
|
15
|
+
root: z.string(),
|
|
16
|
+
files: z.array(SandboxFileEntry),
|
|
17
|
+
mode: z.enum(['memory', 'container']),
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* One file in the session's worktree. Asked for as it was when the session started
|
|
21
|
+
* (`version: 'base'`), `content` is null when it did not exist then, and nothing says whether it
|
|
22
|
+
* is binary or was cut short.
|
|
23
|
+
*/
|
|
24
|
+
export const SandboxFile = SandboxSource.extend({
|
|
25
|
+
path: z.string(),
|
|
26
|
+
content: z.string().nullable(),
|
|
27
|
+
binary: z.boolean().optional(),
|
|
28
|
+
truncated: z.boolean().optional(),
|
|
29
|
+
});
|
|
30
|
+
export const SandboxDiffEntry = z.object({ cwd: z.string(), name: z.string(), diff: z.string() });
|
|
31
|
+
/** Every repository's changes since the session started. */
|
|
32
|
+
export const SandboxDiffs = SandboxSource.extend({ diffs: z.array(SandboxDiffEntry) });
|
|
33
|
+
/** One file's changes since the session started. `path` is null when it named no file. */
|
|
34
|
+
export const SandboxFileDiff = SandboxSource.extend({
|
|
35
|
+
path: z.string().nullable(),
|
|
36
|
+
diff: z.string(),
|
|
37
|
+
});
|
|
38
|
+
/** How a file differs from where the session started: added, modified or deleted. */
|
|
39
|
+
export const ChangeStatus = z.enum(['A', 'M', 'D']);
|
|
40
|
+
/** One repository in a session's workspace. */
|
|
41
|
+
export const SandboxWorkspaceRepo = z.object({
|
|
42
|
+
/** Its directory in the workspace. */
|
|
43
|
+
name: z.string(),
|
|
44
|
+
/** Its name on GitHub. Null for the scratch repository of a folder with none linked. */
|
|
45
|
+
fullName: z.string().nullable(),
|
|
46
|
+
/** The branch its changes are measured from. */
|
|
47
|
+
defaultBranch: z.string(),
|
|
48
|
+
/** Every file, relative to the repository. */
|
|
49
|
+
files: z.array(z.string()).readonly(),
|
|
50
|
+
changes: z.array(z.object({ path: z.string(), status: ChangeStatus })).readonly(),
|
|
51
|
+
});
|
|
52
|
+
/** A session's workspace: its repositories, what changed in each, and where it was read from. */
|
|
53
|
+
export const SandboxWorkspace = SandboxSource.extend({
|
|
54
|
+
/** Whether agents are working in the session right now. Only known while the sandbox is awake. */
|
|
55
|
+
working: z.boolean().optional(),
|
|
56
|
+
/** Whose sandbox holds the workspace, where each person has one. Null otherwise. */
|
|
57
|
+
holderId: z.string().nullable(),
|
|
58
|
+
repos: z.array(SandboxWorkspaceRepo).readonly(),
|
|
59
|
+
/** Things written under /workspace but outside the session's workspace. */
|
|
60
|
+
strays: z.array(z.object({ path: z.string(), files: z.number() })).readonly(),
|
|
61
|
+
});
|
|
62
|
+
export const DiagnosticSeverity = z.enum(['error', 'warning', 'info', 'hint']);
|
|
63
|
+
/** One problem the language server found. Positions are 1-based, as an editor shows them. */
|
|
64
|
+
export const FileDiagnostic = z.object({
|
|
65
|
+
line: z.number(),
|
|
66
|
+
column: z.number(),
|
|
67
|
+
endLine: z.number(),
|
|
68
|
+
/** The column after the problem's last character. */
|
|
69
|
+
endColumn: z.number(),
|
|
70
|
+
severity: DiagnosticSeverity,
|
|
71
|
+
message: z.string(),
|
|
72
|
+
code: z.string().optional(),
|
|
73
|
+
source: z.string().optional(),
|
|
74
|
+
});
|
|
75
|
+
export const FileDiagnostics = z.discriminatedUnion('status', [
|
|
76
|
+
z.object({
|
|
77
|
+
status: z.literal('ok'),
|
|
78
|
+
server: z.string(),
|
|
79
|
+
diagnostics: z.array(FileDiagnostic).readonly(),
|
|
80
|
+
}),
|
|
81
|
+
/** The server is still starting. Asking again shortly will answer. */
|
|
82
|
+
z.object({ status: z.literal('pending'), server: z.string().optional() }),
|
|
83
|
+
/** No server covers this kind of file, or this sandbox cannot run one. */
|
|
84
|
+
z.object({
|
|
85
|
+
status: z.enum(['unsupported', 'unavailable', 'error']),
|
|
86
|
+
reason: z.string().optional(),
|
|
87
|
+
}),
|
|
88
|
+
]);
|
|
89
|
+
/** Largest text a draft may be to have the language server check it, in characters. */
|
|
90
|
+
export const MAX_DIAGNOSTICS_CHARS = 512_000;
|
|
91
|
+
/** Largest file a person may save from the browser, in characters. */
|
|
92
|
+
export const MAX_WRITE_CHARS = 2_000_000;
|
|
93
|
+
const Machine = {
|
|
94
|
+
/** For a sandbox on someone's machine: whether that machine is connected. */
|
|
95
|
+
online: z.boolean().optional(),
|
|
96
|
+
device: z.object({ id: z.string(), name: z.string(), platform: z.string() }).optional(),
|
|
97
|
+
backend: z.object({ id: z.string(), label: z.string(), isolation: z.string() }).optional(),
|
|
98
|
+
};
|
|
99
|
+
/** Whose sandbox holds a session's files, as it bears on a terminal the viewer opens. */
|
|
100
|
+
export const SandboxPlace = z.object({
|
|
101
|
+
/** Where a move that is waiting for the session to stop working will take it. */
|
|
102
|
+
pending: z.enum(['local', 'cloud']).nullable(),
|
|
103
|
+
/** Set when the session last left a machine that was not connected, from its last save. */
|
|
104
|
+
leftBehind: z.object({ deviceId: z.string().nullable(), at: z.number() }).nullable(),
|
|
105
|
+
/** Whether each person has a sandbox of their own. */
|
|
106
|
+
personal: z.boolean(),
|
|
107
|
+
/** The person whose sandbox holds the session's files. Null when unknown or not personal. */
|
|
108
|
+
holderId: z.string().nullable(),
|
|
109
|
+
/** Whether the session's files are in the sandbox the viewer's terminal opens in. */
|
|
110
|
+
here: z.boolean(),
|
|
111
|
+
/** The sandbox that holds the session's files. */
|
|
112
|
+
sandbox: z.object({
|
|
113
|
+
provider: z.string(),
|
|
114
|
+
location: z.enum(['local', 'cloud']),
|
|
115
|
+
deviceId: z.string().nullable().optional(),
|
|
116
|
+
...Machine,
|
|
117
|
+
}),
|
|
118
|
+
/** Set while the session is placed on a person's own machine. */
|
|
119
|
+
local: z.object({ deviceId: z.string(), mine: z.boolean() }).nullable(),
|
|
120
|
+
cloud: z.object({ provider: z.string(), movable: z.boolean() }),
|
|
121
|
+
});
|
|
122
|
+
/** Where a session's previews are served. */
|
|
123
|
+
export const PreviewAddress = z.object({
|
|
124
|
+
/** The label that leads to the session's sandbox in a preview hostname. */
|
|
125
|
+
label: z.string(),
|
|
126
|
+
/** The domain previews hang off, when the deployment names one. */
|
|
127
|
+
host: z.string().optional(),
|
|
128
|
+
});
|
|
129
|
+
/** A file by its path: `<repository>/<path>`, or absolute inside the session's worktree. */
|
|
130
|
+
const FilePath = z.string().min(1);
|
|
131
|
+
export const sandboxContract = {
|
|
132
|
+
/** Every file in the session's worktree. */
|
|
133
|
+
files: oc
|
|
134
|
+
.route({ method: 'GET', path: '/sessions/{id}/sandbox/files' })
|
|
135
|
+
.input(SessionParams)
|
|
136
|
+
.output(SandboxFiles),
|
|
137
|
+
/** One file, as it is now or, with `version: 'base'`, as it was when the session started. */
|
|
138
|
+
file: oc
|
|
139
|
+
.route({ method: 'GET', path: '/sessions/{id}/sandbox/file' })
|
|
140
|
+
.input(SessionParams.extend({ path: FilePath, version: z.enum(['base']).optional() }))
|
|
141
|
+
.output(SandboxFile),
|
|
142
|
+
/** One file's changes since the session started, given `path`; every repository's without. */
|
|
143
|
+
diff: oc
|
|
144
|
+
.route({ method: 'GET', path: '/sessions/{id}/sandbox/diff' })
|
|
145
|
+
.input(SessionParams.extend({ path: FilePath.optional() }))
|
|
146
|
+
.output(z.union([SandboxFileDiff, SandboxDiffs])),
|
|
147
|
+
workspace: oc
|
|
148
|
+
.route({ method: 'GET', path: '/sessions/{id}/sandbox/workspace' })
|
|
149
|
+
.input(SessionParams)
|
|
150
|
+
.output(SandboxWorkspace),
|
|
151
|
+
/**
|
|
152
|
+
* Saves a person's edit to one file in the session's workspace. `expected` is the text the
|
|
153
|
+
* person started from: if the file has changed since, the edit is refused.
|
|
154
|
+
*/
|
|
155
|
+
write: oc
|
|
156
|
+
.route({ method: 'POST', path: '/sessions/{id}/sandbox/write' })
|
|
157
|
+
.input(SessionParams.extend({
|
|
158
|
+
path: FilePath,
|
|
159
|
+
content: z.string().max(MAX_WRITE_CHARS),
|
|
160
|
+
expected: z.string().optional(),
|
|
161
|
+
}))
|
|
162
|
+
.output(z.object({ ok: z.literal(true), path: z.string() })),
|
|
163
|
+
/** Moves something an agent wrote outside the worktree into the session's first repository. */
|
|
164
|
+
adopt: oc
|
|
165
|
+
.route({ method: 'POST', path: '/sessions/{id}/sandbox/adopt' })
|
|
166
|
+
.input(SessionParams.extend({ path: z.string() }))
|
|
167
|
+
.output(z.object({ ok: z.literal(true) })),
|
|
168
|
+
diagnostics: {
|
|
169
|
+
/** What the sandbox's language server says about a file as saved. */
|
|
170
|
+
saved: oc
|
|
171
|
+
.route({ method: 'GET', path: '/sessions/{id}/sandbox/diagnostics' })
|
|
172
|
+
.input(SessionParams.extend({ path: FilePath }))
|
|
173
|
+
.output(FileDiagnostics),
|
|
174
|
+
/** The same, for text someone is typing and has not saved. The file is named in the query. */
|
|
175
|
+
draft: oc
|
|
176
|
+
.route({
|
|
177
|
+
method: 'POST',
|
|
178
|
+
path: '/sessions/{id}/sandbox/diagnostics',
|
|
179
|
+
inputStructure: 'detailed',
|
|
180
|
+
})
|
|
181
|
+
.input(z.object({
|
|
182
|
+
params: SessionParams,
|
|
183
|
+
query: z.object({ path: FilePath }),
|
|
184
|
+
body: z.object({ content: z.string().max(MAX_DIAGNOSTICS_CHARS) }),
|
|
185
|
+
}))
|
|
186
|
+
.output(FileDiagnostics),
|
|
187
|
+
},
|
|
188
|
+
place: {
|
|
189
|
+
get: oc
|
|
190
|
+
.route({ method: 'GET', path: '/sessions/{id}/sandbox/place' })
|
|
191
|
+
.input(SessionParams)
|
|
192
|
+
.output(SandboxPlace),
|
|
193
|
+
/**
|
|
194
|
+
* Moves a session, with its work, to one of the caller's own machines or back to the cloud.
|
|
195
|
+
* A session that is working moves once it stops: `pending` in the answer says where to.
|
|
196
|
+
*/
|
|
197
|
+
move: oc
|
|
198
|
+
.route({ method: 'POST', path: '/sessions/{id}/sandbox/place' })
|
|
199
|
+
.input(z.discriminatedUnion('to', [
|
|
200
|
+
SessionParams.extend({ to: z.literal('local'), deviceId: z.string().min(1) }),
|
|
201
|
+
SessionParams.extend({ to: z.literal('cloud') }),
|
|
202
|
+
]))
|
|
203
|
+
.output(SandboxPlace),
|
|
204
|
+
},
|
|
205
|
+
/** Only people who can open the session can ask for its preview address. */
|
|
206
|
+
preview: oc
|
|
207
|
+
.route({ method: 'GET', path: '/sessions/{id}/sandbox/preview' })
|
|
208
|
+
.input(SessionParams)
|
|
209
|
+
.output(PreviewAddress),
|
|
210
|
+
};
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SessionVisibility: z.ZodEnum<{
|
|
3
|
+
private: "private";
|
|
4
|
+
public: "public";
|
|
5
|
+
}>;
|
|
6
|
+
export type SessionVisibility = z.infer<typeof SessionVisibility>;
|
|
7
|
+
/**
|
|
8
|
+
* Who can open a session. A private one opens for its owner and members only; a public one for
|
|
9
|
+
* everyone in the organization. `canShare` says whether the caller may change any of this.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SessionAccess: z.ZodObject<{
|
|
12
|
+
ownerId: z.ZodNullable<z.ZodString>;
|
|
13
|
+
memberIds: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
14
|
+
visibility: z.ZodEnum<{
|
|
15
|
+
private: "private";
|
|
16
|
+
public: "public";
|
|
17
|
+
}>;
|
|
18
|
+
canShare: z.ZodBoolean;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export type SessionAccess = z.infer<typeof SessionAccess>;
|
|
21
|
+
export declare const INTERJECTION_KINDS: readonly ['question', 'idea', 'constraint', 'correction', 'task', 'stop'];
|
|
22
|
+
export declare const InterjectionKind: z.ZodEnum<{
|
|
23
|
+
constraint: "constraint";
|
|
24
|
+
correction: "correction";
|
|
25
|
+
idea: "idea";
|
|
26
|
+
question: "question";
|
|
27
|
+
stop: "stop";
|
|
28
|
+
task: "task";
|
|
29
|
+
}>;
|
|
30
|
+
export type InterjectionKind = z.infer<typeof InterjectionKind>;
|
|
31
|
+
export declare const MAX_ATTACHMENTS = 10;
|
|
32
|
+
export declare const AssetId: z.ZodString;
|
|
33
|
+
export declare const LlmModel: z.ZodObject<{
|
|
34
|
+
model: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type LlmModel = z.infer<typeof LlmModel>;
|
|
37
|
+
export declare const PlaybookLesson: z.ZodObject<{
|
|
38
|
+
id: z.ZodString;
|
|
39
|
+
text: z.ZodString;
|
|
40
|
+
scope: z.ZodString;
|
|
41
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
42
|
+
runId: z.ZodString;
|
|
43
|
+
seq: z.ZodNumber;
|
|
44
|
+
}, z.core.$strip>>;
|
|
45
|
+
sourceRunId: z.ZodString;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
export type PlaybookLesson = z.infer<typeof PlaybookLesson>;
|
|
48
|
+
export declare const PlaybookState: z.ZodObject<{
|
|
49
|
+
version: z.ZodNumber;
|
|
50
|
+
lessons: z.ZodArray<z.ZodObject<{
|
|
51
|
+
id: z.ZodString;
|
|
52
|
+
text: z.ZodString;
|
|
53
|
+
scope: z.ZodString;
|
|
54
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
55
|
+
runId: z.ZodString;
|
|
56
|
+
seq: z.ZodNumber;
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
sourceRunId: z.ZodString;
|
|
59
|
+
}, z.core.$strip>>;
|
|
60
|
+
proposed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
61
|
+
text: z.ZodString;
|
|
62
|
+
scope: z.ZodString;
|
|
63
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
64
|
+
runId: z.ZodString;
|
|
65
|
+
seq: z.ZodNumber;
|
|
66
|
+
}, z.core.$strip>>;
|
|
67
|
+
sourceRunId: z.ZodString;
|
|
68
|
+
}, z.core.$strip>>>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export type PlaybookState = z.infer<typeof PlaybookState>;
|
|
71
|
+
export declare const sessionsContract: {
|
|
72
|
+
list: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
73
|
+
sessions: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
74
|
+
note: z.ZodOptional<z.ZodString>;
|
|
75
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
76
|
+
tree: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
77
|
+
id: z.ZodString;
|
|
78
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
79
|
+
sessionId: z.ZodString;
|
|
80
|
+
runs: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
81
|
+
note: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
83
|
+
access: {
|
|
84
|
+
get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
85
|
+
id: z.ZodString;
|
|
86
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
87
|
+
ownerId: z.ZodNullable<z.ZodString>;
|
|
88
|
+
memberIds: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
89
|
+
visibility: z.ZodEnum<{
|
|
90
|
+
private: "private";
|
|
91
|
+
public: "public";
|
|
92
|
+
}>;
|
|
93
|
+
canShare: z.ZodBoolean;
|
|
94
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
95
|
+
/** Changes who a session is shared with, its visibility, or both. Owner only. */
|
|
96
|
+
update: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
97
|
+
id: z.ZodString;
|
|
98
|
+
memberIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
99
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
100
|
+
private: "private";
|
|
101
|
+
public: "public";
|
|
102
|
+
}>>;
|
|
103
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
104
|
+
ownerId: z.ZodNullable<z.ZodString>;
|
|
105
|
+
memberIds: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
106
|
+
visibility: z.ZodEnum<{
|
|
107
|
+
private: "private";
|
|
108
|
+
public: "public";
|
|
109
|
+
}>;
|
|
110
|
+
canShare: z.ZodBoolean;
|
|
111
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
112
|
+
};
|
|
113
|
+
/** Sends a person's message into a session. The author is taken from the sign-in. */
|
|
114
|
+
say: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
messageId: z.ZodString;
|
|
117
|
+
text: z.ZodDefault<z.ZodString>;
|
|
118
|
+
forceKind: z.ZodOptional<z.ZodEnum<{
|
|
119
|
+
constraint: "constraint";
|
|
120
|
+
correction: "correction";
|
|
121
|
+
idea: "idea";
|
|
122
|
+
question: "question";
|
|
123
|
+
stop: "stop";
|
|
124
|
+
task: "task";
|
|
125
|
+
}>>;
|
|
126
|
+
targetThreadId: z.ZodOptional<z.ZodString>;
|
|
127
|
+
attachments: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
128
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
129
|
+
messageId: z.ZodString;
|
|
130
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
131
|
+
/** Asks the session for a pull request of its work. Answers with the publish card's id. */
|
|
132
|
+
pullRequest: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
133
|
+
id: z.ZodString;
|
|
134
|
+
title: z.ZodOptional<z.ZodString>;
|
|
135
|
+
body: z.ZodOptional<z.ZodString>;
|
|
136
|
+
draft: z.ZodOptional<z.ZodBoolean>;
|
|
137
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
138
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
139
|
+
approvalId: z.ZodString;
|
|
140
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
141
|
+
rename: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
142
|
+
id: z.ZodString;
|
|
143
|
+
title: z.ZodString;
|
|
144
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
145
|
+
runId: z.ZodString;
|
|
146
|
+
title: z.ZodString;
|
|
147
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
148
|
+
archive: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
149
|
+
id: z.ZodString;
|
|
150
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
151
|
+
runId: z.ZodString;
|
|
152
|
+
archived: z.ZodLiteral<true>;
|
|
153
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
154
|
+
/** Stops the turn an agent thread is in. */
|
|
155
|
+
stop: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
156
|
+
id: z.ZodString;
|
|
157
|
+
threadId: z.ZodString;
|
|
158
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
159
|
+
ok: z.ZodLiteral<true>;
|
|
160
|
+
threadId: z.ZodString;
|
|
161
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
162
|
+
/** Stops one agent thread in a session, and every thread beneath it. */
|
|
163
|
+
stopThread: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
164
|
+
id: z.ZodString;
|
|
165
|
+
threadId: z.ZodString;
|
|
166
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
167
|
+
ok: z.ZodLiteral<true>;
|
|
168
|
+
threadId: z.ZodString;
|
|
169
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
170
|
+
llmModel: {
|
|
171
|
+
get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
172
|
+
id: z.ZodString;
|
|
173
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
174
|
+
model: z.ZodString;
|
|
175
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
176
|
+
set: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
177
|
+
id: z.ZodString;
|
|
178
|
+
model: z.ZodString;
|
|
179
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
180
|
+
model: z.ZodString;
|
|
181
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
182
|
+
};
|
|
183
|
+
harness: {
|
|
184
|
+
get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
185
|
+
id: z.ZodString;
|
|
186
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
187
|
+
harness: z.ZodUnion<readonly [z.ZodEnum<{
|
|
188
|
+
"claude-code": "claude-code";
|
|
189
|
+
codex: "codex";
|
|
190
|
+
cursor: "cursor";
|
|
191
|
+
shuttle: "shuttle";
|
|
192
|
+
}>, z.ZodTemplateLiteral<`acp:${string}`>]>;
|
|
193
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
194
|
+
set: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
195
|
+
id: z.ZodString;
|
|
196
|
+
harness: z.ZodUnion<readonly [z.ZodEnum<{
|
|
197
|
+
"claude-code": "claude-code";
|
|
198
|
+
codex: "codex";
|
|
199
|
+
cursor: "cursor";
|
|
200
|
+
shuttle: "shuttle";
|
|
201
|
+
}>, z.ZodTemplateLiteral<`acp:${string}`>]>;
|
|
202
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
203
|
+
harness: z.ZodUnion<readonly [z.ZodEnum<{
|
|
204
|
+
"claude-code": "claude-code";
|
|
205
|
+
codex: "codex";
|
|
206
|
+
cursor: "cursor";
|
|
207
|
+
shuttle: "shuttle";
|
|
208
|
+
}>, z.ZodTemplateLiteral<`acp:${string}`>]>;
|
|
209
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
210
|
+
};
|
|
211
|
+
team: {
|
|
212
|
+
get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
213
|
+
id: z.ZodString;
|
|
214
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
215
|
+
team: z.ZodObject<{
|
|
216
|
+
workers: z.ZodBoolean;
|
|
217
|
+
codex: z.ZodBoolean;
|
|
218
|
+
claudeCode: z.ZodBoolean;
|
|
219
|
+
cursor: z.ZodBoolean;
|
|
220
|
+
preset: z.ZodEnum<{
|
|
221
|
+
"claude-builds-codex-reviews": "claude-builds-codex-reviews";
|
|
222
|
+
"claude-plans-codex-implements": "claude-plans-codex-implements";
|
|
223
|
+
"codex-builds-claude-reviews": "codex-builds-claude-reviews";
|
|
224
|
+
none: "none";
|
|
225
|
+
}>;
|
|
226
|
+
}, z.core.$strip>;
|
|
227
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
228
|
+
set: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
229
|
+
id: z.ZodString;
|
|
230
|
+
team: z.ZodObject<{
|
|
231
|
+
workers: z.ZodBoolean;
|
|
232
|
+
codex: z.ZodBoolean;
|
|
233
|
+
claudeCode: z.ZodBoolean;
|
|
234
|
+
cursor: z.ZodBoolean;
|
|
235
|
+
preset: z.ZodEnum<{
|
|
236
|
+
"claude-builds-codex-reviews": "claude-builds-codex-reviews";
|
|
237
|
+
"claude-plans-codex-implements": "claude-plans-codex-implements";
|
|
238
|
+
"codex-builds-claude-reviews": "codex-builds-claude-reviews";
|
|
239
|
+
none: "none";
|
|
240
|
+
}>;
|
|
241
|
+
}, z.core.$strip>;
|
|
242
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
243
|
+
team: z.ZodObject<{
|
|
244
|
+
workers: z.ZodBoolean;
|
|
245
|
+
codex: z.ZodBoolean;
|
|
246
|
+
claudeCode: z.ZodBoolean;
|
|
247
|
+
cursor: z.ZodBoolean;
|
|
248
|
+
preset: z.ZodEnum<{
|
|
249
|
+
"claude-builds-codex-reviews": "claude-builds-codex-reviews";
|
|
250
|
+
"claude-plans-codex-implements": "claude-plans-codex-implements";
|
|
251
|
+
"codex-builds-claude-reviews": "codex-builds-claude-reviews";
|
|
252
|
+
none: "none";
|
|
253
|
+
}>;
|
|
254
|
+
}, z.core.$strip>;
|
|
255
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
256
|
+
};
|
|
257
|
+
/** The model and effort each vendor agent runs on in this session. */
|
|
258
|
+
vendorModels: {
|
|
259
|
+
get: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
260
|
+
id: z.ZodString;
|
|
261
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
262
|
+
choices: z.ZodRecord<z.ZodString & z.core.$partial, z.ZodObject<{
|
|
263
|
+
model: z.ZodOptional<z.ZodString>;
|
|
264
|
+
effort: z.ZodOptional<z.ZodString>;
|
|
265
|
+
}, z.core.$strip>>;
|
|
266
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
267
|
+
set: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
268
|
+
id: z.ZodString;
|
|
269
|
+
model: z.ZodOptional<z.ZodString>;
|
|
270
|
+
effort: z.ZodOptional<z.ZodString>;
|
|
271
|
+
harness: z.ZodUnion<readonly [z.ZodEnum<{
|
|
272
|
+
"claude-code": "claude-code";
|
|
273
|
+
codex: "codex";
|
|
274
|
+
cursor: "cursor";
|
|
275
|
+
shuttle: "shuttle";
|
|
276
|
+
}>, z.ZodTemplateLiteral<`acp:${string}`>]>;
|
|
277
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
278
|
+
choices: z.ZodRecord<z.ZodString & z.core.$partial, z.ZodObject<{
|
|
279
|
+
model: z.ZodOptional<z.ZodString>;
|
|
280
|
+
effort: z.ZodOptional<z.ZodString>;
|
|
281
|
+
}, z.core.$strip>>;
|
|
282
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
export declare const playbookContract: {
|
|
286
|
+
get: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
287
|
+
runId: z.ZodString;
|
|
288
|
+
playbook: z.ZodObject<{
|
|
289
|
+
version: z.ZodNumber;
|
|
290
|
+
lessons: z.ZodArray<z.ZodObject<{
|
|
291
|
+
id: z.ZodString;
|
|
292
|
+
text: z.ZodString;
|
|
293
|
+
scope: z.ZodString;
|
|
294
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
295
|
+
runId: z.ZodString;
|
|
296
|
+
seq: z.ZodNumber;
|
|
297
|
+
}, z.core.$strip>>;
|
|
298
|
+
sourceRunId: z.ZodString;
|
|
299
|
+
}, z.core.$strip>>;
|
|
300
|
+
proposed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
301
|
+
text: z.ZodString;
|
|
302
|
+
scope: z.ZodString;
|
|
303
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
304
|
+
runId: z.ZodString;
|
|
305
|
+
seq: z.ZodNumber;
|
|
306
|
+
}, z.core.$strip>>;
|
|
307
|
+
sourceRunId: z.ZodString;
|
|
308
|
+
}, z.core.$strip>>>;
|
|
309
|
+
}, z.core.$strip>;
|
|
310
|
+
note: z.ZodOptional<z.ZodString>;
|
|
311
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
312
|
+
/** Starts the organization's playbook run if it has not been started. */
|
|
313
|
+
ensure: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
314
|
+
runId: z.ZodString;
|
|
315
|
+
created: z.ZodBoolean;
|
|
316
|
+
status: z.ZodOptional<z.ZodString>;
|
|
317
|
+
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
318
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { oc } from '@orpc/contract';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { Ok, SessionParams } from './common.js';
|
|
4
|
+
import { HarnessId, SessionHarness, SessionTeam, SessionVendorModels, Team, VendorModelChoice, } from './harness.js';
|
|
5
|
+
export const SessionVisibility = z.enum(['private', 'public']);
|
|
6
|
+
/**
|
|
7
|
+
* Who can open a session. A private one opens for its owner and members only; a public one for
|
|
8
|
+
* everyone in the organization. `canShare` says whether the caller may change any of this.
|
|
9
|
+
*/
|
|
10
|
+
export const SessionAccess = z.object({
|
|
11
|
+
ownerId: z.string().nullable(),
|
|
12
|
+
memberIds: z.array(z.string()).readonly(),
|
|
13
|
+
visibility: SessionVisibility,
|
|
14
|
+
canShare: z.boolean(),
|
|
15
|
+
});
|
|
16
|
+
export const INTERJECTION_KINDS = [
|
|
17
|
+
'question',
|
|
18
|
+
'idea',
|
|
19
|
+
'constraint',
|
|
20
|
+
'correction',
|
|
21
|
+
'task',
|
|
22
|
+
'stop',
|
|
23
|
+
];
|
|
24
|
+
export const InterjectionKind = z.enum(INTERJECTION_KINDS);
|
|
25
|
+
export const MAX_ATTACHMENTS = 10;
|
|
26
|
+
export const AssetId = z.string().regex(/^ast_[0-9a-f]{32}$/);
|
|
27
|
+
export const LlmModel = z.object({ model: z.string() });
|
|
28
|
+
const IndexedRun = z.record(z.string(), z.unknown());
|
|
29
|
+
export const PlaybookLesson = z.object({
|
|
30
|
+
id: z.string(),
|
|
31
|
+
text: z.string(),
|
|
32
|
+
scope: z.string(),
|
|
33
|
+
evidence: z.array(z.object({ runId: z.string(), seq: z.number() })),
|
|
34
|
+
sourceRunId: z.string(),
|
|
35
|
+
});
|
|
36
|
+
export const PlaybookState = z.object({
|
|
37
|
+
version: z.number(),
|
|
38
|
+
lessons: z.array(PlaybookLesson),
|
|
39
|
+
proposed: z.record(z.string(), PlaybookLesson.omit({ id: true })).optional(),
|
|
40
|
+
});
|
|
41
|
+
export const sessionsContract = {
|
|
42
|
+
list: oc
|
|
43
|
+
.route({ method: 'GET', path: '/sessions' })
|
|
44
|
+
.output(z.object({ sessions: z.array(IndexedRun), note: z.string().optional() })),
|
|
45
|
+
tree: oc
|
|
46
|
+
.route({ method: 'GET', path: '/sessions/{id}/tree' })
|
|
47
|
+
.input(SessionParams)
|
|
48
|
+
.output(z.object({ sessionId: z.string(), runs: z.array(IndexedRun), note: z.string().optional() })),
|
|
49
|
+
access: {
|
|
50
|
+
get: oc
|
|
51
|
+
.route({ method: 'GET', path: '/sessions/{id}/access' })
|
|
52
|
+
.input(SessionParams)
|
|
53
|
+
.output(SessionAccess),
|
|
54
|
+
/** Changes who a session is shared with, its visibility, or both. Owner only. */
|
|
55
|
+
update: oc
|
|
56
|
+
.route({ method: 'PUT', path: '/sessions/{id}/access' })
|
|
57
|
+
.input(SessionParams.extend({
|
|
58
|
+
memberIds: z.array(z.string().min(1).max(128)).optional(),
|
|
59
|
+
visibility: SessionVisibility.optional(),
|
|
60
|
+
}))
|
|
61
|
+
.output(SessionAccess),
|
|
62
|
+
},
|
|
63
|
+
/** Sends a person's message into a session. The author is taken from the sign-in. */
|
|
64
|
+
say: oc
|
|
65
|
+
.route({ method: 'POST', path: '/sessions/{id}/say' })
|
|
66
|
+
.input(SessionParams.extend({
|
|
67
|
+
/** Chosen by the sender, so the message can be shown before the session confirms it. */
|
|
68
|
+
messageId: z.string().trim().min(1).max(128),
|
|
69
|
+
text: z.string().default(''),
|
|
70
|
+
forceKind: InterjectionKind.optional(),
|
|
71
|
+
targetThreadId: z.string().optional(),
|
|
72
|
+
/** Ids of files already uploaded to this session. */
|
|
73
|
+
attachments: z.array(AssetId).max(MAX_ATTACHMENTS).default([]),
|
|
74
|
+
}))
|
|
75
|
+
.output(z.object({ messageId: z.string() })),
|
|
76
|
+
/** Asks the session for a pull request of its work. Answers with the publish card's id. */
|
|
77
|
+
pullRequest: oc
|
|
78
|
+
.route({ method: 'POST', path: '/sessions/{id}/pull-request' })
|
|
79
|
+
.input(SessionParams.extend({
|
|
80
|
+
title: z.string().optional(),
|
|
81
|
+
body: z.string().optional(),
|
|
82
|
+
draft: z.boolean().optional(),
|
|
83
|
+
repo: z.string().optional(),
|
|
84
|
+
}))
|
|
85
|
+
.output(z.object({ approvalId: z.string() })),
|
|
86
|
+
rename: oc
|
|
87
|
+
.route({ method: 'POST', path: '/sessions/{id}/rename' })
|
|
88
|
+
.input(SessionParams.extend({ title: z.string().trim().min(1).max(120) }))
|
|
89
|
+
.output(z.object({ runId: z.string(), title: z.string() })),
|
|
90
|
+
archive: oc
|
|
91
|
+
.route({ method: 'POST', path: '/sessions/{id}/archive' })
|
|
92
|
+
.input(SessionParams)
|
|
93
|
+
.output(z.object({ runId: z.string(), archived: z.literal(true) })),
|
|
94
|
+
/** Stops the turn an agent thread is in. */
|
|
95
|
+
stop: oc
|
|
96
|
+
.route({ method: 'POST', path: '/sessions/{id}/stop' })
|
|
97
|
+
.input(SessionParams.extend({ threadId: z.string().trim().min(1) }))
|
|
98
|
+
.output(Ok.extend({ threadId: z.string() })),
|
|
99
|
+
/** Stops one agent thread in a session, and every thread beneath it. */
|
|
100
|
+
stopThread: oc
|
|
101
|
+
.route({ method: 'POST', path: '/sessions/{id}/threads/{threadId}/stop' })
|
|
102
|
+
.input(SessionParams.extend({ threadId: z.string().min(1) }))
|
|
103
|
+
.output(Ok.extend({ threadId: z.string() })),
|
|
104
|
+
llmModel: {
|
|
105
|
+
get: oc
|
|
106
|
+
.route({ method: 'GET', path: '/sessions/{id}/llm-model' })
|
|
107
|
+
.input(SessionParams)
|
|
108
|
+
.output(LlmModel),
|
|
109
|
+
set: oc
|
|
110
|
+
.route({ method: 'PUT', path: '/sessions/{id}/llm-model' })
|
|
111
|
+
.input(SessionParams.extend({ model: z.string().trim().min(1) }))
|
|
112
|
+
.output(LlmModel),
|
|
113
|
+
},
|
|
114
|
+
harness: {
|
|
115
|
+
get: oc
|
|
116
|
+
.route({ method: 'GET', path: '/sessions/{id}/harness' })
|
|
117
|
+
.input(SessionParams)
|
|
118
|
+
.output(SessionHarness),
|
|
119
|
+
set: oc
|
|
120
|
+
.route({ method: 'PUT', path: '/sessions/{id}/harness' })
|
|
121
|
+
.input(SessionParams.extend({ harness: HarnessId }))
|
|
122
|
+
.output(SessionHarness),
|
|
123
|
+
},
|
|
124
|
+
team: {
|
|
125
|
+
get: oc
|
|
126
|
+
.route({ method: 'GET', path: '/sessions/{id}/team' })
|
|
127
|
+
.input(SessionParams)
|
|
128
|
+
.output(SessionTeam),
|
|
129
|
+
set: oc
|
|
130
|
+
.route({ method: 'PUT', path: '/sessions/{id}/team' })
|
|
131
|
+
.input(SessionParams.extend({ team: Team }))
|
|
132
|
+
.output(SessionTeam),
|
|
133
|
+
},
|
|
134
|
+
/** The model and effort each vendor agent runs on in this session. */
|
|
135
|
+
vendorModels: {
|
|
136
|
+
get: oc
|
|
137
|
+
.route({ method: 'GET', path: '/sessions/{id}/vendor-models' })
|
|
138
|
+
.input(SessionParams)
|
|
139
|
+
.output(SessionVendorModels),
|
|
140
|
+
set: oc
|
|
141
|
+
.route({ method: 'PUT', path: '/sessions/{id}/vendor-models' })
|
|
142
|
+
.input(SessionParams.extend({ harness: HarnessId }).extend(VendorModelChoice.shape))
|
|
143
|
+
.output(SessionVendorModels),
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
export const playbookContract = {
|
|
147
|
+
get: oc
|
|
148
|
+
.route({ method: 'GET', path: '/playbook' })
|
|
149
|
+
.output(z.object({ runId: z.string(), playbook: PlaybookState, note: z.string().optional() })),
|
|
150
|
+
/** Starts the organization's playbook run if it has not been started. */
|
|
151
|
+
ensure: oc
|
|
152
|
+
.route({ method: 'POST', path: '/playbook/ensure' })
|
|
153
|
+
.output(z.object({ runId: z.string(), created: z.boolean(), status: z.string().optional() })),
|
|
154
|
+
};
|