@zusehq/serve 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +1 -1
- package/dist/{cli-Cz9Ua4SV.mjs → cli-BKZzhoKT.mjs} +439 -271
- package/dist/cli-BKZzhoKT.mjs.map +1 -0
- package/dist/cli.mjs +1 -1
- package/package.json +1 -1
- package/dist/cli-Cz9Ua4SV.mjs.map +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { readFile, stat } from "node:fs/promises";
|
|
3
|
+
import { homedir } from "node:os";
|
|
3
4
|
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
4
5
|
import { Data, Effect, Layer, ManagedRuntime, Schema, Scope, Struct } from "effect";
|
|
5
6
|
import { Rpc, RpcClient, RpcGroup, RpcSerialization } from "effect/unstable/rpc";
|
|
6
7
|
import { Socket } from "effect/unstable/socket";
|
|
7
8
|
//#region package.json
|
|
8
|
-
var version = "0.1.
|
|
9
|
+
var version = "0.1.5";
|
|
9
10
|
//#endregion
|
|
10
11
|
//#region ../client-runtime/src/connection.ts
|
|
11
12
|
var WireProtocolMismatchError = class extends Data.TaggedError("WireProtocolMismatchError") {};
|
|
@@ -57,7 +58,7 @@ const WorktreeId = makeEntityId("WorktreeId");
|
|
|
57
58
|
const ChatId = makeEntityId("ChatId");
|
|
58
59
|
const EnvironmentId = makeEntityId("EnvironmentId");
|
|
59
60
|
const AuthTokenId = makeEntityId("AuthTokenId");
|
|
60
|
-
makeEntityId("CommandId");
|
|
61
|
+
const CommandId = makeEntityId("CommandId");
|
|
61
62
|
makeEntityId("EventId");
|
|
62
63
|
//#endregion
|
|
63
64
|
//#region ../contracts/src/agent.ts
|
|
@@ -360,9 +361,17 @@ const VersionEvent = Schema.TaggedStruct("Version", {
|
|
|
360
361
|
sdkVersion: Schema.optional(Schema.String)
|
|
361
362
|
});
|
|
362
363
|
const CapabilitiesEvent = Schema.TaggedStruct("Capabilities", { capabilities: Schema.Array(Schema.String) });
|
|
364
|
+
/** Absolute, monotonically revised text emitted for one stable provider item. */
|
|
365
|
+
const ProviderMessageCheckpoint = Schema.Struct({
|
|
366
|
+
/** Revisions start at 1 and increase for every accepted cumulative value. */
|
|
367
|
+
revision: Schema.Number,
|
|
368
|
+
/** Final promotion is itself a strictly newer revision. */
|
|
369
|
+
final: Schema.Boolean
|
|
370
|
+
});
|
|
363
371
|
const AssistantMessageEvent = Schema.TaggedStruct("AssistantMessage", {
|
|
364
372
|
itemId: AgentItemId,
|
|
365
373
|
text: Schema.String,
|
|
374
|
+
checkpoint: Schema.optional(ProviderMessageCheckpoint),
|
|
366
375
|
/** True when the provider emitted a dedicated final plan item. */
|
|
367
376
|
isPlan: Schema.optional(Schema.Boolean),
|
|
368
377
|
parentItemId: Schema.optional(AgentItemId)
|
|
@@ -371,6 +380,7 @@ const ThinkingEvent = Schema.TaggedStruct("Thinking", {
|
|
|
371
380
|
itemId: AgentItemId,
|
|
372
381
|
text: Schema.String,
|
|
373
382
|
redacted: Schema.Boolean,
|
|
383
|
+
checkpoint: Schema.optional(ProviderMessageCheckpoint),
|
|
374
384
|
parentItemId: Schema.optional(AgentItemId)
|
|
375
385
|
});
|
|
376
386
|
/**
|
|
@@ -1841,6 +1851,15 @@ var FsConflictError = class extends Schema.TaggedErrorClass()("FsConflictError",
|
|
|
1841
1851
|
expectedMtime: Schema.String,
|
|
1842
1852
|
actualMtime: Schema.String
|
|
1843
1853
|
}) {};
|
|
1854
|
+
/**
|
|
1855
|
+
* A command id is an idempotency key, so it may only ever describe one exact
|
|
1856
|
+
* file write. Reusing it with a different target or payload is rejected
|
|
1857
|
+
* instead of returning an unrelated prior receipt.
|
|
1858
|
+
*/
|
|
1859
|
+
var FsCommandReuseError = class extends Schema.TaggedErrorClass()("FsCommandReuseError", {
|
|
1860
|
+
commandId: CommandId,
|
|
1861
|
+
reason: Schema.Literals(["target-mismatch", "payload-mismatch"])
|
|
1862
|
+
}) {};
|
|
1844
1863
|
var FsExternalReadError = class extends Schema.TaggedErrorClass()("FsExternalReadError", {
|
|
1845
1864
|
path: Schema.String,
|
|
1846
1865
|
reason: Schema.String
|
|
@@ -1880,6 +1899,7 @@ const FsWriteFileErrors = Schema.Union([
|
|
|
1880
1899
|
FsPathOutsideError,
|
|
1881
1900
|
FsReadError,
|
|
1882
1901
|
FsConflictError,
|
|
1902
|
+
FsCommandReuseError,
|
|
1883
1903
|
FsTooLargeError
|
|
1884
1904
|
]);
|
|
1885
1905
|
const FsCreateErrors = Schema.Union([
|
|
@@ -1909,17 +1929,35 @@ const FsTreeRpc = Rpc.make("fs.tree", {
|
|
|
1909
1929
|
success: Schema.Array(FsEntry),
|
|
1910
1930
|
error: FsErrors
|
|
1911
1931
|
});
|
|
1932
|
+
const FsTreeWatchEvent = Schema.Union([
|
|
1933
|
+
Schema.TaggedStruct("ready", {
|
|
1934
|
+
epoch: Schema.String,
|
|
1935
|
+
sequence: Schema.Number
|
|
1936
|
+
}),
|
|
1937
|
+
Schema.TaggedStruct("changed", {
|
|
1938
|
+
epoch: Schema.String,
|
|
1939
|
+
sequence: Schema.Number,
|
|
1940
|
+
paths: Schema.Array(Schema.String)
|
|
1941
|
+
}),
|
|
1942
|
+
Schema.TaggedStruct("gap", {
|
|
1943
|
+
epoch: Schema.String,
|
|
1944
|
+
sequence: Schema.Number,
|
|
1945
|
+
reason: Schema.String
|
|
1946
|
+
})
|
|
1947
|
+
]);
|
|
1912
1948
|
/**
|
|
1913
1949
|
* Live stream of filesystem changes under the current project/worktree root.
|
|
1914
|
-
*
|
|
1915
|
-
*
|
|
1950
|
+
* `ready` proves the server watcher was attached before a client reads its
|
|
1951
|
+
* snapshot. Subsequent `changed` frames carry a stream-local monotonic
|
|
1952
|
+
* sequence. `gap` means the watcher can no longer prove continuity and the
|
|
1953
|
+
* client must attach a replacement watcher and perform a full reconciliation.
|
|
1916
1954
|
*/
|
|
1917
1955
|
const FsWatchTreeRpc = Rpc.make("fs.watchTree", {
|
|
1918
1956
|
payload: Schema.Struct({
|
|
1919
1957
|
folderId: FolderId,
|
|
1920
1958
|
worktreeId: Schema.optional(Schema.NullOr(WorktreeId))
|
|
1921
1959
|
}),
|
|
1922
|
-
success:
|
|
1960
|
+
success: FsTreeWatchEvent,
|
|
1923
1961
|
error: FsErrors,
|
|
1924
1962
|
stream: true
|
|
1925
1963
|
});
|
|
@@ -1964,6 +2002,8 @@ const FsReadFileRpc = Rpc.make("fs.readFile", {
|
|
|
1964
2002
|
*/
|
|
1965
2003
|
const FsWriteFileRpc = Rpc.make("fs.writeFile", {
|
|
1966
2004
|
payload: Schema.Struct({
|
|
2005
|
+
/** Stable identity makes a lost write response safe to retry. */
|
|
2006
|
+
commandId: CommandId,
|
|
1967
2007
|
folderId: FolderId,
|
|
1968
2008
|
path: Schema.String,
|
|
1969
2009
|
content: Schema.String,
|
|
@@ -2447,6 +2487,7 @@ const UserRichContent = Schema.TaggedStruct("user_rich", {
|
|
|
2447
2487
|
const AssistantContent = Schema.TaggedStruct("assistant", {
|
|
2448
2488
|
itemId: Schema.optional(AgentItemId),
|
|
2449
2489
|
text: Schema.String,
|
|
2490
|
+
checkpoint: Schema.optional(ProviderMessageCheckpoint),
|
|
2450
2491
|
/** Preserves a provider's dedicated final-plan item through persistence. */
|
|
2451
2492
|
isPlan: Schema.optional(Schema.Boolean),
|
|
2452
2493
|
parentItemId: Schema.optional(AgentItemId)
|
|
@@ -2461,6 +2502,7 @@ const ThinkingContent = Schema.TaggedStruct("thinking", {
|
|
|
2461
2502
|
itemId: AgentItemId,
|
|
2462
2503
|
text: Schema.String,
|
|
2463
2504
|
redacted: Schema.Boolean,
|
|
2505
|
+
checkpoint: Schema.optional(ProviderMessageCheckpoint),
|
|
2464
2506
|
parentItemId: Schema.optional(AgentItemId)
|
|
2465
2507
|
});
|
|
2466
2508
|
const ToolUseContent = Schema.TaggedStruct("tool_use", {
|
|
@@ -2627,6 +2669,16 @@ var QueuedMessageNotFoundError = class extends Schema.TaggedErrorClass()("Queued
|
|
|
2627
2669
|
sessionId: SessionId,
|
|
2628
2670
|
queueId: Schema.String
|
|
2629
2671
|
}) {};
|
|
2672
|
+
var QueuedMessageCapacityError = class extends Schema.TaggedErrorClass()("QueuedMessageCapacityError", {
|
|
2673
|
+
sessionId: SessionId,
|
|
2674
|
+
reason: Schema.Literals([
|
|
2675
|
+
"too-many-items",
|
|
2676
|
+
"item-too-large",
|
|
2677
|
+
"queue-too-large"
|
|
2678
|
+
]),
|
|
2679
|
+
limit: Schema.Number,
|
|
2680
|
+
actual: Schema.Number
|
|
2681
|
+
}) {};
|
|
2630
2682
|
var QueueState = class extends Schema.Class("QueueState")({
|
|
2631
2683
|
items: Schema.Array(QueuedMessage),
|
|
2632
2684
|
paused: Schema.Boolean
|
|
@@ -2644,6 +2696,8 @@ const SessionTimelineTurn = Schema.Struct({
|
|
|
2644
2696
|
});
|
|
2645
2697
|
var SessionTimelineProjection = class extends Schema.Class("SessionTimelineProjection")({
|
|
2646
2698
|
messages: Schema.Array(Message),
|
|
2699
|
+
/** Sequence immediately before the oldest materialized message, if any. */
|
|
2700
|
+
olderMessageSequence: Schema.optional(Schema.NullOr(Schema.Number)),
|
|
2647
2701
|
status: SessionStatus,
|
|
2648
2702
|
currentTurn: Schema.NullOr(SessionTimelineTurn),
|
|
2649
2703
|
queue: QueueState,
|
|
@@ -2683,24 +2737,46 @@ const SessionTimelineEvent = Schema.Union([
|
|
|
2683
2737
|
Schema.TaggedStruct("QueueRemoved", { queueId: Schema.String }),
|
|
2684
2738
|
Schema.TaggedStruct("QueueReordered", { queueIds: Schema.Array(Schema.String) })
|
|
2685
2739
|
]);
|
|
2740
|
+
/** Durable cursor for one database epoch and one session stream. */
|
|
2741
|
+
const SessionStreamCursor = Schema.Struct({
|
|
2742
|
+
epoch: Schema.String,
|
|
2743
|
+
version: Schema.Number
|
|
2744
|
+
});
|
|
2686
2745
|
const SessionTimelineFrame = Schema.Union([
|
|
2687
2746
|
Schema.Struct({
|
|
2688
2747
|
kind: Schema.Literal("snapshot"),
|
|
2689
2748
|
sessionId: SessionId,
|
|
2690
2749
|
throughVersion: Schema.Number,
|
|
2691
|
-
projection: SessionTimelineProjection
|
|
2750
|
+
projection: SessionTimelineProjection,
|
|
2751
|
+
/** Present on new runtimes; omitted by older peers during protocol rollout. */
|
|
2752
|
+
cursor: Schema.optional(SessionStreamCursor),
|
|
2753
|
+
/** Sequence immediately before the oldest included message, if any. */
|
|
2754
|
+
olderMessageSequence: Schema.optional(Schema.NullOr(Schema.Number))
|
|
2692
2755
|
}),
|
|
2693
2756
|
Schema.Struct({
|
|
2694
2757
|
kind: Schema.Literal("event"),
|
|
2695
2758
|
sessionId: SessionId,
|
|
2696
2759
|
streamVersion: Schema.Number,
|
|
2697
2760
|
eventId: Schema.String,
|
|
2698
|
-
event: SessionTimelineEvent
|
|
2761
|
+
event: SessionTimelineEvent,
|
|
2762
|
+
cursor: Schema.optional(SessionStreamCursor)
|
|
2699
2763
|
}),
|
|
2700
2764
|
Schema.Struct({
|
|
2701
2765
|
kind: Schema.Literal("synchronized"),
|
|
2702
2766
|
sessionId: SessionId,
|
|
2703
|
-
throughVersion: Schema.Number
|
|
2767
|
+
throughVersion: Schema.Number,
|
|
2768
|
+
cursor: Schema.optional(SessionStreamCursor)
|
|
2769
|
+
}),
|
|
2770
|
+
Schema.Struct({
|
|
2771
|
+
kind: Schema.Literal("reset-required"),
|
|
2772
|
+
sessionId: SessionId,
|
|
2773
|
+
throughVersion: Schema.Number,
|
|
2774
|
+
cursor: SessionStreamCursor,
|
|
2775
|
+
reason: Schema.Literals([
|
|
2776
|
+
"restored",
|
|
2777
|
+
"compacted",
|
|
2778
|
+
"cursor-invalid"
|
|
2779
|
+
])
|
|
2704
2780
|
})
|
|
2705
2781
|
]);
|
|
2706
2782
|
var SessionNotFoundError = class extends Schema.TaggedErrorClass()("SessionNotFoundError", { sessionId: SessionId }) {};
|
|
@@ -2821,6 +2897,7 @@ const SessionSetWorktreeRpc = Rpc.make("session.setWorktree", {
|
|
|
2821
2897
|
});
|
|
2822
2898
|
const SessionRenameRpc = Rpc.make("session.rename", {
|
|
2823
2899
|
payload: Schema.Struct({
|
|
2900
|
+
commandId: CommandId,
|
|
2824
2901
|
sessionId: SessionId,
|
|
2825
2902
|
title: Schema.String
|
|
2826
2903
|
}),
|
|
@@ -3072,6 +3149,7 @@ const ChatCreationOperation = Schema.Struct({
|
|
|
3072
3149
|
prompt: Schema.NullOr(Schema.String),
|
|
3073
3150
|
startupInput: Schema.NullOr(ComposerInput),
|
|
3074
3151
|
startupQueueId: Schema.NullOr(Schema.String),
|
|
3152
|
+
startupReady: Schema.Boolean,
|
|
3075
3153
|
workspacePolicy: ChatWorkspacePolicy,
|
|
3076
3154
|
worktreeId: Schema.NullOr(WorktreeId),
|
|
3077
3155
|
status: ChatCreationOperationStatus,
|
|
@@ -3083,9 +3161,16 @@ const ChatCreationListRpc = Rpc.make("chat.creation.list", {
|
|
|
3083
3161
|
payload: Schema.Struct({ projectId: FolderId }),
|
|
3084
3162
|
success: Schema.Array(ChatCreationOperation)
|
|
3085
3163
|
});
|
|
3164
|
+
const ChatCreationSummaryChange = Schema.Union([Schema.Struct({
|
|
3165
|
+
_tag: Schema.Literal("snapshot"),
|
|
3166
|
+
operations: Schema.Array(ChatCreationOperation)
|
|
3167
|
+
}), Schema.Struct({
|
|
3168
|
+
_tag: Schema.Literal("change"),
|
|
3169
|
+
operation: ChatCreationOperation
|
|
3170
|
+
})]);
|
|
3086
3171
|
const ChatCreationStreamRpc = Rpc.make("chat.creation.stream", {
|
|
3087
3172
|
payload: Schema.Struct({ projectId: FolderId }),
|
|
3088
|
-
success:
|
|
3173
|
+
success: ChatCreationSummaryChange,
|
|
3089
3174
|
stream: true
|
|
3090
3175
|
});
|
|
3091
3176
|
const ChatCreationDiscardRpc = Rpc.make("chat.creation.discard", {
|
|
@@ -3109,6 +3194,8 @@ const ChatCreateRpc = Rpc.make("chat.create", {
|
|
|
3109
3194
|
workspacePolicy: Schema.optional(ChatWorkspacePolicy),
|
|
3110
3195
|
startupInput: Schema.optional(ComposerInput),
|
|
3111
3196
|
startupQueueId: Schema.optional(Schema.String),
|
|
3197
|
+
/** False while attachment or generated context preparation is pending. */
|
|
3198
|
+
startupReady: Schema.optional(Schema.Boolean),
|
|
3112
3199
|
agents: Schema.optional(Schema.Record(Schema.String, AgentDefinition)),
|
|
3113
3200
|
enableSubagents: Schema.optional(Schema.Boolean),
|
|
3114
3201
|
permissionMode: Schema.optional(PermissionMode),
|
|
@@ -3264,18 +3351,31 @@ const MessagesListRpc = Rpc.make("messages.list", {
|
|
|
3264
3351
|
*/
|
|
3265
3352
|
const MessagesSendRpc = Rpc.make("messages.send", {
|
|
3266
3353
|
payload: Schema.Struct({
|
|
3354
|
+
commandId: CommandId,
|
|
3267
3355
|
sessionId: SessionId,
|
|
3268
3356
|
text: Schema.optional(Schema.String),
|
|
3269
3357
|
input: Schema.optional(ComposerInput),
|
|
3270
3358
|
asGoal: Schema.optional(Schema.Boolean),
|
|
3359
|
+
modelOptions: Schema.optional(Schema.Record(Schema.String, Schema.String)),
|
|
3271
3360
|
clientMessageId: Schema.optional(MessageId)
|
|
3272
3361
|
}),
|
|
3273
3362
|
success: Schema.Void,
|
|
3274
3363
|
error: Schema.Union([SessionNotFoundError, DirectoryUnavailableError])
|
|
3275
3364
|
});
|
|
3365
|
+
/** Durable outcome of an exact-turn interrupt request. */
|
|
3366
|
+
const TurnInterruptReceipt = Schema.Union([Schema.TaggedStruct("requested", { turnId: AgentTurnId }), Schema.TaggedStruct("not-active", {
|
|
3367
|
+
reason: Schema.Literals(["no-active-turn", "turn-mismatch"]),
|
|
3368
|
+
expectedTurnId: Schema.NullOr(AgentTurnId),
|
|
3369
|
+
actualTurnId: Schema.NullOr(AgentTurnId)
|
|
3370
|
+
})]);
|
|
3276
3371
|
const MessagesInterruptRpc = Rpc.make("messages.interrupt", {
|
|
3277
|
-
payload: Schema.Struct({
|
|
3278
|
-
|
|
3372
|
+
payload: Schema.Struct({
|
|
3373
|
+
commandId: CommandId,
|
|
3374
|
+
sessionId: SessionId,
|
|
3375
|
+
/** Fences retries to the turn visible when the user pressed Stop. */
|
|
3376
|
+
expectedTurnId: Schema.optional(AgentTurnId)
|
|
3377
|
+
}),
|
|
3378
|
+
success: TurnInterruptReceipt,
|
|
3279
3379
|
error: SessionNotFoundError
|
|
3280
3380
|
});
|
|
3281
3381
|
const MessagesQueueListRpc = Rpc.make("messages.queue.list", {
|
|
@@ -3285,6 +3385,7 @@ const MessagesQueueListRpc = Rpc.make("messages.queue.list", {
|
|
|
3285
3385
|
});
|
|
3286
3386
|
const MessagesQueueAddRpc = Rpc.make("messages.queue.add", {
|
|
3287
3387
|
payload: Schema.Struct({
|
|
3388
|
+
commandId: CommandId,
|
|
3288
3389
|
sessionId: SessionId,
|
|
3289
3390
|
/** Stable identity used to make persistence retries idempotent. */
|
|
3290
3391
|
queueId: Schema.optional(Schema.String),
|
|
@@ -3295,19 +3396,25 @@ const MessagesQueueAddRpc = Rpc.make("messages.queue.add", {
|
|
|
3295
3396
|
flush: Schema.optional(Schema.Boolean)
|
|
3296
3397
|
}),
|
|
3297
3398
|
success: QueuedMessage,
|
|
3298
|
-
error: SessionNotFoundError
|
|
3399
|
+
error: Schema.Union([SessionNotFoundError, QueuedMessageCapacityError])
|
|
3299
3400
|
});
|
|
3300
3401
|
const MessagesQueueUpdateRpc = Rpc.make("messages.queue.update", {
|
|
3301
3402
|
payload: Schema.Struct({
|
|
3403
|
+
commandId: CommandId,
|
|
3302
3404
|
sessionId: SessionId,
|
|
3303
3405
|
queueId: Schema.String,
|
|
3304
3406
|
input: ComposerInput
|
|
3305
3407
|
}),
|
|
3306
3408
|
success: QueuedMessage,
|
|
3307
|
-
error: Schema.Union([
|
|
3409
|
+
error: Schema.Union([
|
|
3410
|
+
SessionNotFoundError,
|
|
3411
|
+
QueuedMessageNotFoundError,
|
|
3412
|
+
QueuedMessageCapacityError
|
|
3413
|
+
])
|
|
3308
3414
|
});
|
|
3309
3415
|
const MessagesQueueDeleteRpc = Rpc.make("messages.queue.delete", {
|
|
3310
3416
|
payload: Schema.Struct({
|
|
3417
|
+
commandId: CommandId,
|
|
3311
3418
|
sessionId: SessionId,
|
|
3312
3419
|
queueId: Schema.String
|
|
3313
3420
|
}),
|
|
@@ -3320,6 +3427,7 @@ const MessagesQueueDeleteRpc = Rpc.make("messages.queue.delete", {
|
|
|
3320
3427
|
*/
|
|
3321
3428
|
const MessagesQueueRunNextRpc = Rpc.make("messages.queue.runNext", {
|
|
3322
3429
|
payload: Schema.Struct({
|
|
3430
|
+
commandId: CommandId,
|
|
3323
3431
|
sessionId: SessionId,
|
|
3324
3432
|
queueId: Schema.String
|
|
3325
3433
|
}),
|
|
@@ -3328,6 +3436,7 @@ const MessagesQueueRunNextRpc = Rpc.make("messages.queue.runNext", {
|
|
|
3328
3436
|
});
|
|
3329
3437
|
const MessagesQueueReorderRpc = Rpc.make("messages.queue.reorder", {
|
|
3330
3438
|
payload: Schema.Struct({
|
|
3439
|
+
commandId: CommandId,
|
|
3331
3440
|
sessionId: SessionId,
|
|
3332
3441
|
queueIds: Schema.Array(Schema.String)
|
|
3333
3442
|
}),
|
|
@@ -3335,12 +3444,18 @@ const MessagesQueueReorderRpc = Rpc.make("messages.queue.reorder", {
|
|
|
3335
3444
|
error: SessionNotFoundError
|
|
3336
3445
|
});
|
|
3337
3446
|
const MessagesQueueFlushRpc = Rpc.make("messages.queue.flush", {
|
|
3338
|
-
payload: Schema.Struct({
|
|
3447
|
+
payload: Schema.Struct({
|
|
3448
|
+
commandId: CommandId,
|
|
3449
|
+
sessionId: SessionId
|
|
3450
|
+
}),
|
|
3339
3451
|
success: Schema.Void,
|
|
3340
3452
|
error: SessionNotFoundError
|
|
3341
3453
|
});
|
|
3342
3454
|
const MessagesQueueResumeRpc = Rpc.make("messages.queue.resume", {
|
|
3343
|
-
payload: Schema.Struct({
|
|
3455
|
+
payload: Schema.Struct({
|
|
3456
|
+
commandId: CommandId,
|
|
3457
|
+
sessionId: SessionId
|
|
3458
|
+
}),
|
|
3344
3459
|
success: Schema.Void,
|
|
3345
3460
|
error: SessionNotFoundError
|
|
3346
3461
|
});
|
|
@@ -3361,6 +3476,7 @@ const SessionResumeRpc = Rpc.make("session.resume", {
|
|
|
3361
3476
|
*/
|
|
3362
3477
|
const SessionSetRuntimeModeRpc = Rpc.make("session.setRuntimeMode", {
|
|
3363
3478
|
payload: Schema.Struct({
|
|
3479
|
+
commandId: CommandId,
|
|
3364
3480
|
sessionId: SessionId,
|
|
3365
3481
|
runtimeMode: RuntimeMode
|
|
3366
3482
|
}),
|
|
@@ -3375,6 +3491,7 @@ const SessionSetRuntimeModeRpc = Rpc.make("session.setRuntimeMode", {
|
|
|
3375
3491
|
*/
|
|
3376
3492
|
const SessionSetPermissionModeRpc = Rpc.make("session.setPermissionMode", {
|
|
3377
3493
|
payload: Schema.Struct({
|
|
3494
|
+
commandId: CommandId,
|
|
3378
3495
|
sessionId: SessionId,
|
|
3379
3496
|
mode: PermissionMode
|
|
3380
3497
|
}),
|
|
@@ -3422,6 +3539,7 @@ const SessionEventsRpc = Rpc.make("session.events", {
|
|
|
3422
3539
|
payload: Schema.Struct({
|
|
3423
3540
|
sessionId: SessionId,
|
|
3424
3541
|
afterVersion: Schema.optional(Schema.Number),
|
|
3542
|
+
streamEpoch: Schema.optional(Schema.String),
|
|
3425
3543
|
hasProjection: Schema.optional(Schema.Boolean)
|
|
3426
3544
|
}),
|
|
3427
3545
|
success: SessionTimelineFrame,
|
|
@@ -3431,7 +3549,23 @@ const SessionEventsRpc = Rpc.make("session.events", {
|
|
|
3431
3549
|
/** Lightweight durable cursor used to detect an open-but-stalled event stream. */
|
|
3432
3550
|
const SessionEventsHeadRpc = Rpc.make("session.events.head", {
|
|
3433
3551
|
payload: Schema.Struct({ sessionId: SessionId }),
|
|
3434
|
-
success: Schema.Struct({
|
|
3552
|
+
success: Schema.Struct({
|
|
3553
|
+
throughVersion: Schema.Number,
|
|
3554
|
+
streamEpoch: Schema.optional(Schema.String)
|
|
3555
|
+
}),
|
|
3556
|
+
error: SessionNotFoundError
|
|
3557
|
+
});
|
|
3558
|
+
/** Older timeline messages, newest page first on the wire then rendered ascending. */
|
|
3559
|
+
const SessionMessagesPageRpc = Rpc.make("session.messages.page", {
|
|
3560
|
+
payload: Schema.Struct({
|
|
3561
|
+
sessionId: SessionId,
|
|
3562
|
+
beforeSequence: Schema.optional(Schema.Number),
|
|
3563
|
+
limit: Schema.optional(Schema.Number)
|
|
3564
|
+
}),
|
|
3565
|
+
success: Schema.Struct({
|
|
3566
|
+
messages: Schema.Array(Message),
|
|
3567
|
+
olderMessageSequence: Schema.NullOr(Schema.Number)
|
|
3568
|
+
}),
|
|
3435
3569
|
error: SessionNotFoundError
|
|
3436
3570
|
});
|
|
3437
3571
|
const SessionGoalGetRpc = Rpc.make("session.goal.get", {
|
|
@@ -3882,7 +4016,6 @@ const CloudWorkspaceState = Schema.Literals([
|
|
|
3882
4016
|
"resuming",
|
|
3883
4017
|
"archiving",
|
|
3884
4018
|
"archived",
|
|
3885
|
-
"recovering",
|
|
3886
4019
|
"deleting",
|
|
3887
4020
|
"deleted",
|
|
3888
4021
|
"failed"
|
|
@@ -4004,9 +4137,7 @@ var CloudWorkspace = class extends Schema.Class("CloudWorkspace")({
|
|
|
4004
4137
|
initialSessionId: AgentSessionId,
|
|
4005
4138
|
createdAt: Schema.Number,
|
|
4006
4139
|
updatedAt: Schema.Number,
|
|
4007
|
-
lastActivityAt: Schema.Number
|
|
4008
|
-
warmRetentionDeadline: Schema.optional(Schema.Number),
|
|
4009
|
-
recoveryAvailable: Schema.Boolean
|
|
4140
|
+
lastActivityAt: Schema.Number
|
|
4010
4141
|
}) {};
|
|
4011
4142
|
var CloudWorkspaceLaunch = class extends Schema.Class("CloudWorkspaceLaunch")({
|
|
4012
4143
|
workspace: CloudWorkspace,
|
|
@@ -4017,47 +4148,19 @@ var CloudWorkspaceConnection = class extends Schema.Class("CloudWorkspaceConnect
|
|
|
4017
4148
|
workspaceId: Schema.String,
|
|
4018
4149
|
wsUrl: Schema.String,
|
|
4019
4150
|
protocol: Schema.String,
|
|
4151
|
+
role: Schema.Literal("client"),
|
|
4152
|
+
generation: Schema.Number,
|
|
4153
|
+
gatewayEpoch: Schema.Number,
|
|
4020
4154
|
credential: Schema.String,
|
|
4021
4155
|
expiresAt: Schema.Number
|
|
4022
4156
|
}) {};
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
createdAt: Schema.Number
|
|
4031
|
-
}) {};
|
|
4032
|
-
var CloudChatQueuedMessage = class extends Schema.Class("CloudChatQueuedMessage")({
|
|
4033
|
-
sequence: Schema.optional(Schema.Number),
|
|
4034
|
-
clientMessageId: MessageId,
|
|
4035
|
-
input: ComposerInput,
|
|
4036
|
-
state: Schema.Literals([
|
|
4037
|
-
"queued",
|
|
4038
|
-
"claimed",
|
|
4039
|
-
"acknowledged",
|
|
4040
|
-
"failed"
|
|
4041
|
-
]),
|
|
4042
|
-
asGoal: Schema.Boolean,
|
|
4043
|
-
createdAt: Schema.Number
|
|
4044
|
-
}) {};
|
|
4045
|
-
var CloudChatHistory = class extends Schema.Class("CloudChatHistory")({
|
|
4046
|
-
workspaceId: Schema.String,
|
|
4047
|
-
chatId: ChatId,
|
|
4048
|
-
initialSessionId: AgentSessionId,
|
|
4049
|
-
firstMessage: Schema.optional(Schema.String),
|
|
4050
|
-
commandState: Schema.Literals([
|
|
4051
|
-
"queued",
|
|
4052
|
-
"claimed",
|
|
4053
|
-
"acknowledged",
|
|
4054
|
-
"failed"
|
|
4055
|
-
]),
|
|
4056
|
-
events: Schema.Array(CloudChatEvent),
|
|
4057
|
-
queuedMessages: Schema.Array(CloudChatQueuedMessage),
|
|
4058
|
-
cursor: Schema.Number
|
|
4059
|
-
}) {};
|
|
4060
|
-
/** Durable cloud-chat metadata that is available without a live sandbox. */
|
|
4157
|
+
Schema.Class("CloudWorkspaceRuntimeSummary")({
|
|
4158
|
+
summaryRevision: Schema.Number,
|
|
4159
|
+
title: Schema.String,
|
|
4160
|
+
lastActivityAt: Schema.Number,
|
|
4161
|
+
sessionHeadVersion: Schema.Number
|
|
4162
|
+
});
|
|
4163
|
+
/** Last-known cloud workspace metadata available without a live runtime. */
|
|
4061
4164
|
var CloudChatSummary = class extends Schema.Class("CloudChatSummary")({
|
|
4062
4165
|
workspaceId: Schema.String,
|
|
4063
4166
|
projectId: Schema.String,
|
|
@@ -4076,16 +4179,69 @@ var CloudChatSummary = class extends Schema.Class("CloudChatSummary")({
|
|
|
4076
4179
|
statusCode: Schema.String,
|
|
4077
4180
|
startupPhase: CloudWorkspaceStartupPhase,
|
|
4078
4181
|
revision: Schema.Number,
|
|
4182
|
+
/** Monotonic within the current runtime generation. */
|
|
4183
|
+
summaryRevision: Schema.Number.pipe(Schema.withConstructorDefault(Effect.succeed(0)), Schema.withDecodingDefaultType(Effect.succeed(0))),
|
|
4184
|
+
/** Authoritative runtime session head represented by this summary. */
|
|
4185
|
+
sessionHeadVersion: Schema.Number.pipe(Schema.withConstructorDefault(Effect.succeed(0)), Schema.withDecodingDefaultType(Effect.succeed(0))),
|
|
4079
4186
|
unread: Schema.Boolean,
|
|
4080
4187
|
lastMessageAt: Schema.NullOr(Schema.Number),
|
|
4081
4188
|
archivedAt: Schema.optional(Schema.Number),
|
|
4082
|
-
archivePhase: Schema.optional(Schema.String),
|
|
4083
|
-
archiveErrorCode: Schema.optional(Schema.String),
|
|
4084
|
-
archiveDiagnostic: Schema.optional(Schema.String),
|
|
4085
4189
|
createdAt: Schema.Number,
|
|
4086
4190
|
updatedAt: Schema.Number
|
|
4087
4191
|
}) {};
|
|
4088
4192
|
var CloudChatList = class extends Schema.Class("CloudChatList")({ chats: Schema.Array(CloudChatSummary) }) {};
|
|
4193
|
+
Schema.Class("CloudTranscriptCheckpointPayload")({
|
|
4194
|
+
schemaVersion: Schema.Literal(1),
|
|
4195
|
+
workspaceId: Schema.String,
|
|
4196
|
+
sessionId: AgentSessionId,
|
|
4197
|
+
cursor: SessionStreamCursor,
|
|
4198
|
+
projection: SessionTimelineProjection
|
|
4199
|
+
});
|
|
4200
|
+
var CloudTranscriptCheckpointMetadata = class extends Schema.Class("CloudTranscriptCheckpointMetadata")({
|
|
4201
|
+
workspaceId: Schema.String,
|
|
4202
|
+
sessionId: AgentSessionId,
|
|
4203
|
+
runtimeGeneration: Schema.Number,
|
|
4204
|
+
cursor: SessionStreamCursor,
|
|
4205
|
+
objectKey: Schema.String,
|
|
4206
|
+
ciphertextSha256: Schema.String,
|
|
4207
|
+
ciphertextBytes: Schema.Number,
|
|
4208
|
+
createdAt: Schema.Number
|
|
4209
|
+
}) {};
|
|
4210
|
+
Schema.Class("CloudTranscriptCheckpointUpload")({
|
|
4211
|
+
sessionId: AgentSessionId,
|
|
4212
|
+
cursor: SessionStreamCursor,
|
|
4213
|
+
ciphertext: Schema.String,
|
|
4214
|
+
ciphertextSha256: Schema.String
|
|
4215
|
+
});
|
|
4216
|
+
var CloudTranscriptCheckpointAccess = class extends Schema.Class("CloudTranscriptCheckpointAccess")({
|
|
4217
|
+
metadata: CloudTranscriptCheckpointMetadata,
|
|
4218
|
+
ciphertext: Schema.String,
|
|
4219
|
+
transcriptKey: Schema.String
|
|
4220
|
+
}) {};
|
|
4221
|
+
var CloudTranscriptCheckpointResult = class extends Schema.Class("CloudTranscriptCheckpointResult")({ checkpoint: Schema.NullOr(CloudTranscriptCheckpointAccess) }) {};
|
|
4222
|
+
Schema.Class("CloudTranscriptMessagePagePayload")({
|
|
4223
|
+
schemaVersion: Schema.Literal(1),
|
|
4224
|
+
workspaceId: Schema.String,
|
|
4225
|
+
sessionId: AgentSessionId,
|
|
4226
|
+
cursor: SessionStreamCursor,
|
|
4227
|
+
beforeSequence: Schema.Number,
|
|
4228
|
+
messages: Schema.Array(Message),
|
|
4229
|
+
olderMessageSequence: Schema.NullOr(Schema.Number)
|
|
4230
|
+
});
|
|
4231
|
+
Schema.Class("CloudTranscriptMessagePageUpload")({
|
|
4232
|
+
sessionId: AgentSessionId,
|
|
4233
|
+
cursor: SessionStreamCursor,
|
|
4234
|
+
beforeSequence: Schema.Number,
|
|
4235
|
+
ciphertext: Schema.String,
|
|
4236
|
+
ciphertextSha256: Schema.String
|
|
4237
|
+
});
|
|
4238
|
+
var CloudTranscriptMessagePageResult = class extends Schema.Class("CloudTranscriptMessagePageResult")({ page: Schema.NullOr(Schema.Struct({
|
|
4239
|
+
cursor: SessionStreamCursor,
|
|
4240
|
+
beforeSequence: Schema.Number,
|
|
4241
|
+
ciphertext: Schema.String,
|
|
4242
|
+
ciphertextSha256: Schema.String,
|
|
4243
|
+
transcriptKey: Schema.String
|
|
4244
|
+
})) }) {};
|
|
4089
4245
|
var CloudWorkspaceList = class extends Schema.Class("CloudWorkspaceList")({ workspaces: Schema.Array(CloudWorkspace) }) {};
|
|
4090
4246
|
var CloudWorkspaceCreateRequest = class extends Schema.Class("CloudWorkspaceCreateRequest")({
|
|
4091
4247
|
projectId: Schema.String,
|
|
@@ -4100,7 +4256,29 @@ var CloudWorkspaceCreateRequest = class extends Schema.Class("CloudWorkspaceCrea
|
|
|
4100
4256
|
firstMessage: Schema.optional(Schema.String),
|
|
4101
4257
|
idempotencyKey: Schema.String
|
|
4102
4258
|
}) {};
|
|
4103
|
-
var CloudWorkspaceActionRequest = class extends Schema.Class("CloudWorkspaceActionRequest")({
|
|
4259
|
+
var CloudWorkspaceActionRequest = class extends Schema.Class("CloudWorkspaceActionRequest")({
|
|
4260
|
+
workspaceId: Schema.String,
|
|
4261
|
+
commandId: Schema.optional(Schema.String)
|
|
4262
|
+
}) {};
|
|
4263
|
+
var CloudWorkspaceResumeRequest = class extends Schema.Class("CloudWorkspaceResumeRequest")({
|
|
4264
|
+
workspaceId: Schema.String,
|
|
4265
|
+
commandId: Schema.optional(Schema.String),
|
|
4266
|
+
/** The gateway proved that Relay's online projection has no runtime socket. */
|
|
4267
|
+
recoverRuntime: Schema.optional(Schema.Boolean)
|
|
4268
|
+
}) {};
|
|
4269
|
+
/**
|
|
4270
|
+
* A short-lived grant for the workspace runtime's WebSocket SSH bridge. The
|
|
4271
|
+
* relay stages the hashed ticket inside the sandbox; the desktop's
|
|
4272
|
+
* ProxyCommand bridge presents the plain ticket when it connects to `wsUrl`.
|
|
4273
|
+
*/
|
|
4274
|
+
var CloudWorkspaceSshAccess = class extends Schema.Class("CloudWorkspaceSshAccess")({
|
|
4275
|
+
workspaceId: Schema.String,
|
|
4276
|
+
wsUrl: Schema.String,
|
|
4277
|
+
ticket: Schema.String,
|
|
4278
|
+
expiresAt: Schema.Number,
|
|
4279
|
+
user: Schema.String,
|
|
4280
|
+
workspacePath: Schema.String
|
|
4281
|
+
}) {};
|
|
4104
4282
|
var CloudCredentialConnection = class extends Schema.Class("CloudCredentialConnection")({
|
|
4105
4283
|
kind: CloudCredentialKind,
|
|
4106
4284
|
state: Schema.Literals([
|
|
@@ -4134,7 +4312,8 @@ var CloudWorkspaceOpError = class extends Schema.TaggedErrorClass()("CloudWorksp
|
|
|
4134
4312
|
"project-not-ready",
|
|
4135
4313
|
"credential-required",
|
|
4136
4314
|
"branch-in-use",
|
|
4137
|
-
"conflict"
|
|
4315
|
+
"conflict",
|
|
4316
|
+
"billing-hold"
|
|
4138
4317
|
]) }) {};
|
|
4139
4318
|
const CloudProvidersRpc = Rpc.make("cloud.providers", {
|
|
4140
4319
|
payload: Schema.Void,
|
|
@@ -4166,6 +4345,19 @@ const CloudWorkspacesGetRpc = Rpc.make("cloud.workspaces.get", {
|
|
|
4166
4345
|
success: CloudWorkspace,
|
|
4167
4346
|
error: CloudWorkspaceOpError
|
|
4168
4347
|
});
|
|
4348
|
+
/**
|
|
4349
|
+
* One monotonic lifecycle control stream for a workspace. The server adapts
|
|
4350
|
+
* Relay's current REST surface; clients never own lifecycle polling loops.
|
|
4351
|
+
*/
|
|
4352
|
+
const CloudWorkspacesWatchRpc = Rpc.make("cloud.workspaces.watch", {
|
|
4353
|
+
payload: Schema.Struct({
|
|
4354
|
+
workspaceId: Schema.String,
|
|
4355
|
+
afterRevision: Schema.optional(Schema.Number)
|
|
4356
|
+
}),
|
|
4357
|
+
success: CloudWorkspace,
|
|
4358
|
+
error: CloudWorkspaceOpError,
|
|
4359
|
+
stream: true
|
|
4360
|
+
});
|
|
4169
4361
|
const CloudWorkspacesCreateRpc = Rpc.make("cloud.workspaces.create", {
|
|
4170
4362
|
payload: CloudWorkspaceCreateRequest,
|
|
4171
4363
|
success: CloudWorkspaceLaunch,
|
|
@@ -4176,14 +4368,6 @@ const CloudWorkspacesConnectRpc = Rpc.make("cloud.workspaces.connect", {
|
|
|
4176
4368
|
success: CloudWorkspaceConnection,
|
|
4177
4369
|
error: CloudWorkspaceOpError
|
|
4178
4370
|
});
|
|
4179
|
-
const CloudChatsHistoryRpc = Rpc.make("cloud.chats.history", {
|
|
4180
|
-
payload: Schema.Struct({
|
|
4181
|
-
workspaceId: Schema.String,
|
|
4182
|
-
after: Schema.optional(Schema.Number)
|
|
4183
|
-
}),
|
|
4184
|
-
success: CloudChatHistory,
|
|
4185
|
-
error: CloudWorkspaceOpError
|
|
4186
|
-
});
|
|
4187
4371
|
const CloudChatsListRpc = Rpc.make("cloud.chats.list", {
|
|
4188
4372
|
payload: Schema.Struct({
|
|
4189
4373
|
projectId: Schema.optional(Schema.String),
|
|
@@ -4196,32 +4380,25 @@ const CloudChatsListRpc = Rpc.make("cloud.chats.list", {
|
|
|
4196
4380
|
success: CloudChatList,
|
|
4197
4381
|
error: CloudWorkspaceOpError
|
|
4198
4382
|
});
|
|
4199
|
-
const
|
|
4200
|
-
payload:
|
|
4201
|
-
|
|
4202
|
-
title: Schema.String
|
|
4203
|
-
}),
|
|
4204
|
-
success: CloudChatSummary,
|
|
4383
|
+
const CloudWorkspacesPauseRpc = Rpc.make("cloud.workspaces.pause", {
|
|
4384
|
+
payload: CloudWorkspaceActionRequest,
|
|
4385
|
+
success: CloudWorkspace,
|
|
4205
4386
|
error: CloudWorkspaceOpError
|
|
4206
4387
|
});
|
|
4207
|
-
const
|
|
4208
|
-
payload:
|
|
4209
|
-
|
|
4210
|
-
input: ComposerInput,
|
|
4211
|
-
clientMessageId: MessageId,
|
|
4212
|
-
asGoal: Schema.optional(Schema.Boolean)
|
|
4213
|
-
}),
|
|
4214
|
-
success: Schema.Struct({ sequence: Schema.Number }),
|
|
4388
|
+
const CloudWorkspacesResumeRpc = Rpc.make("cloud.workspaces.resume", {
|
|
4389
|
+
payload: CloudWorkspaceResumeRequest,
|
|
4390
|
+
success: CloudWorkspace,
|
|
4215
4391
|
error: CloudWorkspaceOpError
|
|
4216
4392
|
});
|
|
4217
|
-
|
|
4393
|
+
/** Restart the runtime of a running workspace in place (same sandbox). */
|
|
4394
|
+
const CloudWorkspacesRestartRpc = Rpc.make("cloud.workspaces.restart", {
|
|
4218
4395
|
payload: CloudWorkspaceActionRequest,
|
|
4219
4396
|
success: CloudWorkspace,
|
|
4220
4397
|
error: CloudWorkspaceOpError
|
|
4221
4398
|
});
|
|
4222
|
-
const
|
|
4399
|
+
const CloudWorkspacesSshAccessRpc = Rpc.make("cloud.workspaces.sshAccess", {
|
|
4223
4400
|
payload: CloudWorkspaceActionRequest,
|
|
4224
|
-
success:
|
|
4401
|
+
success: CloudWorkspaceSshAccess,
|
|
4225
4402
|
error: CloudWorkspaceOpError
|
|
4226
4403
|
});
|
|
4227
4404
|
const CloudWorkspacesArchiveRpc = Rpc.make("cloud.workspaces.archive", {
|
|
@@ -4239,6 +4416,25 @@ const CloudWorkspacesDeleteRpc = Rpc.make("cloud.workspaces.delete", {
|
|
|
4239
4416
|
success: CloudWorkspace,
|
|
4240
4417
|
error: CloudWorkspaceOpError
|
|
4241
4418
|
});
|
|
4419
|
+
const CloudTranscriptCheckpointGetRpc = Rpc.make("cloud.transcript.get", {
|
|
4420
|
+
payload: Schema.Struct({
|
|
4421
|
+
workspaceId: Schema.String,
|
|
4422
|
+
sessionId: AgentSessionId,
|
|
4423
|
+
cursor: Schema.optional(SessionStreamCursor)
|
|
4424
|
+
}),
|
|
4425
|
+
success: CloudTranscriptCheckpointResult,
|
|
4426
|
+
error: CloudWorkspaceOpError
|
|
4427
|
+
});
|
|
4428
|
+
const CloudTranscriptMessagePageGetRpc = Rpc.make("cloud.transcript.messages.page", {
|
|
4429
|
+
payload: Schema.Struct({
|
|
4430
|
+
workspaceId: Schema.String,
|
|
4431
|
+
sessionId: AgentSessionId,
|
|
4432
|
+
cursor: SessionStreamCursor,
|
|
4433
|
+
beforeSequence: Schema.Number
|
|
4434
|
+
}),
|
|
4435
|
+
success: CloudTranscriptMessagePageResult,
|
|
4436
|
+
error: CloudWorkspaceOpError
|
|
4437
|
+
});
|
|
4242
4438
|
const CloudCredentialsListRpc = Rpc.make("cloud.credentials.list", {
|
|
4243
4439
|
payload: Schema.Void,
|
|
4244
4440
|
success: CloudCredentialList,
|
|
@@ -4255,158 +4451,80 @@ const CloudCredentialsDisconnectRpc = Rpc.make("cloud.credentials.disconnect", {
|
|
|
4255
4451
|
error: CloudWorkspaceOpError
|
|
4256
4452
|
});
|
|
4257
4453
|
//#endregion
|
|
4258
|
-
//#region ../contracts/src/
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
const IndexState = Schema.Literals([
|
|
4266
|
-
"idle",
|
|
4267
|
-
"indexing",
|
|
4268
|
-
"ready",
|
|
4269
|
-
"error"
|
|
4270
|
-
]);
|
|
4271
|
-
const IndexProgress = Schema.NullOr(Schema.Struct({
|
|
4272
|
-
processed: Schema.Number,
|
|
4273
|
-
total: Schema.Number
|
|
4274
|
-
}));
|
|
4275
|
-
const IndexStats = Schema.Struct({
|
|
4276
|
-
blobs: Schema.Number,
|
|
4277
|
-
chunks: Schema.Number,
|
|
4278
|
-
symbols: Schema.Number,
|
|
4279
|
-
refs: Schema.Number
|
|
4280
|
-
});
|
|
4281
|
-
var IndexStatusInfo = class extends Schema.Class("IndexStatusInfo")({
|
|
4282
|
-
state: IndexState,
|
|
4283
|
-
branch: Schema.NullOr(Schema.String),
|
|
4284
|
-
progress: IndexProgress,
|
|
4285
|
-
stats: IndexStats
|
|
4286
|
-
}) {};
|
|
4287
|
-
const SymbolKind = Schema.Literals([
|
|
4288
|
-
"function",
|
|
4289
|
-
"method",
|
|
4290
|
-
"class",
|
|
4291
|
-
"interface",
|
|
4292
|
-
"type",
|
|
4293
|
-
"enum",
|
|
4294
|
-
"const",
|
|
4295
|
-
"variable",
|
|
4296
|
-
"property",
|
|
4297
|
-
"export"
|
|
4298
|
-
]);
|
|
4299
|
-
const Range = Schema.Struct({
|
|
4300
|
-
start: Schema.Number,
|
|
4301
|
-
end: Schema.Number
|
|
4302
|
-
});
|
|
4303
|
-
const SearchKind = Schema.Literals([
|
|
4304
|
-
"auto",
|
|
4305
|
-
"symbol",
|
|
4306
|
-
"text",
|
|
4307
|
-
"semantic"
|
|
4454
|
+
//#region ../contracts/src/cloud-billing.ts
|
|
4455
|
+
const CloudBillingStatus = Schema.Literals([
|
|
4456
|
+
"active",
|
|
4457
|
+
"grace",
|
|
4458
|
+
"billing-hold",
|
|
4459
|
+
"ended",
|
|
4460
|
+
"manual"
|
|
4308
4461
|
]);
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4462
|
+
var CloudBillingSummary = class extends Schema.Class("CloudBillingSummary")({
|
|
4463
|
+
currency: Schema.Literal("USD"),
|
|
4464
|
+
status: CloudBillingStatus,
|
|
4465
|
+
periodStart: Schema.Number,
|
|
4466
|
+
periodEnd: Schema.Number,
|
|
4467
|
+
basePriceMicros: Schema.Number,
|
|
4468
|
+
includedProviderCostMicros: Schema.Number,
|
|
4469
|
+
providerCostMicros: Schema.Number,
|
|
4470
|
+
includedUsedMicros: Schema.Number,
|
|
4471
|
+
includedRemainingMicros: Schema.Number,
|
|
4472
|
+
overageProviderCostMicros: Schema.Number,
|
|
4473
|
+
overageChargeMicros: Schema.Number,
|
|
4474
|
+
overageCapMicros: Schema.Number,
|
|
4475
|
+
markupBasisPoints: Schema.Number,
|
|
4476
|
+
currentInvoiceEstimateMicros: Schema.Number,
|
|
4477
|
+
lastProviderReconciledAt: Schema.optional(Schema.Number),
|
|
4478
|
+
lastPolarReconciledAt: Schema.optional(Schema.Number),
|
|
4479
|
+
usageProvisional: Schema.Boolean
|
|
4480
|
+
}) {};
|
|
4481
|
+
var CloudBillingUsageItem = class extends Schema.Class("CloudBillingUsageItem")({
|
|
4482
|
+
entryId: Schema.String,
|
|
4483
|
+
resourceKind: Schema.Literals([
|
|
4484
|
+
"workspace",
|
|
4485
|
+
"build",
|
|
4486
|
+
"other"
|
|
4487
|
+
]),
|
|
4488
|
+
resourceId: Schema.String,
|
|
4489
|
+
provider: Schema.String,
|
|
4490
|
+
providerExecutionId: Schema.optional(Schema.String),
|
|
4491
|
+
startedAt: Schema.Number,
|
|
4492
|
+
endedAt: Schema.Number,
|
|
4493
|
+
vcpuCount: Schema.Number,
|
|
4494
|
+
memoryMib: Schema.Number,
|
|
4495
|
+
providerCostMicros: Schema.Number,
|
|
4496
|
+
status: Schema.Literals([
|
|
4497
|
+
"provisional",
|
|
4498
|
+
"confirmed",
|
|
4499
|
+
"corrected"
|
|
4324
4500
|
])
|
|
4501
|
+
}) {};
|
|
4502
|
+
var CloudBillingUsagePage = class extends Schema.Class("CloudBillingUsagePage")({
|
|
4503
|
+
items: Schema.Array(CloudBillingUsageItem),
|
|
4504
|
+
nextCursor: Schema.optional(Schema.String)
|
|
4505
|
+
}) {};
|
|
4506
|
+
var CloudBillingUsageRequest = class extends Schema.Class("CloudBillingUsageRequest")({
|
|
4507
|
+
cursor: Schema.optional(Schema.String),
|
|
4508
|
+
limit: Schema.optional(Schema.Number)
|
|
4509
|
+
}) {};
|
|
4510
|
+
var CloudBillingCapRequest = class extends Schema.Class("CloudBillingCapRequest")({
|
|
4511
|
+
overageCapMicros: Schema.Number,
|
|
4512
|
+
idempotencyKey: Schema.String
|
|
4513
|
+
}) {};
|
|
4514
|
+
const CloudBillingSummaryRpc = Rpc.make("cloud.billing.summary", {
|
|
4515
|
+
payload: Schema.Void,
|
|
4516
|
+
success: CloudBillingSummary,
|
|
4517
|
+
error: CloudWorkspaceOpError
|
|
4325
4518
|
});
|
|
4326
|
-
const
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
kind: SymbolKind,
|
|
4331
|
-
signature: Schema.NullOr(Schema.String),
|
|
4332
|
-
file: Schema.String,
|
|
4333
|
-
range: Range,
|
|
4334
|
-
exported: Schema.Boolean
|
|
4335
|
-
});
|
|
4336
|
-
const RefHit = Schema.Struct({
|
|
4337
|
-
refId: Schema.Number,
|
|
4338
|
-
file: Schema.String,
|
|
4339
|
-
range: Range,
|
|
4340
|
-
context: Schema.String
|
|
4341
|
-
});
|
|
4342
|
-
const ChunkContent = Schema.NullOr(Schema.Struct({
|
|
4343
|
-
chunkId: Schema.Number,
|
|
4344
|
-
file: Schema.String,
|
|
4345
|
-
content: Schema.String,
|
|
4346
|
-
range: Range
|
|
4347
|
-
}));
|
|
4348
|
-
const SymbolSummary = Schema.Struct({
|
|
4349
|
-
name: Schema.String,
|
|
4350
|
-
kind: SymbolKind,
|
|
4351
|
-
signature: Schema.NullOr(Schema.String),
|
|
4352
|
-
startLine: Schema.Number,
|
|
4353
|
-
exported: Schema.Boolean
|
|
4354
|
-
});
|
|
4355
|
-
Rpc.make("index.status", {
|
|
4356
|
-
payload: Schema.Struct({ folderId: FolderId }),
|
|
4357
|
-
success: IndexStatusInfo
|
|
4358
|
-
});
|
|
4359
|
-
Rpc.make("index.statusStream", {
|
|
4360
|
-
payload: Schema.Struct({ folderId: FolderId }),
|
|
4361
|
-
success: IndexStatusInfo,
|
|
4362
|
-
stream: true
|
|
4363
|
-
});
|
|
4364
|
-
Rpc.make("index.reindex", {
|
|
4365
|
-
payload: Schema.Struct({ folderId: FolderId }),
|
|
4366
|
-
success: IndexStatusInfo
|
|
4367
|
-
});
|
|
4368
|
-
Rpc.make("index.search", {
|
|
4369
|
-
payload: Schema.Struct({
|
|
4370
|
-
folderId: FolderId,
|
|
4371
|
-
query: Schema.String,
|
|
4372
|
-
kind: Schema.optional(SearchKind),
|
|
4373
|
-
limit: Schema.optional(Schema.Number),
|
|
4374
|
-
pathGlob: Schema.optional(Schema.String)
|
|
4375
|
-
}),
|
|
4376
|
-
success: Schema.Array(SearchHit)
|
|
4377
|
-
});
|
|
4378
|
-
Rpc.make("index.symbolLookup", {
|
|
4379
|
-
payload: Schema.Struct({
|
|
4380
|
-
folderId: FolderId,
|
|
4381
|
-
name: Schema.String,
|
|
4382
|
-
kind: Schema.optional(Schema.String),
|
|
4383
|
-
limit: Schema.optional(Schema.Number),
|
|
4384
|
-
pathGlob: Schema.optional(Schema.String)
|
|
4385
|
-
}),
|
|
4386
|
-
success: Schema.Array(SymbolHit)
|
|
4387
|
-
});
|
|
4388
|
-
Rpc.make("index.findReferences", {
|
|
4389
|
-
payload: Schema.Struct({
|
|
4390
|
-
folderId: FolderId,
|
|
4391
|
-
symbol: Schema.String,
|
|
4392
|
-
limit: Schema.optional(Schema.Number),
|
|
4393
|
-
pathGlob: Schema.optional(Schema.String)
|
|
4394
|
-
}),
|
|
4395
|
-
success: Schema.Array(RefHit)
|
|
4396
|
-
});
|
|
4397
|
-
Rpc.make("index.readChunk", {
|
|
4398
|
-
payload: Schema.Struct({
|
|
4399
|
-
folderId: FolderId,
|
|
4400
|
-
chunkId: Schema.Number
|
|
4401
|
-
}),
|
|
4402
|
-
success: ChunkContent
|
|
4519
|
+
const CloudBillingUsageRpc = Rpc.make("cloud.billing.usage", {
|
|
4520
|
+
payload: CloudBillingUsageRequest,
|
|
4521
|
+
success: CloudBillingUsagePage,
|
|
4522
|
+
error: CloudWorkspaceOpError
|
|
4403
4523
|
});
|
|
4404
|
-
Rpc.make("
|
|
4405
|
-
payload:
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
}),
|
|
4409
|
-
success: Schema.Array(SymbolSummary)
|
|
4524
|
+
const CloudBillingSetCapRpc = Rpc.make("cloud.billing.setCap", {
|
|
4525
|
+
payload: CloudBillingCapRequest,
|
|
4526
|
+
success: CloudBillingSummary,
|
|
4527
|
+
error: CloudWorkspaceOpError
|
|
4410
4528
|
});
|
|
4411
4529
|
//#endregion
|
|
4412
4530
|
//#region ../contracts/src/connect.ts
|
|
@@ -4901,6 +5019,7 @@ var GithubRepoSummary = class extends Schema.Class("GithubRepoSummary")({
|
|
|
4901
5019
|
sshUrl: Schema.String,
|
|
4902
5020
|
httpsUrl: Schema.String,
|
|
4903
5021
|
isPrivate: Schema.Boolean,
|
|
5022
|
+
defaultBranch: Schema.String,
|
|
4904
5023
|
updatedAt: Schema.DateFromString
|
|
4905
5024
|
}) {};
|
|
4906
5025
|
/**
|
|
@@ -5177,9 +5296,18 @@ const GitUserNameRpc = Rpc.make("git.userName", {
|
|
|
5177
5296
|
success: Schema.Struct({ userName: Schema.String }),
|
|
5178
5297
|
error: GitErrors
|
|
5179
5298
|
});
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5299
|
+
/**
|
|
5300
|
+
* Coalesced invalidation for one explicit repository checkout. The first
|
|
5301
|
+
* frame is emitted immediately, then filesystem/index/HEAD changes advance a
|
|
5302
|
+
* monotonic revision. Clients re-read their materialized Git resource after
|
|
5303
|
+
* each revision; no transcript or patch payload is duplicated in this stream.
|
|
5304
|
+
*/
|
|
5305
|
+
const GitWorkspaceChangesRpc = Rpc.make("git.workspaceChanges", {
|
|
5306
|
+
payload: Schema.Struct({
|
|
5307
|
+
folderId: FolderId,
|
|
5308
|
+
worktreeId: Schema.optional(Schema.NullOr(WorktreeId))
|
|
5309
|
+
}),
|
|
5310
|
+
success: Schema.Struct({ revision: Schema.Number }),
|
|
5183
5311
|
error: GitErrors,
|
|
5184
5312
|
stream: true
|
|
5185
5313
|
});
|
|
@@ -5731,26 +5859,6 @@ const GitRevertAllRpc = Rpc.make("git.revertAll", {
|
|
|
5731
5859
|
success: Schema.Struct({ reverted: Schema.Boolean }),
|
|
5732
5860
|
error: GitErrors
|
|
5733
5861
|
});
|
|
5734
|
-
/**
|
|
5735
|
-
* Total additions/deletions of a worktree's branch — including uncommitted
|
|
5736
|
-
* working-tree edits — relative to its base branch. Computed as
|
|
5737
|
-
* `git diff --numstat <merge-base(base, HEAD)>`, where `base` is the repo's
|
|
5738
|
-
* default branch (`origin/HEAD`, falling back to origin/main, main, …). Drives
|
|
5739
|
-
* the projects sidebar's per-chat `+N −N` stats so a branch shows its diff
|
|
5740
|
-
* even before a PR is opened. Returns zeros rather than failing when there's
|
|
5741
|
-
* no base, no commits, or no diff.
|
|
5742
|
-
*/
|
|
5743
|
-
const GitDiffStatRpc = Rpc.make("git.diffStat", {
|
|
5744
|
-
payload: Schema.Struct({
|
|
5745
|
-
folderId: FolderId,
|
|
5746
|
-
worktreeId: Schema.optional(Schema.NullOr(WorktreeId))
|
|
5747
|
-
}),
|
|
5748
|
-
success: Schema.Struct({
|
|
5749
|
-
additions: Schema.Number,
|
|
5750
|
-
deletions: Schema.Number
|
|
5751
|
-
}),
|
|
5752
|
-
error: GitErrors
|
|
5753
|
-
});
|
|
5754
5862
|
//#endregion
|
|
5755
5863
|
//#region ../contracts/src/handshake.ts
|
|
5756
5864
|
var WireHello = class extends Schema.Class("WireHello")({ protocolVersion: Schema.Number }) {};
|
|
@@ -6289,6 +6397,23 @@ const MachineRuntimeUpdateRpc = Rpc.make("machine.runtime.update", {
|
|
|
6289
6397
|
success: MachineRuntimeStatus,
|
|
6290
6398
|
error: MachineOpError
|
|
6291
6399
|
});
|
|
6400
|
+
var MachineResourceSample = class extends Schema.Class("MachineResourceSample")({
|
|
6401
|
+
sampledAt: Schema.Number,
|
|
6402
|
+
cpuCores: Schema.Number,
|
|
6403
|
+
cpuPercent: Schema.Number,
|
|
6404
|
+
memTotalBytes: Schema.Number,
|
|
6405
|
+
memUsedBytes: Schema.Number,
|
|
6406
|
+
diskTotalBytes: Schema.Number,
|
|
6407
|
+
diskUsedBytes: Schema.Number,
|
|
6408
|
+
/** Filesystem the disk numbers describe (the workspace root when present). */
|
|
6409
|
+
diskPath: Schema.String
|
|
6410
|
+
}) {};
|
|
6411
|
+
const MachineResourcesWatchRpc = Rpc.make("machine.resources.watch", {
|
|
6412
|
+
payload: Schema.Struct({ intervalMs: Schema.optional(Schema.Number) }),
|
|
6413
|
+
success: MachineResourceSample,
|
|
6414
|
+
error: MachineOpError,
|
|
6415
|
+
stream: true
|
|
6416
|
+
});
|
|
6292
6417
|
const AccountAccessProvider = Schema.Literals([
|
|
6293
6418
|
"github",
|
|
6294
6419
|
"claude",
|
|
@@ -6745,6 +6870,20 @@ var SavedDecision = class extends Schema.Class("SavedDecision")({
|
|
|
6745
6870
|
decidedAt: Schema.DateFromString
|
|
6746
6871
|
}) {};
|
|
6747
6872
|
var PermissionRequestNotFoundError = class extends Schema.TaggedErrorClass()("PermissionRequestNotFoundError", { requestId: Schema.String }) {};
|
|
6873
|
+
const PermissionRequestChange = Schema.Union([
|
|
6874
|
+
Schema.Struct({
|
|
6875
|
+
_tag: Schema.Literal("snapshot"),
|
|
6876
|
+
requests: Schema.Array(PermissionRequest)
|
|
6877
|
+
}),
|
|
6878
|
+
Schema.Struct({
|
|
6879
|
+
_tag: Schema.Literal("change"),
|
|
6880
|
+
request: PermissionRequest
|
|
6881
|
+
}),
|
|
6882
|
+
Schema.Struct({
|
|
6883
|
+
_tag: Schema.Literal("remove"),
|
|
6884
|
+
requestId: Schema.String
|
|
6885
|
+
})
|
|
6886
|
+
]);
|
|
6748
6887
|
/**
|
|
6749
6888
|
* Live stream of pending requests across every session. The renderer
|
|
6750
6889
|
* filters by selected session; broadcasting once and filtering on the
|
|
@@ -6753,7 +6892,7 @@ var PermissionRequestNotFoundError = class extends Schema.TaggedErrorClass()("Pe
|
|
|
6753
6892
|
*/
|
|
6754
6893
|
const PermissionRequestsRpc = Rpc.make("permission.requests", {
|
|
6755
6894
|
payload: Schema.Struct({}),
|
|
6756
|
-
success:
|
|
6895
|
+
success: PermissionRequestChange,
|
|
6757
6896
|
stream: true
|
|
6758
6897
|
});
|
|
6759
6898
|
const PermissionDecideRpc = Rpc.make("permission.decide", {
|
|
@@ -7879,7 +8018,7 @@ const UsageLimitsHistoryRpc = Rpc.make("usage.limits.history", {
|
|
|
7879
8018
|
*
|
|
7880
8019
|
* Add new RPCs by importing them here and including them in the group.
|
|
7881
8020
|
*/
|
|
7882
|
-
const MemoizeRpcs = RpcGroup.make(PingRpc, AnalyticsGetContextRpc, AnalyticsContextChangesRpc, AuthGetSessionRpc, AuthSignInRpc, AuthSignOutRpc, AuthSessionChangesRpc, LinearListConnectionsRpc, LinearConnectRpc, LinearDisconnectRpc, LinearListIssuesRpc, LinearPrepareContextRpc, PairingStartRpc, PairingListTokensRpc, PairingRevokeTokenRpc, PairingListNearbyRequestsRpc, PairingResolveNearbyRequestRpc, ConnectHandshakeRpc, ConnectDescribeRpc, ConnectLinkProofRpc, ConnectRelayConfigRpc, RelayLinkRpc, RelayStatusRpc, RelayUnlinkRpc, EnvironmentsListRpc, EnvironmentConnectRpc, CloudProvidersRpc, CloudProjectsListRpc, CloudProjectsConnectRpc, CloudProjectsPrepareRpc, CloudWorkspacesListRpc, CloudWorkspacesGetRpc, CloudWorkspacesCreateRpc, CloudWorkspacesConnectRpc,
|
|
8021
|
+
const MemoizeRpcs = RpcGroup.make(PingRpc, AnalyticsGetContextRpc, AnalyticsContextChangesRpc, AuthGetSessionRpc, AuthSignInRpc, AuthSignOutRpc, AuthSessionChangesRpc, LinearListConnectionsRpc, LinearConnectRpc, LinearDisconnectRpc, LinearListIssuesRpc, LinearPrepareContextRpc, PairingStartRpc, PairingListTokensRpc, PairingRevokeTokenRpc, PairingListNearbyRequestsRpc, PairingResolveNearbyRequestRpc, ConnectHandshakeRpc, ConnectDescribeRpc, ConnectLinkProofRpc, ConnectRelayConfigRpc, RelayLinkRpc, RelayStatusRpc, RelayUnlinkRpc, EnvironmentsListRpc, EnvironmentConnectRpc, CloudBillingSummaryRpc, CloudBillingUsageRpc, CloudBillingSetCapRpc, CloudProvidersRpc, CloudProjectsListRpc, CloudProjectsConnectRpc, CloudProjectsPrepareRpc, CloudWorkspacesListRpc, CloudWorkspacesGetRpc, CloudWorkspacesWatchRpc, CloudWorkspacesCreateRpc, CloudWorkspacesConnectRpc, CloudChatsListRpc, CloudWorkspacesPauseRpc, CloudWorkspacesResumeRpc, CloudWorkspacesRestartRpc, CloudWorkspacesSshAccessRpc, CloudWorkspacesArchiveRpc, CloudWorkspacesUnarchiveRpc, CloudWorkspacesDeleteRpc, CloudTranscriptCheckpointGetRpc, CloudTranscriptMessagePageGetRpc, CloudCredentialsListRpc, CloudCredentialsImportLocalRpc, CloudCredentialsDisconnectRpc, MachinesOffersRpc, MachinesListRpc, MachinesGetRpc, MachinesCreateRpc, MachinesCancelRpc, MachinesRecoverRpc, MachinesDestroyRpc, MachinesCheckoutRpc, MachinesBillingPortalRpc, MachinesEntitlementsRpc, MachineSshKeysAddRpc, MachineSshKeysListRpc, MachineSshKeysRemoveRpc, MachinePrivateNetworkEnableRpc, MachinePrivateNetworkStatusRpc, MachineRuntimeTargetRpc, MachineRuntimeStatusRpc, MachineRuntimeUpdateRpc, MachineResourcesWatchRpc, MachineSshModeSetRpc, AccountAccessStatusRpc, AccountAccessDetectLocalRpc, AccountAccessStartLoginRpc, AccountAccessPrepareImportRpc, AccountAccessCreateClaudeTransferRpc, AccountAccessContinueClaudeTransferRpc, AccountAccessImportRpc, AccountAccessDisconnectRpc, RelayEnvironmentsRpc, RelayConnectEnvironmentRpc, RelayClientsRpc, RelayRevokeClientRpc, WorkspaceAddRpc, WorkspaceBrowseDirectoryRpc, WorkspaceListRpc, WorkspaceRemoveRpc, WorkspacePickFolderRpc, WorkspaceGetSelectedRpc, WorkspaceSetSelectedRpc, WorkspaceStreamChangesRpc, WorkspaceSearchFilesRpc, WorkspaceCloneRepoRpc, WorkspaceCreateProjectRpc, WorkspaceListGithubReposRpc, WorkspaceGhAuthStatusRpc, ExternalThreadsListRpc, ExternalThreadsContinueRpc, PtyOpenRpc, PtyWriteRpc, PtyResizeRpc, PtyCloseRpc, PtyOutputRpc, GitLogRpc, GitStatusRpc, GitBranchesRpc, GitSwitchBranchRpc, GitUserNameRpc, GitWorkspaceChangesRpc, GitOriginRpc, GitPrStateRpc, GitPrDetailsRpc, GitListPrsRpc, GitListIssuesRpc, GitIssueMarkdownRpc, GitChangesRpc, GitReviewSummaryRpc, GitReviewPatchesRpc, GitReviewFileContentsRpc, GitReviewIdentityRpc, GitDiffRpc, GitCommitRpc, GitCreateReviewCommentRpc, GitPushRpc, GitResolveConflictRpc, GitMergePrRpc, GitMarkReadyRpc, GitInitRpc, GitFixFailingChecksRpc, GitRevertFileRpc, GitRestoreFileToBaseRpc, GitRevertAllRpc, FsTreeRpc, FsWatchTreeRpc, FsListPathsRpc, FsMoveRpc, FsReadFileRpc, FsWriteFileRpc, FsCreateFileRpc, FsCreateDirectoryRpc, FsRemoveRpc, FsReadExternalFileRpc, FsWriteExternalFileRpc, ProviderAvailabilityRpc, ProviderRemoveCredentialRpc, ProviderSetCredentialRpc, ProviderOpencodeInventoryRpc, ProviderKiroInventoryRpc, ProviderOpencodeSetAuthRpc, ProviderOpencodeRemoveAuthRpc, ProviderOpencodeAddCustomRpc, ProviderOpencodeRemoveCustomRpc, ProviderStartLoginRpc, ProviderUpdateRpc, ChatArchivePreviewRpc, McpListRpc, McpRefreshRpc, McpSetEnabledRpc, McpAuthenticateRpc, ChatListRpc, ChatGetRpc, ChatCreateRpc, ChatCreationListRpc, ChatCreationStreamRpc, ChatCreationDiscardRpc, ChatRenameRpc, ChatMarkReadRpc, ChatStreamChangesRpc, ChatSetWorktreeRpc, ChatSetActiveSessionRpc, ChatArchiveRpc, ChatArchiveStatusRpc, ChatArchiveJobsRpc, ChatDirectoryStatusRpc, ChatUnarchiveRpc, ChatDeleteRpc, SessionListRpc, SessionStreamChangesRpc, SessionMcpUpdateRpc, SessionGetRpc, SessionCreateRpc, SessionRenameRpc, SessionGoalGetRpc, SessionGoalSetRpc, SessionGoalClearRpc, SessionGoalStreamRpc, SessionSetModelRpc, SessionSetProviderRpc, SessionArchiveRpc, SessionUnarchiveRpc, SessionDeleteRpc, SessionEventsHeadRpc, SessionEventsRpc, SessionMessagesPageRpc, SessionForkRpc, SessionExportTranscriptRpc, SessionLatestPlanRpc, SessionResumeRpc, SessionSetRuntimeModeRpc, SessionSetPermissionModeRpc, SessionAnswerQuestionRpc, SessionPlanRespondRpc, SessionSetWorktreeRpc, MessagesListRpc, MessagesSendRpc, MessagesInterruptRpc, MessagesQueueListRpc, MessagesQueueAddRpc, MessagesQueueUpdateRpc, MessagesQueueDeleteRpc, MessagesQueueRunNextRpc, MessagesQueueReorderRpc, MessagesQueueFlushRpc, MessagesQueueResumeRpc, AttachmentUploadRpc, ContextSaveTextRpc, SkillListRpc, SkillListForProjectRpc, SkillStreamRpc, PermissionRequestsRpc, PermissionDecideRpc, PermissionListPendingRpc, PermissionListDecisionsRpc, PermissionRevokeDecisionRpc, PokemonPokedexRpc, PokemonEnsureSpriteCachedRpc, BrowserCommandsRpc, BrowserRespondRpc, BrowserSetCredentialRpc, BrowserListCredentialsRpc, BrowserRemoveCredentialRpc, WorktreeCreateRpc, WorktreeListRpc, WorktreeGetRpc, WorktreeRenameBranchRpc, WorktreeRerunSetupRpc, WorktreeSetupStreamRpc, WorktreeStartRunRpc, WorktreeRemoveRpc, RepositorySettingsGetRpc, RepositorySettingsUpdateRpc, SettingsGetRpc, SettingsUpdateRpc, SettingsStreamRpc, SettingsMigrateLocalStorageRpc, UsageReportRpc, UsageOverviewRpc, UsageSessionsRpc, UsageLimitsRpc, UsageLimitsHistoryRpc, DiagnosticsExportRpc, DiagnosticsOverviewRpc, DiagnosticsEventsRpc, DiagnosticsProcessesRpc, DiagnosticsSignalRpc, DiagnosticsIngestRpc, DiagnosticsCaptureRpc, KeybindingsGetRpc, KeybindingsReplaceRpc, KeybindingsStreamRpc, SessionSetWorktreeRpc);
|
|
7883
8022
|
//#endregion
|
|
7884
8023
|
//#region ../contracts/src/serve.ts
|
|
7885
8024
|
const ServeServiceState = Schema.Literals([
|
|
@@ -8007,7 +8146,7 @@ const authenticatedWsUrl = (options) => {
|
|
|
8007
8146
|
const base = options.wsBaseUrl?.trim();
|
|
8008
8147
|
const url = new URL(base && base.length > 0 ? base : wsUrl(options));
|
|
8009
8148
|
if (options.token?.trim()) url.searchParams.set("token", options.token.trim());
|
|
8010
|
-
return withWireProtocolVersion(url.toString(),
|
|
8149
|
+
return withWireProtocolVersion(url.toString(), 5);
|
|
8011
8150
|
};
|
|
8012
8151
|
const wsClientProtocolLayer = (endpoint, options) => {
|
|
8013
8152
|
const makeWebSocket = options?.onClose === void 0 ? options?.makeWebSocket : observeWebSocketConstructor(options.makeWebSocket ?? ((url, protocols) => new globalThis.WebSocket(url, protocols)), options.onClose);
|
|
@@ -8015,6 +8154,7 @@ const wsClientProtocolLayer = (endpoint, options) => {
|
|
|
8015
8154
|
};
|
|
8016
8155
|
//#endregion
|
|
8017
8156
|
//#region src/agent-cli.ts
|
|
8157
|
+
const commandId = (kind) => CommandId.make(`${kind}:${randomUUID()}`);
|
|
8018
8158
|
const GROUPS = /* @__PURE__ */ new Set([
|
|
8019
8159
|
"commands",
|
|
8020
8160
|
"computer",
|
|
@@ -8120,9 +8260,16 @@ const promptFor = async (args, message = false) => {
|
|
|
8120
8260
|
if (file === void 0) return "";
|
|
8121
8261
|
return file === "-" ? readStdin() : readFile(resolve(file), "utf8");
|
|
8122
8262
|
};
|
|
8123
|
-
const
|
|
8263
|
+
const installedCliAccessCandidates = (env, platform = process.platform) => {
|
|
8264
|
+
const configured = env.ZUSE_USER_DATA_DIR?.trim();
|
|
8265
|
+
if (configured) return [join(resolve(configured), "cli-access.json")];
|
|
8266
|
+
if (platform === "darwin") return [join(homedir(), "Library", "Application Support", "Zuse Alpha", "cli-access.json")];
|
|
8267
|
+
if (platform === "win32" && env.APPDATA?.trim()) return [join(resolve(env.APPDATA), "Zuse Alpha", "cli-access.json")];
|
|
8268
|
+
return [join(resolve(env.XDG_CONFIG_HOME?.trim() || join(homedir(), ".config")), "Zuse Alpha", "cli-access.json")];
|
|
8269
|
+
};
|
|
8270
|
+
const localCliAccess = async (env) => {
|
|
8124
8271
|
const explicit = env.ZUSE_DEV_CLI_ACCESS_FILE?.trim();
|
|
8125
|
-
const candidates = explicit ? [resolve(explicit)] : [];
|
|
8272
|
+
const candidates = explicit ? [resolve(explicit)] : [...installedCliAccessCandidates(env)];
|
|
8126
8273
|
let cursor = resolve(process.cwd());
|
|
8127
8274
|
while (true) {
|
|
8128
8275
|
const instance = env.ZUSE_DEV_INSTANCE?.trim() || "default";
|
|
@@ -8140,18 +8287,18 @@ const devCliAccess = async (env) => {
|
|
|
8140
8287
|
const endpoint = async (args, env) => {
|
|
8141
8288
|
const computer = one(args, "computer") ?? "local";
|
|
8142
8289
|
if (computer !== "local" && one(args, "ws-url") === void 0) throw new CliError("computer_unavailable", "A connected computer requires --ws-url and, when protected, --token.", { computer });
|
|
8143
|
-
const access = one(args, "ws-url") === void 0 && env.ZUSE_WS_URL === void 0 ? await
|
|
8290
|
+
const access = one(args, "ws-url") === void 0 && env.ZUSE_WS_URL === void 0 ? await localCliAccess(env) : null;
|
|
8144
8291
|
const raw = one(args, "ws-url") ?? env.ZUSE_WS_URL ?? access?.wsUrl ?? `ws://127.0.0.1:${env.ZUSE_PORT ?? "47837"}/rpc`;
|
|
8145
8292
|
const url = new URL(raw);
|
|
8146
8293
|
if (url.pathname === "/") url.pathname = "/rpc";
|
|
8147
|
-
url.searchParams.set("wireVersion", String(
|
|
8294
|
+
url.searchParams.set("wireVersion", String(5));
|
|
8148
8295
|
const token = one(args, "token") ?? env.ZUSE_TOKEN ?? access?.token;
|
|
8149
8296
|
if (token !== void 0) url.searchParams.set("token", token);
|
|
8150
8297
|
return url.toString();
|
|
8151
8298
|
};
|
|
8152
8299
|
const connect = async (args, env) => {
|
|
8153
8300
|
return makeRpcClientSession(wsClientProtocolLayer(await endpoint(args, env)), MemoizeRpcs, {
|
|
8154
|
-
protocolVersion:
|
|
8301
|
+
protocolVersion: 5,
|
|
8155
8302
|
perform: (client, hello) => client["connect.handshake"](hello)
|
|
8156
8303
|
});
|
|
8157
8304
|
};
|
|
@@ -8524,6 +8671,7 @@ const execute = async (argv, env) => {
|
|
|
8524
8671
|
permissionMode: permission(args)
|
|
8525
8672
|
}));
|
|
8526
8673
|
if (prompt || context.attachments.length || context.fileRefs.length) await rpc(client["messages.send"]({
|
|
8674
|
+
commandId: commandId("message-send"),
|
|
8527
8675
|
sessionId: created.id,
|
|
8528
8676
|
input: composer(prompt, context)
|
|
8529
8677
|
}));
|
|
@@ -8570,6 +8718,7 @@ const execute = async (argv, env) => {
|
|
|
8570
8718
|
return { session: await rpc(client["session.get"]({ sessionId: selectedSessionId })) };
|
|
8571
8719
|
}
|
|
8572
8720
|
if (group === "session" && action === "rename") return { session: await rpc(client["session.rename"]({
|
|
8721
|
+
commandId: commandId("session-rename"),
|
|
8573
8722
|
sessionId: selectedSessionId,
|
|
8574
8723
|
title: required(one(args, "title"), "--title")
|
|
8575
8724
|
})) };
|
|
@@ -8599,14 +8748,17 @@ const execute = async (argv, env) => {
|
|
|
8599
8748
|
const context = await contextFor(client, args, selectedSessionId, project);
|
|
8600
8749
|
const text = await promptFor(args, true);
|
|
8601
8750
|
if (one(args, "permission")) await rpc(client["session.setPermissionMode"]({
|
|
8751
|
+
commandId: commandId("session-permission-mode"),
|
|
8602
8752
|
sessionId: selectedSessionId,
|
|
8603
8753
|
mode: permission(args)
|
|
8604
8754
|
}));
|
|
8605
8755
|
if (one(args, "runtime")) await rpc(client["session.setRuntimeMode"]({
|
|
8756
|
+
commandId: commandId("session-runtime-mode"),
|
|
8606
8757
|
sessionId: selectedSessionId,
|
|
8607
8758
|
runtimeMode: runtime(args)
|
|
8608
8759
|
}));
|
|
8609
8760
|
await rpc(client["messages.send"]({
|
|
8761
|
+
commandId: commandId("message-send"),
|
|
8610
8762
|
sessionId: selectedSessionId,
|
|
8611
8763
|
input: composer(text, context)
|
|
8612
8764
|
}));
|
|
@@ -8652,6 +8804,7 @@ const execute = async (argv, env) => {
|
|
|
8652
8804
|
const input = composer(await promptFor(args, true), context);
|
|
8653
8805
|
if (action === "queue-add") return {
|
|
8654
8806
|
item: await rpc(client["messages.queue.add"]({
|
|
8807
|
+
commandId: commandId("queue-add"),
|
|
8655
8808
|
sessionId: selectedSessionId,
|
|
8656
8809
|
input,
|
|
8657
8810
|
...one(args, "queue") ? { queueId: one(args, "queue") } : {},
|
|
@@ -8662,6 +8815,7 @@ const execute = async (argv, env) => {
|
|
|
8662
8815
|
};
|
|
8663
8816
|
return {
|
|
8664
8817
|
item: await rpc(client["messages.queue.update"]({
|
|
8818
|
+
commandId: commandId("queue-update"),
|
|
8665
8819
|
sessionId: selectedSessionId,
|
|
8666
8820
|
queueId: required(one(args, "queue"), "--queue"),
|
|
8667
8821
|
input
|
|
@@ -8672,6 +8826,7 @@ const execute = async (argv, env) => {
|
|
|
8672
8826
|
if (group === "session" && action === "queue-delete") {
|
|
8673
8827
|
const queueId = required(one(args, "queue"), "--queue");
|
|
8674
8828
|
await rpc(client["messages.queue.delete"]({
|
|
8829
|
+
commandId: commandId("queue-delete"),
|
|
8675
8830
|
sessionId: selectedSessionId,
|
|
8676
8831
|
queueId
|
|
8677
8832
|
}));
|
|
@@ -8682,12 +8837,14 @@ const execute = async (argv, env) => {
|
|
|
8682
8837
|
};
|
|
8683
8838
|
}
|
|
8684
8839
|
if (group === "session" && action === "queue-reorder") return { items: await rpc(client["messages.queue.reorder"]({
|
|
8840
|
+
commandId: commandId("queue-reorder"),
|
|
8685
8841
|
sessionId: selectedSessionId,
|
|
8686
8842
|
queueIds: many(args, "queue")
|
|
8687
8843
|
})) };
|
|
8688
8844
|
if (group === "session" && action === "queue-run-next") {
|
|
8689
8845
|
const queueId = required(one(args, "queue"), "--queue");
|
|
8690
8846
|
await rpc(client["messages.queue.runNext"]({
|
|
8847
|
+
commandId: commandId("queue-run-next"),
|
|
8691
8848
|
sessionId: selectedSessionId,
|
|
8692
8849
|
queueId
|
|
8693
8850
|
}));
|
|
@@ -8698,14 +8855,20 @@ const execute = async (argv, env) => {
|
|
|
8698
8855
|
};
|
|
8699
8856
|
}
|
|
8700
8857
|
if (group === "session" && action === "queue-flush") {
|
|
8701
|
-
await rpc(client["messages.queue.flush"]({
|
|
8858
|
+
await rpc(client["messages.queue.flush"]({
|
|
8859
|
+
commandId: commandId("queue-flush"),
|
|
8860
|
+
sessionId: selectedSessionId
|
|
8861
|
+
}));
|
|
8702
8862
|
return {
|
|
8703
8863
|
sessionId: selectedSessionId,
|
|
8704
8864
|
flushed: true
|
|
8705
8865
|
};
|
|
8706
8866
|
}
|
|
8707
8867
|
if (group === "session" && action === "queue-resume") {
|
|
8708
|
-
await rpc(client["messages.queue.resume"]({
|
|
8868
|
+
await rpc(client["messages.queue.resume"]({
|
|
8869
|
+
commandId: commandId("queue-resume"),
|
|
8870
|
+
sessionId: selectedSessionId
|
|
8871
|
+
}));
|
|
8709
8872
|
return {
|
|
8710
8873
|
sessionId: selectedSessionId,
|
|
8711
8874
|
resumed: true
|
|
@@ -8714,17 +8877,22 @@ const execute = async (argv, env) => {
|
|
|
8714
8877
|
if (group === "session" && action === "mode") {
|
|
8715
8878
|
if (!one(args, "permission") && !one(args, "runtime")) throw new CliError("invalid_input", "session mode requires --permission or --runtime.");
|
|
8716
8879
|
if (one(args, "permission")) await rpc(client["session.setPermissionMode"]({
|
|
8880
|
+
commandId: commandId("session-permission-mode"),
|
|
8717
8881
|
sessionId: selectedSessionId,
|
|
8718
8882
|
mode: permission(args)
|
|
8719
8883
|
}));
|
|
8720
8884
|
if (one(args, "runtime")) await rpc(client["session.setRuntimeMode"]({
|
|
8885
|
+
commandId: commandId("session-runtime-mode"),
|
|
8721
8886
|
sessionId: selectedSessionId,
|
|
8722
8887
|
runtimeMode: runtime(args)
|
|
8723
8888
|
}));
|
|
8724
8889
|
return { session: await rpc(client["session.get"]({ sessionId: selectedSessionId })) };
|
|
8725
8890
|
}
|
|
8726
8891
|
if (group === "session" && action === "interrupt") {
|
|
8727
|
-
await rpc(client["messages.interrupt"]({
|
|
8892
|
+
await rpc(client["messages.interrupt"]({
|
|
8893
|
+
commandId: commandId("message-interrupt"),
|
|
8894
|
+
sessionId: selectedSessionId
|
|
8895
|
+
}));
|
|
8728
8896
|
return {
|
|
8729
8897
|
sessionId: selectedSessionId,
|
|
8730
8898
|
interrupted: true
|
|
@@ -8753,4 +8921,4 @@ const runServeCli = async (argv, env = process.env) => {
|
|
|
8753
8921
|
//#endregion
|
|
8754
8922
|
export { runServeCli as t };
|
|
8755
8923
|
|
|
8756
|
-
//# sourceMappingURL=cli-
|
|
8924
|
+
//# sourceMappingURL=cli-BKZzhoKT.mjs.map
|