@vibesdotdev/code-sessions 0.0.0-stage → 1.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -0
- package/README.md +165 -2
- package/dist/agent/coordinator.agent.descriptor.d.ts +69 -0
- package/dist/agent/coordinator.agent.descriptor.d.ts.map +1 -0
- package/dist/agent/coordinator.agent.descriptor.js +60 -0
- package/dist/agent/coordinator.agent.descriptor.js.map +1 -0
- package/dist/agent/coordinator.prompt.descriptor.d.ts +135 -0
- package/dist/agent/coordinator.prompt.descriptor.d.ts.map +1 -0
- package/dist/agent/coordinator.prompt.descriptor.js +29 -0
- package/dist/agent/coordinator.prompt.descriptor.js.map +1 -0
- package/dist/agent/coordinator.system-prompt.d.ts +3 -0
- package/dist/agent/coordinator.system-prompt.d.ts.map +1 -0
- package/dist/agent/coordinator.system-prompt.js +18 -0
- package/dist/agent/coordinator.system-prompt.js.map +1 -0
- package/dist/agent/developer.agent.descriptor.d.ts +74 -0
- package/dist/agent/developer.agent.descriptor.d.ts.map +1 -0
- package/dist/agent/developer.agent.descriptor.js +138 -0
- package/dist/agent/developer.agent.descriptor.js.map +1 -0
- package/dist/agent/developer.prompt.descriptor.d.ts +137 -0
- package/dist/agent/developer.prompt.descriptor.d.ts.map +1 -0
- package/dist/agent/developer.prompt.descriptor.js +29 -0
- package/dist/agent/developer.prompt.descriptor.js.map +1 -0
- package/dist/agent/reviewer.agent.descriptor.d.ts +69 -0
- package/dist/agent/reviewer.agent.descriptor.d.ts.map +1 -0
- package/dist/agent/reviewer.agent.descriptor.js +60 -0
- package/dist/agent/reviewer.agent.descriptor.js.map +1 -0
- package/dist/agent/reviewer.prompt.descriptor.d.ts +135 -0
- package/dist/agent/reviewer.prompt.descriptor.d.ts.map +1 -0
- package/dist/agent/reviewer.prompt.descriptor.js +29 -0
- package/dist/agent/reviewer.prompt.descriptor.js.map +1 -0
- package/dist/agent/reviewer.system-prompt.d.ts +3 -0
- package/dist/agent/reviewer.system-prompt.d.ts.map +1 -0
- package/dist/agent/reviewer.system-prompt.js +17 -0
- package/dist/agent/reviewer.system-prompt.js.map +1 -0
- package/dist/agent/system-prompt.d.ts +12 -0
- package/dist/agent/system-prompt.d.ts.map +1 -0
- package/dist/agent/system-prompt.js +28 -0
- package/dist/agent/system-prompt.js.map +1 -0
- package/dist/api/code-sessions.api-client.descriptor.d.ts +25 -0
- package/dist/api/code-sessions.api-client.descriptor.d.ts.map +1 -0
- package/dist/api/code-sessions.api-client.descriptor.js +26 -0
- package/dist/api/code-sessions.api-client.descriptor.js.map +1 -0
- package/dist/api/code-sessions.api-client.impl.d.ts +156 -0
- package/dist/api/code-sessions.api-client.impl.d.ts.map +1 -0
- package/dist/api/code-sessions.api-client.impl.js +852 -0
- package/dist/api/code-sessions.api-client.impl.js.map +1 -0
- package/dist/api/code-sessions.api-client.schemas.d.ts +2 -0
- package/dist/api/code-sessions.api-client.schemas.d.ts.map +1 -0
- package/dist/api/code-sessions.api-client.schemas.js +2 -0
- package/dist/api/code-sessions.api-client.schemas.js.map +1 -0
- package/dist/api/code-sessions.api-client.types.d.ts +252 -0
- package/dist/api/code-sessions.api-client.types.d.ts.map +1 -0
- package/dist/api/code-sessions.api-client.types.js +77 -0
- package/dist/api/code-sessions.api-client.types.js.map +1 -0
- package/dist/api/index.d.ts +13 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +20 -0
- package/dist/api/index.js.map +1 -0
- package/dist/capability.d.ts +9 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/capability.js +9 -0
- package/dist/capability.js.map +1 -0
- package/dist/catalog/index.d.ts +2 -0
- package/dist/catalog/index.d.ts.map +1 -0
- package/dist/catalog/index.js +2 -0
- package/dist/catalog/index.js.map +1 -0
- package/dist/catalog/session-catalog.d.ts +131 -0
- package/dist/catalog/session-catalog.d.ts.map +1 -0
- package/dist/catalog/session-catalog.impl.consumer.worker.d.ts +113 -0
- package/dist/catalog/session-catalog.impl.consumer.worker.d.ts.map +1 -0
- package/dist/catalog/session-catalog.impl.consumer.worker.js +32 -0
- package/dist/catalog/session-catalog.impl.consumer.worker.js.map +1 -0
- package/dist/catalog/session-catalog.js +126 -0
- package/dist/catalog/session-catalog.js.map +1 -0
- package/dist/clock/clock.client.d.ts +18 -0
- package/dist/clock/clock.client.d.ts.map +1 -0
- package/dist/clock/clock.client.js +43 -0
- package/dist/clock/clock.client.js.map +1 -0
- package/dist/code-sessions.consumer.plugin.d.ts +4 -0
- package/dist/code-sessions.consumer.plugin.d.ts.map +1 -0
- package/dist/code-sessions.consumer.plugin.js +16 -0
- package/dist/code-sessions.consumer.plugin.js.map +1 -0
- package/dist/code-sessions.plugin.d.ts +15 -0
- package/dist/code-sessions.plugin.d.ts.map +1 -0
- package/dist/code-sessions.plugin.js +65 -0
- package/dist/code-sessions.plugin.js.map +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +9 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/preparation.d.ts +2 -0
- package/dist/config/preparation.d.ts.map +1 -0
- package/dist/config/preparation.js +2 -0
- package/dist/config/preparation.js.map +1 -0
- package/dist/docs/code-sessions.docs.descriptor.d.ts +4 -0
- package/dist/docs/code-sessions.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/code-sessions.docs.descriptor.js +241 -0
- package/dist/docs/code-sessions.docs.descriptor.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/pull-request-plan.d.ts +68 -0
- package/dist/pull-request-plan.d.ts.map +1 -0
- package/dist/pull-request-plan.js +94 -0
- package/dist/pull-request-plan.js.map +1 -0
- package/dist/schemas/preparation.d.ts +51 -0
- package/dist/schemas/preparation.d.ts.map +1 -0
- package/dist/schemas/preparation.js +20 -0
- package/dist/schemas/preparation.js.map +1 -0
- package/dist/schemas/requests.d.ts +411 -0
- package/dist/schemas/requests.d.ts.map +1 -0
- package/dist/schemas/requests.js +87 -0
- package/dist/schemas/requests.js.map +1 -0
- package/dist/schemas/responses.d.ts +275 -0
- package/dist/schemas/responses.d.ts.map +1 -0
- package/dist/schemas/responses.js +90 -0
- package/dist/schemas/responses.js.map +1 -0
- package/dist/svelte/actions.d.ts +70 -0
- package/dist/svelte/actions.d.ts.map +1 -0
- package/dist/svelte/actions.js +280 -0
- package/dist/svelte/clock.svelte.d.ts +6 -0
- package/dist/svelte/clock.svelte.d.ts.map +1 -0
- package/dist/svelte/clock.svelte.js +33 -0
- package/dist/svelte/components/CreateSessionDialog.svelte +470 -0
- package/dist/svelte/components/CreateSessionDialog.svelte.d.ts +57 -0
- package/dist/svelte/components/CreateSessionDialog.svelte.d.ts.map +1 -0
- package/dist/svelte/components/SessionCard.svelte +216 -0
- package/dist/svelte/components/SessionCard.svelte.d.ts +27 -0
- package/dist/svelte/components/SessionCard.svelte.d.ts.map +1 -0
- package/dist/svelte/components/SessionList.svelte +86 -0
- package/dist/svelte/components/SessionList.svelte.d.ts +23 -0
- package/dist/svelte/components/SessionList.svelte.d.ts.map +1 -0
- package/dist/svelte/components/SessionSeed.svelte +60 -0
- package/dist/svelte/components/SessionSeed.svelte.d.ts +9 -0
- package/dist/svelte/components/SessionSeed.svelte.d.ts.map +1 -0
- package/dist/svelte/components/TranscriptView.svelte +360 -0
- package/dist/svelte/components/TranscriptView.svelte.d.ts +26 -0
- package/dist/svelte/components/TranscriptView.svelte.d.ts.map +1 -0
- package/dist/svelte/create-session-form.d.ts +84 -0
- package/dist/svelte/create-session-form.d.ts.map +1 -0
- package/dist/svelte/create-session-form.js +107 -0
- package/dist/svelte/index.d.ts +20 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +18 -0
- package/dist/svelte/live-session.d.ts +156 -0
- package/dist/svelte/live-session.d.ts.map +1 -0
- package/dist/svelte/live-session.js +152 -0
- package/dist/svelte/loaders.d.ts +74 -0
- package/dist/svelte/loaders.d.ts.map +1 -0
- package/dist/svelte/loaders.js +124 -0
- package/dist/svelte/outcome.d.ts +46 -0
- package/dist/svelte/outcome.d.ts.map +1 -0
- package/dist/svelte/outcome.js +49 -0
- package/dist/svelte/relative-time.d.ts +32 -0
- package/dist/svelte/relative-time.d.ts.map +1 -0
- package/dist/svelte/relative-time.js +51 -0
- package/dist/svelte/session-list-item.d.ts +23 -0
- package/dist/svelte/session-list-item.d.ts.map +1 -0
- package/dist/svelte/session-list-item.js +1 -0
- package/dist/svelte/styles.css +8 -0
- package/dist/svelte/transcript-input.d.ts +45 -0
- package/dist/svelte/transcript-input.d.ts.map +1 -0
- package/dist/svelte/transcript-input.js +188 -0
- package/dist/tui/code-sessions-tui.plugin.d.ts +10 -0
- package/dist/tui/code-sessions-tui.plugin.d.ts.map +1 -0
- package/dist/tui/code-sessions-tui.plugin.js +29 -0
- package/dist/tui/code-sessions-tui.plugin.js.map +1 -0
- package/dist/tui/code-sessions.tui-app.descriptor.d.ts +7 -0
- package/dist/tui/code-sessions.tui-app.descriptor.d.ts.map +1 -0
- package/dist/tui/code-sessions.tui-app.descriptor.js +30 -0
- package/dist/tui/code-sessions.tui-app.descriptor.js.map +1 -0
- package/dist/tui/code-sessions.tui-app.impl.consumer.d.ts +14 -0
- package/dist/tui/code-sessions.tui-app.impl.consumer.d.ts.map +1 -0
- package/dist/tui/code-sessions.tui-app.impl.consumer.js +453 -0
- package/dist/tui/code-sessions.tui-app.impl.consumer.js.map +1 -0
- package/dist/tui/code-sessions.tui-client.d.ts +22 -0
- package/dist/tui/code-sessions.tui-client.d.ts.map +1 -0
- package/dist/tui/code-sessions.tui-client.js +95 -0
- package/dist/tui/code-sessions.tui-client.js.map +1 -0
- package/dist/tui/code-sessions.tui-open.descriptor.d.ts +7 -0
- package/dist/tui/code-sessions.tui-open.descriptor.d.ts.map +1 -0
- package/dist/tui/code-sessions.tui-open.descriptor.js +16 -0
- package/dist/tui/code-sessions.tui-open.descriptor.js.map +1 -0
- package/dist/tui/code-sessions.tui-open.impl.consumer.d.ts +7 -0
- package/dist/tui/code-sessions.tui-open.impl.consumer.d.ts.map +1 -0
- package/dist/tui/code-sessions.tui-open.impl.consumer.js +11 -0
- package/dist/tui/code-sessions.tui-open.impl.consumer.js.map +1 -0
- package/dist/tui/code-sessions.tui-state.descriptor.d.ts +16 -0
- package/dist/tui/code-sessions.tui-state.descriptor.d.ts.map +1 -0
- package/dist/tui/code-sessions.tui-state.descriptor.js +50 -0
- package/dist/tui/code-sessions.tui-state.descriptor.js.map +1 -0
- package/dist/tui/code-sessions.tui-state.impl.consumer.d.ts +30 -0
- package/dist/tui/code-sessions.tui-state.impl.consumer.d.ts.map +1 -0
- package/dist/tui/code-sessions.tui-state.impl.consumer.js +533 -0
- package/dist/tui/code-sessions.tui-state.impl.consumer.js.map +1 -0
- package/dist/tui/code-sessions.tui-state.key.d.ts +322 -0
- package/dist/tui/code-sessions.tui-state.key.d.ts.map +1 -0
- package/dist/tui/code-sessions.tui-state.key.js +104 -0
- package/dist/tui/code-sessions.tui-state.key.js.map +1 -0
- package/dist/tui/index.d.ts +9 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +8 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/workspace/index.d.ts +2 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +2 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/workspace-binding.d.ts +74 -0
- package/dist/workspace/workspace-binding.d.ts.map +1 -0
- package/dist/workspace/workspace-binding.impl.consumer.worker.d.ts +17 -0
- package/dist/workspace/workspace-binding.impl.consumer.worker.d.ts.map +1 -0
- package/dist/workspace/workspace-binding.impl.consumer.worker.js +134 -0
- package/dist/workspace/workspace-binding.impl.consumer.worker.js.map +1 -0
- package/dist/workspace/workspace-binding.js +72 -0
- package/dist/workspace/workspace-binding.js.map +1 -0
- package/package.json +238 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preparation.d.ts","sourceRoot":"","sources":["../../src/config/preparation.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preparation.js","sourceRoot":"","sources":["../../src/config/preparation.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-sessions.docs.descriptor.d.ts","sourceRoot":"","sources":["../../src/docs/code-sessions.docs.descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,QAAA,MAAM,UAAU,EAAE,mBA+OjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
const descriptor = {
|
|
2
|
+
kind: 'docs/topic',
|
|
3
|
+
id: 'code-sessions.overview',
|
|
4
|
+
parent: 'platform',
|
|
5
|
+
order: 8,
|
|
6
|
+
title: 'Code Sessions',
|
|
7
|
+
summary: 'Manage code sessions — create, list, resume, delete, and run commands in a workspace. Capability model: PTY-capable host → interactive terminal; CF Sandbox → snapshot transcript.',
|
|
8
|
+
tags: ['code-sessions', 'hq', 'platform', 'build', 'transcript', 'interactive', 'session', 'tui', 'studio'],
|
|
9
|
+
surfaces: ['web', 'cli', 'in-app'],
|
|
10
|
+
enabled: true,
|
|
11
|
+
body: {
|
|
12
|
+
type: 'markdown',
|
|
13
|
+
sourceType: 'raw',
|
|
14
|
+
source: `---
|
|
15
|
+
title: Code Sessions
|
|
16
|
+
summary: Manage code sessions — create, list, resume, delete, and run commands in a workspace.
|
|
17
|
+
tags: [code-sessions, hq, platform, build, transcript, interactive, session, tui, studio]
|
|
18
|
+
parent: platform
|
|
19
|
+
order: 8
|
|
20
|
+
surfaces: [web, cli, in-app]
|
|
21
|
+
hardware: [consumer, cloud]
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# Code Sessions
|
|
25
|
+
|
|
26
|
+
A code session gives you a persistent workspace tied to a repository. You can run commands, browse files,
|
|
27
|
+
and pick up where you left off after a reload. Where the session runs determines what it can do:
|
|
28
|
+
|
|
29
|
+
| Session type | Runs on | Surface |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| **Cloud sandbox** | Managed cloud infrastructure | Snapshot execution — independent command runs |
|
|
32
|
+
| **Interactive** | Your local machine or a fleet host | Live terminal — full PTY, persistent shell |
|
|
33
|
+
|
|
34
|
+
## Creating a session
|
|
35
|
+
|
|
36
|
+
:::usage{language="ts"}
|
|
37
|
+
import { getVibesClient } from '@vibesdotdev/kernel/client';
|
|
38
|
+
import type { CodeSessionsClient, CodeSessionCreateInput } from '@vibesdotdev/code-sessions';
|
|
39
|
+
|
|
40
|
+
const client = await getVibesClient<CodeSessionsClient>('code-sessions', runtime);
|
|
41
|
+
|
|
42
|
+
// Cloud sandbox (ephemeral scratch space)
|
|
43
|
+
const session = await client.create({ ephemeral: true, hostTarget: { kind: 'cloud' } });
|
|
44
|
+
|
|
45
|
+
// On your local machine with a repository
|
|
46
|
+
const session = await client.create({
|
|
47
|
+
repositoryId: 'repo-uuid',
|
|
48
|
+
hostTarget: { kind: 'host', hostId: 'local' }
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
session.capability; // 'transcript' | 'interactive'
|
|
52
|
+
:::
|
|
53
|
+
|
|
54
|
+
## Listing sessions
|
|
55
|
+
|
|
56
|
+
:::usage{language="ts"}
|
|
57
|
+
const sessions = await client.list({ status: 'active' });
|
|
58
|
+
const rows = sessions.map((s) => ({ repository: s.repositoryName, capability: s.capability, status: s.status }));
|
|
59
|
+
:::
|
|
60
|
+
|
|
61
|
+
## Running commands (cloud sessions)
|
|
62
|
+
|
|
63
|
+
Cloud sessions use snapshot execution — each command is an independent run. Surfaces can call the
|
|
64
|
+
canonical platform owner route through the package client:
|
|
65
|
+
|
|
66
|
+
:::usage{language="ts"}
|
|
67
|
+
const result = await client.run({
|
|
68
|
+
sessionId: session.sessionId,
|
|
69
|
+
command: ['pwd']
|
|
70
|
+
});
|
|
71
|
+
const cwd = result.stdout.trim();
|
|
72
|
+
:::
|
|
73
|
+
|
|
74
|
+
App-local SvelteKit transcript bridge routes should still verify auth, ownership, and capability, but
|
|
75
|
+
then call \`client.run(...)\`; platform-web is the owner route that resolves the
|
|
76
|
+
\`agent/code-session\` implementation and calls \`handleTranscriptRun\` from the premium overlay
|
|
77
|
+
\`@vibesdotdev/code-sessions-premium/bridge\`.
|
|
78
|
+
|
|
79
|
+
Owner-route sketch:
|
|
80
|
+
|
|
81
|
+
:::usage{language="ts"}
|
|
82
|
+
import { handleTranscriptRun } from '@vibesdotdev/code-sessions-premium/bridge';
|
|
83
|
+
import { resolveCodeSession } from '@vibesdotdev/agent-execution/code-session';
|
|
84
|
+
import { json } from '@sveltejs/kit';
|
|
85
|
+
|
|
86
|
+
export const POST = async ({ params, request, locals }) => {
|
|
87
|
+
// ... auth + ownership check ...
|
|
88
|
+
const { command, cwd, env } = await request.json();
|
|
89
|
+
const iface = await resolveCodeSession(locals.runtime, { requiredHostTargetKind: 'cloud' });
|
|
90
|
+
const result = await handleTranscriptRun({ session: iface }, { sessionId: params.id, command, cwd, env });
|
|
91
|
+
return json(result);
|
|
92
|
+
};
|
|
93
|
+
:::
|
|
94
|
+
|
|
95
|
+
## Svelte components
|
|
96
|
+
|
|
97
|
+
\`@vibesdotdev/code-sessions/svelte\` provides ready-to-use components and server-safe
|
|
98
|
+
SvelteKit loader helpers:
|
|
99
|
+
|
|
100
|
+
- **SessionCard** — status badge, host target, age, preview link, delete action
|
|
101
|
+
- **SessionList** — list of SessionCards with an empty state that teaches creation
|
|
102
|
+
- **CreateSessionDialog** — host-target picker, repository + branch fields
|
|
103
|
+
- **TranscriptView** — command input → output cards, exit codes, re-run, copy
|
|
104
|
+
- **loadCodeSessionsLayoutData** — list route data via the canonical runtime client
|
|
105
|
+
- **loadCodeSessionDetailData** — detail route data via the canonical runtime client
|
|
106
|
+
- **submitCodeSessionCreateAction / submitCodeSessionDeleteAction** — browser-side helpers for
|
|
107
|
+
SvelteKit route-action FormData and serialized \`ActionResult\` parsing
|
|
108
|
+
|
|
109
|
+
:::usage{language="ts"}
|
|
110
|
+
import { serviceOrigin } from '@vibesdotdev/infra-core/service';
|
|
111
|
+
import { loadCodeSessionsLayoutData } from '@vibesdotdev/code-sessions/svelte/loaders';
|
|
112
|
+
|
|
113
|
+
export const load = async (event) =>
|
|
114
|
+
loadCodeSessionsLayoutData(event, {
|
|
115
|
+
platformOrigin: await serviceOrigin(event.locals.runtime, 'platform')
|
|
116
|
+
});
|
|
117
|
+
:::
|
|
118
|
+
|
|
119
|
+
:::usage{language="svelte"}
|
|
120
|
+
<script>
|
|
121
|
+
import { deserialize } from '$app/forms';
|
|
122
|
+
import { goto, invalidateAll } from '$app/navigation';
|
|
123
|
+
import { SessionList, CreateSessionDialog } from '@vibesdotdev/code-sessions/svelte';
|
|
124
|
+
import { submitCodeSessionCreateAction } from '@vibesdotdev/code-sessions/svelte/actions';
|
|
125
|
+
|
|
126
|
+
let showCreate = $state(false);
|
|
127
|
+
let createError = $state(null);
|
|
128
|
+
|
|
129
|
+
async function handleCreate(input: CodeSessionCreateInput) {
|
|
130
|
+
const result = await submitCodeSessionCreateAction(fetch, deserialize, input);
|
|
131
|
+
if (!result.ok) {
|
|
132
|
+
// Keep app-specific copy/presentation here.
|
|
133
|
+
createError = result.message;
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
await invalidateAll();
|
|
137
|
+
if (result.sessionId) goto(\`/sessions/\${result.sessionId}\`);
|
|
138
|
+
}
|
|
139
|
+
</script>
|
|
140
|
+
|
|
141
|
+
<SessionList
|
|
142
|
+
{sessions}
|
|
143
|
+
oncreate={() => (showCreate = true)}
|
|
144
|
+
onopen={(s) => goto(\`/sessions/\${s.sessionId}\`)}
|
|
145
|
+
ondelete={(id) => deleteSession(id)}
|
|
146
|
+
/>
|
|
147
|
+
|
|
148
|
+
<CreateSessionDialog open={showCreate} oncreate={handleCreate} onclose={() => (showCreate = false)} />
|
|
149
|
+
:::
|
|
150
|
+
|
|
151
|
+
The Svelte package intentionally does not own auth, billing text, redirects, repository links, or
|
|
152
|
+
server route actions. Those stay in the consuming app; \`./loaders\` owns reads and \`./actions\`
|
|
153
|
+
owns browser submission/result parsing.
|
|
154
|
+
|
|
155
|
+
## Chat Build projection
|
|
156
|
+
|
|
157
|
+
chat-web has a projection route because a Build-mode room stores only
|
|
158
|
+
\`metadata.buildSession\` and chat-specific setup fields. Browser code calls the app-local
|
|
159
|
+
\`/api/build/sessions\` route directly for create/unbind. The server route then resolves
|
|
160
|
+
\`getVibesClient<CodeSessionsClient>('code-sessions', runtime)\`, forks it with the caller's verified Bearer token, and talks to
|
|
161
|
+
platform-web. Do not resolve the \`agent/code-session\` execution runtime from browser UI just to call
|
|
162
|
+
the chat projection route; \`agent/code-session\` remains the execution substrate behind
|
|
163
|
+
platform-web and its cloud/host adapters.
|
|
164
|
+
|
|
165
|
+
## Studio TUI surface
|
|
166
|
+
|
|
167
|
+
\`@vibesdotdev/code-sessions/tui\` owns the consumer-only Studio route at \`/code-sessions\`.
|
|
168
|
+
The TUI registers:
|
|
169
|
+
|
|
170
|
+
- \`tui/app\` id \`code-sessions.monitor\`
|
|
171
|
+
- \`tui/command\` id \`code-sessions.open\`
|
|
172
|
+
- \`tui/state\` id \`code-sessions.sessions\`
|
|
173
|
+
|
|
174
|
+
The state descriptor resolves \`getVibesClient<CodeSessionsClient>('code-sessions')\` through the
|
|
175
|
+
runtime client and calls \`list()\` plus \`getStartOptions()\`. The route shows session identity,
|
|
176
|
+
status, capability, host target, workspace, checkout ref, preview URL, and sign-in or service
|
|
177
|
+
recovery state. It ships runtime-backed create: the form renders the environment/workspace selectors
|
|
178
|
+
returned by \`getStartOptions()\` and dispatches the chosen target/source contract to
|
|
179
|
+
\`CodeSessionsClient.create(...)\`. For selected cloud snapshot sessions, it exposes a transcript
|
|
180
|
+
command runner backed by \`CodeSessionsClient.run(...)\`. For any selected session, it exposes
|
|
181
|
+
confirmed teardown backed by \`CodeSessionsClient.delete(...)\`. Interactive terminal attach stays out
|
|
182
|
+
of the TUI until it has live route-owned lifecycle evidence through the host attach path.
|
|
183
|
+
|
|
184
|
+
## Catalog and workspace binding
|
|
185
|
+
|
|
186
|
+
Packaged renderers (Desktop, mobile) never resolve the HTTP client or the local
|
|
187
|
+
execution plane directly. Two consumer-worker kinds project what they may see:
|
|
188
|
+
|
|
189
|
+
- \`code-sessions/catalog\` (asset \`code-sessions.catalog\`) — renderer-safe
|
|
190
|
+
session facts via the \`list\`/\`get\` exposure. The projection copies
|
|
191
|
+
presentation facts only; host paths and setup scripts stay in the worker.
|
|
192
|
+
- \`code-sessions/workspace-binding\` (asset
|
|
193
|
+
\`code-sessions.local-workspace-binding\`) — binds an opaque workspace
|
|
194
|
+
identity to a local code session through the \`bind\` exposure.
|
|
195
|
+
|
|
196
|
+
Both loaders run in \`consumer.worker\` scope behind a \`consumer-renderer\`
|
|
197
|
+
remote exposure. Import the kind contracts from
|
|
198
|
+
\`@vibesdotdev/code-sessions/catalog\` and \`@vibesdotdev/code-sessions/workspace\`.
|
|
199
|
+
|
|
200
|
+
## Capability flag
|
|
201
|
+
|
|
202
|
+
Every \`SessionWithCapability\` record has a \`capability\` field:
|
|
203
|
+
|
|
204
|
+
- \`'transcript'\` — CF Sandbox (snapshot execution, each command independent)
|
|
205
|
+
- \`'interactive'\` — PTY-capable host (live terminal)
|
|
206
|
+
|
|
207
|
+
Check this before rendering a terminal or transcript surface.
|
|
208
|
+
If you need to branch before a record has been annotated, import
|
|
209
|
+
\`resolveSessionCapability\` from \`@vibesdotdev/code-sessions/config\`.
|
|
210
|
+
|
|
211
|
+
## Deleting a session
|
|
212
|
+
|
|
213
|
+
:::usage{language="ts"}
|
|
214
|
+
await client.delete(session.sessionId);
|
|
215
|
+
// Platform record removed and live session torn down.
|
|
216
|
+
:::
|
|
217
|
+
|
|
218
|
+
## Local lifecycle proof
|
|
219
|
+
|
|
220
|
+
Direct Vite dev servers cannot prove cloud sandbox lifecycle success because they do not expose the
|
|
221
|
+
workerd \`SANDBOX\` binding. Use the dedicated Wrangler preset when collecting local acceptance
|
|
222
|
+
evidence:
|
|
223
|
+
|
|
224
|
+
:::usage{language="bash"}
|
|
225
|
+
bun run vibes pm preset start code-session-lifecycle-workerd
|
|
226
|
+
CHAT_E2E_APP_ORIGIN=https://chat.vibes.local \
|
|
227
|
+
CHAT_E2E_AUTH_ORIGIN=https://auth.vibes.local \
|
|
228
|
+
CHAT_E2E_ACCOUNT_ORIGIN=https://account.vibes.local \
|
|
229
|
+
CHAT_E2E_PLATFORM_ORIGIN=https://platform.vibes.local \
|
|
230
|
+
bun run --cwd apps/chat-web probe:code-session:lifecycle --require-workerd-preset --prime-billing
|
|
231
|
+
:::
|
|
232
|
+
|
|
233
|
+
Use direct Vite probe output only as blocker evidence, not as proof of successful cloud sessions.
|
|
234
|
+
The \`--require-workerd-preset\` flag makes the probe refuse acceptance evidence unless the dedicated
|
|
235
|
+
workerd PM preset is actually running, the \`d1-migrate-dev\` task has passed, app process health is
|
|
236
|
+
green, resources are ready, and conflicting dev stack processes are stopped.
|
|
237
|
+
`
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
export default descriptor;
|
|
241
|
+
//# sourceMappingURL=code-sessions.docs.descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-sessions.docs.descriptor.js","sourceRoot":"","sources":["../../src/docs/code-sessions.docs.descriptor.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAwB;IACvC,IAAI,EAAE,YAAY;IAClB,EAAE,EAAE,wBAAwB;IAC5B,MAAM,EAAE,UAAU;IAClB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,eAAe;IACtB,OAAO,EACN,oLAAoL;IACrL,IAAI,EAAE,CAAC,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAC;IAC3G,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC;IAClC,OAAO,EAAE,IAAI;IACb,IAAI,EAAE;QACL,IAAI,EAAE,UAAU;QAChB,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+NT;KACC;CACD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vibesdotdev/code-sessions — runtime-aligned code session feature package.
|
|
3
|
+
*
|
|
4
|
+
* Owns the canonical `runtime/client` surface for code-session management.
|
|
5
|
+
* Sessions are read/written through `getVibesClient<CodeSessionsClient>('code-sessions', runtime)`.
|
|
6
|
+
* Session data is owned by platform-web (`apps/platform-web/src/routes/api/code-sessions/*`).
|
|
7
|
+
*
|
|
8
|
+
* NOTE: the consumer impl is NOT exported from this barrel — it is lazily loaded
|
|
9
|
+
* by the plugin. `CodeSessionsApiClientConsumer` and `createSsrCodeSessionsClient`
|
|
10
|
+
* live on `./api` only, so root importers (including browser runtimes that take
|
|
11
|
+
* just the plugin or the types) never load the HTTP implementation module. Import
|
|
12
|
+
* the impl or the SSR factory from `@vibesdotdev/code-sessions/api`, the capability
|
|
13
|
+
* resolver from `./config`. The hosted transcript bridge is the premium overlay
|
|
14
|
+
* `@vibesdotdev/code-sessions-premium/bridge`.
|
|
15
|
+
*
|
|
16
|
+
* @see https://docs.vibes.dev/code-sessions
|
|
17
|
+
*/
|
|
18
|
+
export { codeSessionsPlugin, default } from './code-sessions.plugin.ts';
|
|
19
|
+
export { codeSessionsApiClientDescriptor, default as codeSessionsApiClientDescriptorDefault } from './api/code-sessions.api-client.descriptor.ts';
|
|
20
|
+
export { CodeSessionsApiError, CodeSessionsNotSignedInError, type CodeSessionsClient, type CodeSessionsClientOptions, type CodeSessionServiceAssertion, type SessionCapability, type SessionWithCapability, type CodeSessionListOptions, type CodeSessionCreateInput, type LocalCodeSessionCreateInput, type PlatformCodeSessionCreateInput, type CodeSessionStartTargetOption, type CodeSessionStartSourceOption, type CodeSessionStartOptions, type RunCommandRequest, type RunCommandResponse, type PushBranchRequest, type PushBranchResponse, type CreatePullRequestRequest, type CreatePullRequestResponse } from './api/code-sessions.api-client.types.ts';
|
|
21
|
+
export type { CodeSessionSeed } from '@vibesdotdev/platform/api';
|
|
22
|
+
export { resolveSessionCapability } from './capability.ts';
|
|
23
|
+
export * from './catalog/index.ts';
|
|
24
|
+
export * from './workspace/index.ts';
|
|
25
|
+
export { pullRequestPlanForSession, pullRequestPlanAfterPublish, type PullRequestPlan, type PullRequestPlanSession } from './pull-request-plan.ts';
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAIxE,OAAO,EACN,+BAA+B,EAC/B,OAAO,IAAI,sCAAsC,EACjD,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACN,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,MAAM,yCAAyC,CAAC;AAKjD,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EACN,yBAAyB,EACzB,2BAA2B,EAC3B,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vibesdotdev/code-sessions — runtime-aligned code session feature package.
|
|
3
|
+
*
|
|
4
|
+
* Owns the canonical `runtime/client` surface for code-session management.
|
|
5
|
+
* Sessions are read/written through `getVibesClient<CodeSessionsClient>('code-sessions', runtime)`.
|
|
6
|
+
* Session data is owned by platform-web (`apps/platform-web/src/routes/api/code-sessions/*`).
|
|
7
|
+
*
|
|
8
|
+
* NOTE: the consumer impl is NOT exported from this barrel — it is lazily loaded
|
|
9
|
+
* by the plugin. `CodeSessionsApiClientConsumer` and `createSsrCodeSessionsClient`
|
|
10
|
+
* live on `./api` only, so root importers (including browser runtimes that take
|
|
11
|
+
* just the plugin or the types) never load the HTTP implementation module. Import
|
|
12
|
+
* the impl or the SSR factory from `@vibesdotdev/code-sessions/api`, the capability
|
|
13
|
+
* resolver from `./config`. The hosted transcript bridge is the premium overlay
|
|
14
|
+
* `@vibesdotdev/code-sessions-premium/bridge`.
|
|
15
|
+
*
|
|
16
|
+
* @see https://docs.vibes.dev/code-sessions
|
|
17
|
+
*/
|
|
18
|
+
export { codeSessionsPlugin, default } from "./code-sessions.plugin.js";
|
|
19
|
+
// Explicit re-exports from the leaf modules — never `export *` from `./api`,
|
|
20
|
+
// which would re-expose the consumer impl above and defeat the plugin's lazy
|
|
21
|
+
// loader for every root importer.
|
|
22
|
+
export { codeSessionsApiClientDescriptor, default as codeSessionsApiClientDescriptorDefault } from "./api/code-sessions.api-client.descriptor.js";
|
|
23
|
+
export { CodeSessionsApiError, CodeSessionsNotSignedInError } from "./api/code-sessions.api-client.types.js";
|
|
24
|
+
export { resolveSessionCapability } from "./capability.js";
|
|
25
|
+
export * from "./catalog/index.js";
|
|
26
|
+
export * from "./workspace/index.js";
|
|
27
|
+
export { pullRequestPlanForSession, pullRequestPlanAfterPublish } from "./pull-request-plan.js";
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACxE,6EAA6E;AAC7E,6EAA6E;AAC7E,kCAAkC;AAClC,OAAO,EACN,+BAA+B,EAC/B,OAAO,IAAI,sCAAsC,EACjD,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACN,oBAAoB,EACpB,4BAA4B,EAmB5B,MAAM,yCAAyC,CAAC;AAMjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EACN,yBAAyB,EACzB,2BAA2B,EAG3B,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Can this session become a pull request, and with what?
|
|
3
|
+
*
|
|
4
|
+
* Drew's fifth predicate is "the code session results in a PR with a live
|
|
5
|
+
* preview URL if applicable". The dangerous half is `if applicable`: an
|
|
6
|
+
* ephemeral scratch session has no repository and no branch, so there is
|
|
7
|
+
* nothing to open a PR from, and a surface that offers the button anyway — or
|
|
8
|
+
* worse, invents a branch — would be claiming work exists where it does not.
|
|
9
|
+
*
|
|
10
|
+
* This module answers the question ONCE, as data, so the web action, the CLI,
|
|
11
|
+
* and any future automation agree on when a PR is possible and what it should
|
|
12
|
+
* say. It deliberately does NOT open the PR: `forge-tools`'
|
|
13
|
+
* `executePrCreateFromBranch` already owns that, and a second creation path
|
|
14
|
+
* would drift from it.
|
|
15
|
+
*/
|
|
16
|
+
/** The subset of a session record this decision needs. */
|
|
17
|
+
export interface PullRequestPlanSession {
|
|
18
|
+
sessionId: string;
|
|
19
|
+
repositoryName?: string | null;
|
|
20
|
+
repositoryId?: string | null;
|
|
21
|
+
checkoutRef?: string | null;
|
|
22
|
+
ephemeral?: boolean;
|
|
23
|
+
seed?: {
|
|
24
|
+
source?: string;
|
|
25
|
+
title?: string;
|
|
26
|
+
ref?: string;
|
|
27
|
+
body?: string;
|
|
28
|
+
} | null;
|
|
29
|
+
}
|
|
30
|
+
export type PullRequestPlan = {
|
|
31
|
+
ready: true;
|
|
32
|
+
/** Repo ref for `forge-pr-create-from-branch` (`repo`). */
|
|
33
|
+
repo: string;
|
|
34
|
+
/** Branch the session's work is on (`sourceRef`). */
|
|
35
|
+
sourceRef: string;
|
|
36
|
+
title: string;
|
|
37
|
+
description: string;
|
|
38
|
+
} | {
|
|
39
|
+
ready: false;
|
|
40
|
+
/** Shown to the user verbatim — say why, never imply the PR is coming. */
|
|
41
|
+
reason: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Build the PR plan for a session, or explain precisely why there isn't one.
|
|
45
|
+
*
|
|
46
|
+
* Ordering matters: the ephemeral check comes FIRST because an ephemeral
|
|
47
|
+
* session is a deliberate product state ("scratch space, no repository"), not
|
|
48
|
+
* a misconfiguration, and telling the user their session "has no branch" would
|
|
49
|
+
* describe it as broken when it is working as designed.
|
|
50
|
+
*/
|
|
51
|
+
export declare function pullRequestPlanForSession(session: PullRequestPlanSession): PullRequestPlan;
|
|
52
|
+
/**
|
|
53
|
+
* Plan a PR immediately after a successful publish.
|
|
54
|
+
*
|
|
55
|
+
* The push response carries the repository and branch the platform *proved*
|
|
56
|
+
* (`owner/name` + the branch git actually pushed). Those take precedence over
|
|
57
|
+
* the session's create-time fields: a session may have drifted off its original
|
|
58
|
+
* checkout ref, and the push binding is the only `owner/name` Forge URLs and
|
|
59
|
+
* `forge-pr-create-from-branch` both accept without ambiguity.
|
|
60
|
+
*
|
|
61
|
+
* Surfaces must not invent a second plan — call this (or
|
|
62
|
+
* {@link pullRequestPlanForSession}) and render/act on the result.
|
|
63
|
+
*/
|
|
64
|
+
export declare function pullRequestPlanAfterPublish(session: PullRequestPlanSession, published: {
|
|
65
|
+
repository?: string | null;
|
|
66
|
+
branch?: string | null;
|
|
67
|
+
}): PullRequestPlan;
|
|
68
|
+
//# sourceMappingURL=pull-request-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull-request-plan.d.ts","sourceRoot":"","sources":["../src/pull-request-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,0DAA0D;AAC1D,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAC/E;AAED,MAAM,MAAM,eAAe,GACxB;IACA,KAAK,EAAE,IAAI,CAAC;IACZ,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACnB,GACD;IACA,KAAK,EAAE,KAAK,CAAC;IACb,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;CACd,CAAC;AAEL;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,sBAAsB,GAAG,eAAe,CA8C1F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAC1C,OAAO,EAAE,sBAAsB,EAC/B,SAAS,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC/D,eAAe,CAYjB"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Can this session become a pull request, and with what?
|
|
3
|
+
*
|
|
4
|
+
* Drew's fifth predicate is "the code session results in a PR with a live
|
|
5
|
+
* preview URL if applicable". The dangerous half is `if applicable`: an
|
|
6
|
+
* ephemeral scratch session has no repository and no branch, so there is
|
|
7
|
+
* nothing to open a PR from, and a surface that offers the button anyway — or
|
|
8
|
+
* worse, invents a branch — would be claiming work exists where it does not.
|
|
9
|
+
*
|
|
10
|
+
* This module answers the question ONCE, as data, so the web action, the CLI,
|
|
11
|
+
* and any future automation agree on when a PR is possible and what it should
|
|
12
|
+
* say. It deliberately does NOT open the PR: `forge-tools`'
|
|
13
|
+
* `executePrCreateFromBranch` already owns that, and a second creation path
|
|
14
|
+
* would drift from it.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Build the PR plan for a session, or explain precisely why there isn't one.
|
|
18
|
+
*
|
|
19
|
+
* Ordering matters: the ephemeral check comes FIRST because an ephemeral
|
|
20
|
+
* session is a deliberate product state ("scratch space, no repository"), not
|
|
21
|
+
* a misconfiguration, and telling the user their session "has no branch" would
|
|
22
|
+
* describe it as broken when it is working as designed.
|
|
23
|
+
*/
|
|
24
|
+
export function pullRequestPlanForSession(session) {
|
|
25
|
+
if (session.ephemeral === true) {
|
|
26
|
+
return {
|
|
27
|
+
ready: false,
|
|
28
|
+
reason: 'This is an ephemeral workspace — scratch space with no repository, so there is nothing to open a pull request from. Start a session against a repository to produce one.'
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const repo = session.repositoryName?.trim();
|
|
32
|
+
if (!repo) {
|
|
33
|
+
return {
|
|
34
|
+
ready: false,
|
|
35
|
+
reason: 'This session is not linked to a repository, so there is no repository to open a pull request against.'
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const sourceRef = session.checkoutRef?.trim();
|
|
39
|
+
if (!sourceRef) {
|
|
40
|
+
return {
|
|
41
|
+
ready: false,
|
|
42
|
+
reason: 'This session has no branch recorded, so there is no branch to open a pull request from.'
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
// The seed is what makes the PR traceable to the work item it came from —
|
|
46
|
+
// the whole point of carrying `{source:'work-item', ref}` through the
|
|
47
|
+
// spawn flow. Without a seed the session is still PR-able; it just cannot
|
|
48
|
+
// claim a work item it does not have.
|
|
49
|
+
const seedTitle = session.seed?.title?.trim();
|
|
50
|
+
const workItemRef = session.seed?.source === 'work-item' ? session.seed.ref?.trim() : undefined;
|
|
51
|
+
const title = seedTitle ? seedTitle : `Work from code session ${session.sessionId}`;
|
|
52
|
+
const lines = [
|
|
53
|
+
seedTitle
|
|
54
|
+
? `Opened from a code session started for: ${seedTitle}`
|
|
55
|
+
: 'Opened from a code session.',
|
|
56
|
+
'',
|
|
57
|
+
`Session: ${session.sessionId}`,
|
|
58
|
+
`Branch: ${sourceRef}`
|
|
59
|
+
];
|
|
60
|
+
if (workItemRef)
|
|
61
|
+
lines.push(`Work item: ${workItemRef}`);
|
|
62
|
+
// NOTE (ruling, SESSIONS.md 2026-07-25): a preview URL is NEVER derived
|
|
63
|
+
// from `session.previewUrl`. That is the sandbox's dev-server port and dies
|
|
64
|
+
// with the session; a PR's preview must be a deployed branch preview. If
|
|
65
|
+
// one does not exist, the PR says nothing about previews rather than
|
|
66
|
+
// pointing at a URL that will be dead when a reviewer opens it.
|
|
67
|
+
return { ready: true, repo, sourceRef, title, description: lines.join('\n') };
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Plan a PR immediately after a successful publish.
|
|
71
|
+
*
|
|
72
|
+
* The push response carries the repository and branch the platform *proved*
|
|
73
|
+
* (`owner/name` + the branch git actually pushed). Those take precedence over
|
|
74
|
+
* the session's create-time fields: a session may have drifted off its original
|
|
75
|
+
* checkout ref, and the push binding is the only `owner/name` Forge URLs and
|
|
76
|
+
* `forge-pr-create-from-branch` both accept without ambiguity.
|
|
77
|
+
*
|
|
78
|
+
* Surfaces must not invent a second plan — call this (or
|
|
79
|
+
* {@link pullRequestPlanForSession}) and render/act on the result.
|
|
80
|
+
*/
|
|
81
|
+
export function pullRequestPlanAfterPublish(session, published) {
|
|
82
|
+
const repository = Object.prototype.hasOwnProperty.call(published, 'repository')
|
|
83
|
+
? published.repository?.trim()
|
|
84
|
+
: session.repositoryName;
|
|
85
|
+
const branch = Object.prototype.hasOwnProperty.call(published, 'branch')
|
|
86
|
+
? published.branch?.trim()
|
|
87
|
+
: session.checkoutRef;
|
|
88
|
+
return pullRequestPlanForSession({
|
|
89
|
+
...session,
|
|
90
|
+
repositoryName: repository,
|
|
91
|
+
checkoutRef: branch
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=pull-request-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull-request-plan.js","sourceRoot":"","sources":["../src/pull-request-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA4BH;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAA+B;IACxE,IAAI,OAAO,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;QAChC,OAAO;YACN,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,0KAA0K;SAClL,CAAC;IACH,CAAC;IACD,MAAM,IAAI,GAAG,OAAO,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC;IAC5C,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO;YACN,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,uGAAuG;SAC/G,CAAC;IACH,CAAC;IACD,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;IAC9C,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,OAAO;YACN,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,yFAAyF;SACjG,CAAC;IACH,CAAC;IAED,0EAA0E;IAC1E,sEAAsE;IACtE,0EAA0E;IAC1E,sCAAsC;IACtC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAEhG,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,0BAA0B,OAAO,CAAC,SAAS,EAAE,CAAC;IACpF,MAAM,KAAK,GAAG;QACb,SAAS;YACR,CAAC,CAAC,2CAA2C,SAAS,EAAE;YACxD,CAAC,CAAC,6BAA6B;QAChC,EAAE;QACF,YAAY,OAAO,CAAC,SAAS,EAAE;QAC/B,WAAW,SAAS,EAAE;KACtB,CAAC;IACF,IAAI,WAAW;QAAE,KAAK,CAAC,IAAI,CAAC,cAAc,WAAW,EAAE,CAAC,CAAC;IACzD,wEAAwE;IACxE,4EAA4E;IAC5E,yEAAyE;IACzE,qEAAqE;IACrE,gEAAgE;IAEhE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC/E,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,2BAA2B,CAC1C,OAA+B,EAC/B,SAAiE;IAEjE,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC;QAC/E,CAAC,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE;QAC9B,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;IAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC;QACvE,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE;QAC1B,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IACvB,OAAO,yBAAyB,CAAC;QAChC,GAAG,OAAO;QACV,cAAc,EAAE,UAAU;QAC1B,WAAW,EAAE,MAAM;KACnB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
/** A replayable request for repository-backed execution, before its first turn. */
|
|
3
|
+
export declare const codeSessionPreparationSchema: z.ZodObject<{
|
|
4
|
+
operationId: z.ZodUUID;
|
|
5
|
+
repositoryId: z.ZodOptional<z.ZodUUID>;
|
|
6
|
+
createRepositoryIfMissing: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
+
hostTarget: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
8
|
+
kind: z.ZodLiteral<"cloud">;
|
|
9
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
10
|
+
kind: z.ZodLiteral<"host">;
|
|
11
|
+
hostId: z.ZodString;
|
|
12
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
+
kind: z.ZodLiteral<"provisioned">;
|
|
14
|
+
adapter: z.ZodString;
|
|
15
|
+
region: z.ZodOptional<z.ZodString>;
|
|
16
|
+
size: z.ZodOptional<z.ZodString>;
|
|
17
|
+
image: z.ZodOptional<z.ZodString>;
|
|
18
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
19
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
20
|
+
ttlHours: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
providerConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
22
|
+
}, z.core.$strip>], "kind">>;
|
|
23
|
+
goal: z.ZodString;
|
|
24
|
+
chatRoomId: z.ZodUUID;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export type CodeSessionPreparationInput = z.input<typeof codeSessionPreparationSchema>;
|
|
27
|
+
/** Only a ready filesystem is an execution binding; allocation alone is not. */
|
|
28
|
+
export declare const preparedCodeSessionSchema: z.ZodObject<{
|
|
29
|
+
sessionId: z.ZodString;
|
|
30
|
+
repositoryId: z.ZodUUID;
|
|
31
|
+
hostTarget: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
32
|
+
kind: z.ZodLiteral<"cloud">;
|
|
33
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
34
|
+
kind: z.ZodLiteral<"host">;
|
|
35
|
+
hostId: z.ZodString;
|
|
36
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
+
kind: z.ZodLiteral<"provisioned">;
|
|
38
|
+
adapter: z.ZodString;
|
|
39
|
+
region: z.ZodOptional<z.ZodString>;
|
|
40
|
+
size: z.ZodOptional<z.ZodString>;
|
|
41
|
+
image: z.ZodOptional<z.ZodString>;
|
|
42
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
43
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
44
|
+
ttlHours: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
providerConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
46
|
+
}, z.core.$strip>], "kind">;
|
|
47
|
+
workspacePath: z.ZodString;
|
|
48
|
+
status: z.ZodLiteral<"active">;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type PreparedCodeSession = z.infer<typeof preparedCodeSessionSchema>;
|
|
51
|
+
//# sourceMappingURL=preparation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preparation.d.ts","sourceRoot":"","sources":["../../src/schemas/preparation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,mFAAmF;AACnF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;iBAOvC,CAAC;AACH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAEvF,gFAAgF;AAChF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;iBAMpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import { SessionHostTargetSchema } from '@vibesdotdev/agent-execution/code-session';
|
|
3
|
+
/** A replayable request for repository-backed execution, before its first turn. */
|
|
4
|
+
export const codeSessionPreparationSchema = z.object({
|
|
5
|
+
operationId: z.uuid(),
|
|
6
|
+
repositoryId: z.uuid().optional(),
|
|
7
|
+
createRepositoryIfMissing: z.boolean().default(false),
|
|
8
|
+
hostTarget: SessionHostTargetSchema.optional(),
|
|
9
|
+
goal: z.string().min(1),
|
|
10
|
+
chatRoomId: z.uuid()
|
|
11
|
+
});
|
|
12
|
+
/** Only a ready filesystem is an execution binding; allocation alone is not. */
|
|
13
|
+
export const preparedCodeSessionSchema = z.object({
|
|
14
|
+
sessionId: z.string().min(1),
|
|
15
|
+
repositoryId: z.uuid(),
|
|
16
|
+
hostTarget: SessionHostTargetSchema,
|
|
17
|
+
workspacePath: z.string().min(1),
|
|
18
|
+
status: z.literal('active')
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=preparation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preparation.js","sourceRoot":"","sources":["../../src/schemas/preparation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAEpF,mFAAmF;AACnF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,WAAW,EAAE,CAAC,CAAC,IAAI,EAAE;IACrB,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IACjC,yBAAyB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACrD,UAAU,EAAE,uBAAuB,CAAC,QAAQ,EAAE;IAC9C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,UAAU,EAAE,CAAC,CAAC,IAAI,EAAE;CACpB,CAAC,CAAC;AAGH,gFAAgF;AAChF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE;IACtB,UAAU,EAAE,uBAAuB;IACnC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;CAC3B,CAAC,CAAC"}
|