opencode-courier 0.13.7 → 0.14.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/README.md +10 -11
- package/dist/index.d.ts +0 -8
- package/dist/index.js +6 -53
- package/dist/kernel/protocol.d.ts +0 -14
- package/dist/kernel/protocol.js +1 -15
- package/dist/kernel/tool.d.ts +0 -2
- package/dist/kernel/tool.js +0 -1
- package/dist/memory/domain.d.ts +6 -85
- package/dist/memory/domain.js +7 -63
- package/dist/memory/events.d.ts +0 -11
- package/dist/memory/events.js +1 -12
- package/dist/memory/forget.d.ts +0 -5
- package/dist/memory/forget.js +0 -4
- package/dist/memory/index.js +0 -2
- package/dist/memory/lessons.d.ts +0 -8
- package/dist/memory/lessons.js +0 -9
- package/dist/memory/note.d.ts +0 -9
- package/dist/memory/note.js +0 -5
- package/dist/memory/pin.d.ts +0 -5
- package/dist/memory/pin.js +0 -4
- package/dist/memory/ports.d.ts +2 -22
- package/dist/memory/recall.d.ts +0 -5
- package/dist/memory/recall.js +0 -12
- package/dist/memory/record.d.ts +0 -4
- package/dist/memory/record.js +8 -31
- package/dist/memory/rpc-handlers.d.ts +3 -6
- package/dist/memory/rpc-handlers.js +0 -6
- package/dist/memory/rpc.d.ts +6 -19
- package/dist/memory/rpc.js +1 -16
- package/dist/memory/store.d.ts +0 -5
- package/dist/memory/store.js +1 -16
- package/dist/memory/sweep.d.ts +0 -4
- package/dist/memory/sweep.js +0 -4
- package/dist/memory/text.d.ts +0 -25
- package/dist/memory/text.js +6 -36
- package/dist/memory/tools.d.ts +0 -2
- package/dist/memory/tools.js +0 -2
- package/dist/memory/tui.d.ts +1 -35
- package/dist/person/events.d.ts +0 -16
- package/dist/person/events.js +3 -30
- package/dist/person/form.d.ts +0 -9
- package/dist/person/form.js +0 -10
- package/dist/person/index.d.ts +0 -2
- package/dist/person/permission.d.ts +0 -34
- package/dist/person/permission.js +2 -28
- package/dist/person/ports.d.ts +0 -16
- package/dist/person/ports.js +0 -1
- package/dist/person/question/answer.d.ts +0 -28
- package/dist/person/question/answer.js +0 -49
- package/dist/person/question/index.js +0 -2
- package/dist/person/question/lifecycle.d.ts +0 -26
- package/dist/person/question/lifecycle.js +1 -32
- package/dist/person/question/pure.d.ts +0 -11
- package/dist/person/question/pure.js +0 -11
- package/dist/person/question/relay.d.ts +0 -1
- package/dist/person/question/relay.js +5 -67
- package/dist/person/question/runtime.d.ts +0 -14
- package/dist/person/question/runtime.js +1 -26
- package/dist/person/question/shared.d.ts +0 -17
- package/dist/person/question/shared.js +0 -20
- package/dist/person/question/types.d.ts +0 -44
- package/dist/person/rpc-handlers.d.ts +0 -7
- package/dist/person/rpc-handlers.js +0 -6
- package/dist/person/rpc.d.ts +0 -20
- package/dist/person/rpc.js +0 -16
- package/dist/person/text.d.ts +0 -45
- package/dist/person/text.js +2 -54
- package/dist/person/tools.d.ts +0 -3
- package/dist/person/tools.js +1 -3
- package/dist/person/tui.d.ts +0 -21
- package/dist/platform/bounded.d.ts +0 -8
- package/dist/platform/bounded.js +0 -8
- package/dist/platform/events.d.ts +0 -18
- package/dist/platform/events.js +3 -22
- package/dist/platform/hub.d.ts +0 -113
- package/dist/platform/hub.js +1 -76
- package/dist/platform/json.d.ts +0 -3
- package/dist/platform/json.js +1 -3
- package/dist/platform/storage.d.ts +0 -7
- package/dist/platform/storage.js +0 -6
- package/dist/platform/version.d.ts +0 -9
- package/dist/platform/version.js +0 -8
- package/dist/rpc.js +0 -1
- package/dist/scheduling/index.d.ts +0 -1
- package/dist/scheduling/index.js +0 -1
- package/dist/scheduling/later.d.ts +0 -11
- package/dist/scheduling/later.js +0 -14
- package/dist/scheduling/text.d.ts +0 -1
- package/dist/scheduling/text.js +0 -1
- package/dist/scheduling/tools.d.ts +0 -1
- package/dist/scheduling/tools.js +1 -5
- package/dist/skill.d.ts +1 -9
- package/dist/skill.js +97 -118
- package/dist/tree/cleanup.d.ts +0 -20
- package/dist/tree/cleanup.js +0 -26
- package/dist/tree/context.d.ts +0 -5
- package/dist/tree/context.js +0 -8
- package/dist/tree/domain.d.ts +0 -64
- package/dist/tree/domain.js +7 -45
- package/dist/tree/events.d.ts +0 -36
- package/dist/tree/events.js +4 -49
- package/dist/tree/forget.d.ts +0 -15
- package/dist/tree/forget.js +0 -18
- package/dist/tree/group.d.ts +0 -22
- package/dist/tree/group.js +1 -37
- package/dist/tree/index.d.ts +2 -2
- package/dist/tree/index.js +1 -3
- package/dist/tree/limits.d.ts +0 -4
- package/dist/tree/limits.js +1 -12
- package/dist/tree/mascot.d.ts +0 -25
- package/dist/tree/mascot.js +1 -32
- package/dist/tree/model.d.ts +0 -5
- package/dist/tree/model.js +2 -15
- package/dist/tree/nudge.d.ts +0 -11
- package/dist/tree/nudge.js +3 -16
- package/dist/tree/panel.d.ts +0 -8
- package/dist/tree/panel.js +3 -16
- package/dist/tree/ports.d.ts +2 -138
- package/dist/tree/report.d.ts +0 -10
- package/dist/tree/report.js +0 -11
- package/dist/tree/roster.d.ts +0 -21
- package/dist/tree/roster.js +0 -21
- package/dist/tree/rpc-handlers.d.ts +6 -1
- package/dist/tree/rpc-handlers.js +0 -5
- package/dist/tree/rpc.d.ts +9 -109
- package/dist/tree/rpc.js +2 -38
- package/dist/tree/running.d.ts +0 -6
- package/dist/tree/running.js +2 -10
- package/dist/tree/send.d.ts +0 -4
- package/dist/tree/send.js +4 -31
- package/dist/tree/spawn.d.ts +0 -7
- package/dist/tree/spawn.js +6 -47
- package/dist/tree/standing.d.ts +0 -8
- package/dist/tree/standing.js +1 -11
- package/dist/tree/status.d.ts +0 -8
- package/dist/tree/status.js +1 -9
- package/dist/tree/stop.d.ts +2 -9
- package/dist/tree/stop.js +58 -25
- package/dist/tree/store.d.ts +0 -8
- package/dist/tree/store.js +4 -38
- package/dist/tree/subtree.d.ts +8 -26
- package/dist/tree/subtree.js +37 -35
- package/dist/tree/summary.d.ts +0 -4
- package/dist/tree/summary.js +0 -8
- package/dist/tree/text.d.ts +1 -44
- package/dist/tree/text.js +6 -66
- package/dist/tree/tools.d.ts +0 -6
- package/dist/tree/tools.js +4 -8
- package/dist/tree/tui.d.ts +0 -81
- package/dist/tree/wake.d.ts +0 -30
- package/dist/tree/wake.js +5 -39
- package/dist/tui.js +22 -8
- package/package.json +8 -9
- package/dist/webhook/index.d.ts +0 -5
- package/dist/webhook/index.js +0 -3
- package/dist/webhook/receiver.d.ts +0 -80
- package/dist/webhook/receiver.js +0 -339
- package/dist/webhook/subscriptions.d.ts +0 -29
- package/dist/webhook/subscriptions.js +0 -52
- package/dist/webhook/text.d.ts +0 -23
- package/dist/webhook/text.js +0 -82
- package/dist/webhook/tools.d.ts +0 -19
- package/dist/webhook/tools.js +0 -46
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Plugin } from "@opencode/plugin";
|
|
2
2
|
import type { StopPorts } from "./ports.js";
|
|
3
|
-
/** Serves the tree's RPC at the plugin's location, through the same use cases as the tools; disposed with the plugin. */
|
|
4
3
|
export declare function registerTreeRpc(rpc: Pick<Plugin.Context["rpc"], "register">, ports: StopPorts): Promise<import("@opencode/plugin/promise/rpc").RpcRegistration<{
|
|
5
4
|
readonly id: "courier";
|
|
6
5
|
readonly methods: {
|
|
@@ -74,6 +73,7 @@ export declare function registerTreeRpc(rpc: Pick<Plugin.Context["rpc"], "regist
|
|
|
74
73
|
})[];
|
|
75
74
|
readonly stopped?: boolean | undefined;
|
|
76
75
|
readonly stalled?: number | undefined;
|
|
76
|
+
readonly subagent?: boolean | undefined;
|
|
77
77
|
readonly group?: {
|
|
78
78
|
readonly name: string;
|
|
79
79
|
readonly standing: string;
|
|
@@ -117,6 +117,7 @@ export declare function registerTreeRpc(rpc: Pick<Plugin.Context["rpc"], "regist
|
|
|
117
117
|
})[];
|
|
118
118
|
readonly stopped?: boolean | undefined;
|
|
119
119
|
readonly stalled?: number | undefined;
|
|
120
|
+
readonly subagent?: boolean | undefined;
|
|
120
121
|
readonly group?: {
|
|
121
122
|
readonly name: string;
|
|
122
123
|
readonly standing: string;
|
|
@@ -161,6 +162,7 @@ export declare function registerTreeRpc(rpc: Pick<Plugin.Context["rpc"], "regist
|
|
|
161
162
|
})[];
|
|
162
163
|
readonly stopped?: boolean | undefined;
|
|
163
164
|
readonly stalled?: number | undefined;
|
|
165
|
+
readonly subagent?: boolean | undefined;
|
|
164
166
|
readonly group?: {
|
|
165
167
|
readonly name: string;
|
|
166
168
|
readonly standing: string;
|
|
@@ -204,6 +206,7 @@ export declare function registerTreeRpc(rpc: Pick<Plugin.Context["rpc"], "regist
|
|
|
204
206
|
})[];
|
|
205
207
|
readonly stopped?: boolean | undefined;
|
|
206
208
|
readonly stalled?: number | undefined;
|
|
209
|
+
readonly subagent?: boolean | undefined;
|
|
207
210
|
readonly group?: {
|
|
208
211
|
readonly name: string;
|
|
209
212
|
readonly standing: string;
|
|
@@ -248,6 +251,7 @@ export declare function registerTreeRpc(rpc: Pick<Plugin.Context["rpc"], "regist
|
|
|
248
251
|
}>>;
|
|
249
252
|
readonly isolated: import("effect/Schema").Boolean;
|
|
250
253
|
readonly native: import("effect/Schema").optionalKey<import("effect/Schema").Boolean>;
|
|
254
|
+
readonly subagent: import("effect/Schema").optionalKey<import("effect/Schema").Boolean>;
|
|
251
255
|
readonly model: import("effect/Schema").optionalKey<import("effect/Schema").String>;
|
|
252
256
|
readonly created: import("effect/Schema").Number;
|
|
253
257
|
readonly idle: import("effect/Schema").optionalKey<import("effect/Schema").Number>;
|
|
@@ -290,6 +294,7 @@ export declare function registerTreeRpc(rpc: Pick<Plugin.Context["rpc"], "regist
|
|
|
290
294
|
}>>;
|
|
291
295
|
readonly isolated: import("effect/Schema").Boolean;
|
|
292
296
|
readonly native: import("effect/Schema").optionalKey<import("effect/Schema").Boolean>;
|
|
297
|
+
readonly subagent: import("effect/Schema").optionalKey<import("effect/Schema").Boolean>;
|
|
293
298
|
readonly model: import("effect/Schema").optionalKey<import("effect/Schema").String>;
|
|
294
299
|
readonly created: import("effect/Schema").Number;
|
|
295
300
|
readonly idle: import("effect/Schema").optionalKey<import("effect/Schema").Number>;
|
|
@@ -6,7 +6,6 @@ import { treeRpc } from "./rpc.js";
|
|
|
6
6
|
import { stop } from "./stop.js";
|
|
7
7
|
import { childStore } from "./store.js";
|
|
8
8
|
import { summary } from "./summary.js";
|
|
9
|
-
/** Serves the tree's RPC at the plugin's location, through the same use cases as the tools; disposed with the plugin. */
|
|
10
9
|
export function registerTreeRpc(rpc, ports) {
|
|
11
10
|
const refused = (cause) => (cause instanceof Error ? cause.message : String(cause));
|
|
12
11
|
return rpc.register(treeRpc, {
|
|
@@ -31,10 +30,6 @@ export function registerTreeRpc(rpc, ports) {
|
|
|
31
30
|
},
|
|
32
31
|
});
|
|
33
32
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Forgets a session OpenCode no longer knows as courier_cleanup called from its own parent, once `by` is found above it,
|
|
36
|
-
* as courier_stop checks. A session OpenCode still has, or cannot say it lost, is refused: forgetting it loses its report.
|
|
37
|
-
*/
|
|
38
33
|
async function forget(ports, by, sessionID) {
|
|
39
34
|
const chain = await childStore(ports.courier.storage).lineage(sessionID);
|
|
40
35
|
if (!chain.length)
|
package/dist/tree/rpc.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
/** The sessions started under a session, as the prompt footer's status entry shows them. */
|
|
3
2
|
declare const Summary: Schema.Struct<{
|
|
4
|
-
/** Running, and waiting on no request or form. */
|
|
5
3
|
readonly running: Schema.Int;
|
|
6
|
-
/** Waiting on a permission request, a question or a form it shows, which go to the person. */
|
|
7
4
|
readonly waiting: Schema.Int;
|
|
8
|
-
/** Not running: done, or waiting for a message. */
|
|
9
5
|
readonly idle: Schema.Int;
|
|
10
|
-
/** Left a courier message waiting while idle, and did not take it once woken again; the session itself counts too. Absent at 0. */
|
|
11
6
|
readonly stalled: Schema.optionalKey<Schema.Int>;
|
|
12
7
|
readonly groups: Schema.$Array<Schema.Struct<{
|
|
13
8
|
readonly name: Schema.String;
|
|
@@ -16,7 +11,6 @@ declare const Summary: Schema.Struct<{
|
|
|
16
11
|
}>>;
|
|
17
12
|
}>;
|
|
18
13
|
export type Summary = typeof Summary.Type;
|
|
19
|
-
/** A request a session waits on until the person answers it: a permission request, its first question, or a form it shows. */
|
|
20
14
|
declare const Wait: Schema.Union<readonly [Schema.Struct<{
|
|
21
15
|
readonly type: Schema.Literal<"permission">;
|
|
22
16
|
readonly action: Schema.String;
|
|
@@ -28,50 +22,33 @@ declare const Wait: Schema.Union<readonly [Schema.Struct<{
|
|
|
28
22
|
readonly type: Schema.Literal<"form">;
|
|
29
23
|
readonly title: Schema.String;
|
|
30
24
|
}>]>;
|
|
31
|
-
/** One session of the tree panel: what courier_tree shows of it, and what it is doing, in epoch milliseconds. */
|
|
32
25
|
declare const Row: Schema.Struct<{
|
|
33
26
|
readonly sessionID: Schema.String;
|
|
34
27
|
readonly parentID: Schema.String;
|
|
35
28
|
readonly title: Schema.String;
|
|
36
|
-
/** A child of the panel's session is at depth 1. */
|
|
37
29
|
readonly depth: Schema.Int;
|
|
38
|
-
/**
|
|
39
|
-
* `waiting` on a request to the person or a form it shows them; `stalled` when a courier message waits in its inbox and
|
|
40
|
-
* waking it again did not start a turn; `gone` when OpenCode no longer knows it.
|
|
41
|
-
*/
|
|
42
30
|
readonly state: Schema.Literals<readonly ["running", "waiting", "idle", "stalled", "gone"]>;
|
|
43
|
-
/** Since when its oldest message that did not wake it has waited, when it is stalled. */
|
|
44
31
|
readonly stalled: Schema.optionalKey<Schema.Number>;
|
|
45
|
-
/** How its last turn ended. */
|
|
46
32
|
readonly outcome: Schema.optionalKey<Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>>;
|
|
47
|
-
/** When the provider limit that failed its last turn lifts; left out once that has passed, or when it runs again or was stopped. */
|
|
48
33
|
readonly resumes: Schema.optionalKey<Schema.Number>;
|
|
49
|
-
/** Set when courier_stop stopped it since its last prompt. */
|
|
50
34
|
readonly stopped: Schema.optionalKey<Schema.Boolean>;
|
|
51
|
-
/** Its report since its last prompt: still owed, arrived (held with its group or delivered), or its turn ended without one. */
|
|
52
35
|
readonly report: Schema.optionalKey<Schema.Struct<{
|
|
53
36
|
readonly state: Schema.Literals<readonly ["owed", "reported", "ended"]>;
|
|
54
37
|
readonly status: Schema.optionalKey<Schema.String>;
|
|
55
38
|
readonly progressed: Schema.Boolean;
|
|
56
39
|
}>>;
|
|
57
|
-
/** Its join group, and its standing there: `held`, `out`, how it left, or `released`. */
|
|
58
40
|
readonly group: Schema.optionalKey<Schema.Struct<{
|
|
59
41
|
readonly name: Schema.String;
|
|
60
42
|
readonly standing: Schema.String;
|
|
61
43
|
}>>;
|
|
62
44
|
readonly isolated: Schema.Boolean;
|
|
63
|
-
/** Set when it is OpenCode's subagent of its parent (a native child), which OpenCode's session lists leave out. */
|
|
64
45
|
readonly native: Schema.optionalKey<Schema.Boolean>;
|
|
65
|
-
|
|
46
|
+
readonly subagent: Schema.optionalKey<Schema.Boolean>;
|
|
66
47
|
readonly model: Schema.optionalKey<Schema.String>;
|
|
67
48
|
readonly created: Schema.Number;
|
|
68
|
-
/** When its last turn ended, if it is not running. */
|
|
69
49
|
readonly idle: Schema.optionalKey<Schema.Number>;
|
|
70
|
-
/** What it has cost so far, in US dollars. */
|
|
71
50
|
readonly cost: Schema.optionalKey<Schema.Number>;
|
|
72
|
-
/** How full its context is, as a fraction of the model's window; left out when the model or its limit cannot be read. */
|
|
73
51
|
readonly context: Schema.optionalKey<Schema.Number>;
|
|
74
|
-
/** Its last tool call, and when it was made. */
|
|
75
52
|
readonly tool: Schema.optionalKey<Schema.Struct<{
|
|
76
53
|
readonly name: Schema.String;
|
|
77
54
|
readonly at: Schema.Number;
|
|
@@ -88,51 +65,34 @@ declare const Row: Schema.Struct<{
|
|
|
88
65
|
readonly title: Schema.String;
|
|
89
66
|
}>]>>;
|
|
90
67
|
}>;
|
|
91
|
-
/** The sessions under a session, as courier_tree lists them, in the order a tree is drawn. */
|
|
92
68
|
declare const Tree: Schema.Struct<{
|
|
93
69
|
readonly rows: Schema.$Array<Schema.Struct<{
|
|
94
70
|
readonly sessionID: Schema.String;
|
|
95
71
|
readonly parentID: Schema.String;
|
|
96
72
|
readonly title: Schema.String;
|
|
97
|
-
/** A child of the panel's session is at depth 1. */
|
|
98
73
|
readonly depth: Schema.Int;
|
|
99
|
-
/**
|
|
100
|
-
* `waiting` on a request to the person or a form it shows them; `stalled` when a courier message waits in its inbox and
|
|
101
|
-
* waking it again did not start a turn; `gone` when OpenCode no longer knows it.
|
|
102
|
-
*/
|
|
103
74
|
readonly state: Schema.Literals<readonly ["running", "waiting", "idle", "stalled", "gone"]>;
|
|
104
|
-
/** Since when its oldest message that did not wake it has waited, when it is stalled. */
|
|
105
75
|
readonly stalled: Schema.optionalKey<Schema.Number>;
|
|
106
|
-
/** How its last turn ended. */
|
|
107
76
|
readonly outcome: Schema.optionalKey<Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>>;
|
|
108
|
-
/** When the provider limit that failed its last turn lifts; left out once that has passed, or when it runs again or was stopped. */
|
|
109
77
|
readonly resumes: Schema.optionalKey<Schema.Number>;
|
|
110
|
-
/** Set when courier_stop stopped it since its last prompt. */
|
|
111
78
|
readonly stopped: Schema.optionalKey<Schema.Boolean>;
|
|
112
|
-
/** Its report since its last prompt: still owed, arrived (held with its group or delivered), or its turn ended without one. */
|
|
113
79
|
readonly report: Schema.optionalKey<Schema.Struct<{
|
|
114
80
|
readonly state: Schema.Literals<readonly ["owed", "reported", "ended"]>;
|
|
115
81
|
readonly status: Schema.optionalKey<Schema.String>;
|
|
116
82
|
readonly progressed: Schema.Boolean;
|
|
117
83
|
}>>;
|
|
118
|
-
/** Its join group, and its standing there: `held`, `out`, how it left, or `released`. */
|
|
119
84
|
readonly group: Schema.optionalKey<Schema.Struct<{
|
|
120
85
|
readonly name: Schema.String;
|
|
121
86
|
readonly standing: Schema.String;
|
|
122
87
|
}>>;
|
|
123
88
|
readonly isolated: Schema.Boolean;
|
|
124
|
-
/** Set when it is OpenCode's subagent of its parent (a native child), which OpenCode's session lists leave out. */
|
|
125
89
|
readonly native: Schema.optionalKey<Schema.Boolean>;
|
|
126
|
-
|
|
90
|
+
readonly subagent: Schema.optionalKey<Schema.Boolean>;
|
|
127
91
|
readonly model: Schema.optionalKey<Schema.String>;
|
|
128
92
|
readonly created: Schema.Number;
|
|
129
|
-
/** When its last turn ended, if it is not running. */
|
|
130
93
|
readonly idle: Schema.optionalKey<Schema.Number>;
|
|
131
|
-
/** What it has cost so far, in US dollars. */
|
|
132
94
|
readonly cost: Schema.optionalKey<Schema.Number>;
|
|
133
|
-
/** How full its context is, as a fraction of the model's window; left out when the model or its limit cannot be read. */
|
|
134
95
|
readonly context: Schema.optionalKey<Schema.Number>;
|
|
135
|
-
/** Its last tool call, and when it was made. */
|
|
136
96
|
readonly tool: Schema.optionalKey<Schema.Struct<{
|
|
137
97
|
readonly name: Schema.String;
|
|
138
98
|
readonly at: Schema.Number;
|
|
@@ -149,50 +109,33 @@ declare const Tree: Schema.Struct<{
|
|
|
149
109
|
readonly title: Schema.String;
|
|
150
110
|
}>]>>;
|
|
151
111
|
}>>;
|
|
152
|
-
/** The panel's own session, at depth 0; absent when OpenCode no longer knows it, and from an older server. */
|
|
153
112
|
readonly top: Schema.optionalKey<Schema.Struct<{
|
|
154
113
|
readonly sessionID: Schema.String;
|
|
155
114
|
readonly parentID: Schema.String;
|
|
156
115
|
readonly title: Schema.String;
|
|
157
|
-
/** A child of the panel's session is at depth 1. */
|
|
158
116
|
readonly depth: Schema.Int;
|
|
159
|
-
/**
|
|
160
|
-
* `waiting` on a request to the person or a form it shows them; `stalled` when a courier message waits in its inbox and
|
|
161
|
-
* waking it again did not start a turn; `gone` when OpenCode no longer knows it.
|
|
162
|
-
*/
|
|
163
117
|
readonly state: Schema.Literals<readonly ["running", "waiting", "idle", "stalled", "gone"]>;
|
|
164
|
-
/** Since when its oldest message that did not wake it has waited, when it is stalled. */
|
|
165
118
|
readonly stalled: Schema.optionalKey<Schema.Number>;
|
|
166
|
-
/** How its last turn ended. */
|
|
167
119
|
readonly outcome: Schema.optionalKey<Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>>;
|
|
168
|
-
/** When the provider limit that failed its last turn lifts; left out once that has passed, or when it runs again or was stopped. */
|
|
169
120
|
readonly resumes: Schema.optionalKey<Schema.Number>;
|
|
170
|
-
/** Set when courier_stop stopped it since its last prompt. */
|
|
171
121
|
readonly stopped: Schema.optionalKey<Schema.Boolean>;
|
|
172
|
-
/** Its report since its last prompt: still owed, arrived (held with its group or delivered), or its turn ended without one. */
|
|
173
122
|
readonly report: Schema.optionalKey<Schema.Struct<{
|
|
174
123
|
readonly state: Schema.Literals<readonly ["owed", "reported", "ended"]>;
|
|
175
124
|
readonly status: Schema.optionalKey<Schema.String>;
|
|
176
125
|
readonly progressed: Schema.Boolean;
|
|
177
126
|
}>>;
|
|
178
|
-
/** Its join group, and its standing there: `held`, `out`, how it left, or `released`. */
|
|
179
127
|
readonly group: Schema.optionalKey<Schema.Struct<{
|
|
180
128
|
readonly name: Schema.String;
|
|
181
129
|
readonly standing: Schema.String;
|
|
182
130
|
}>>;
|
|
183
131
|
readonly isolated: Schema.Boolean;
|
|
184
|
-
/** Set when it is OpenCode's subagent of its parent (a native child), which OpenCode's session lists leave out. */
|
|
185
132
|
readonly native: Schema.optionalKey<Schema.Boolean>;
|
|
186
|
-
|
|
133
|
+
readonly subagent: Schema.optionalKey<Schema.Boolean>;
|
|
187
134
|
readonly model: Schema.optionalKey<Schema.String>;
|
|
188
135
|
readonly created: Schema.Number;
|
|
189
|
-
/** When its last turn ended, if it is not running. */
|
|
190
136
|
readonly idle: Schema.optionalKey<Schema.Number>;
|
|
191
|
-
/** What it has cost so far, in US dollars. */
|
|
192
137
|
readonly cost: Schema.optionalKey<Schema.Number>;
|
|
193
|
-
/** How full its context is, as a fraction of the model's window; left out when the model or its limit cannot be read. */
|
|
194
138
|
readonly context: Schema.optionalKey<Schema.Number>;
|
|
195
|
-
/** Its last tool call, and when it was made. */
|
|
196
139
|
readonly tool: Schema.optionalKey<Schema.Struct<{
|
|
197
140
|
readonly name: Schema.String;
|
|
198
141
|
readonly at: Schema.Number;
|
|
@@ -209,26 +152,21 @@ declare const Tree: Schema.Struct<{
|
|
|
209
152
|
readonly title: Schema.String;
|
|
210
153
|
}>]>>;
|
|
211
154
|
}>>;
|
|
212
|
-
/** How many older sessions the listing left out, when it had more than `maxTotal`: the live ones come first, then the newest. */
|
|
213
155
|
readonly truncated: Schema.optionalKey<Schema.Int>;
|
|
214
|
-
/** Since when a courier message has waited in the panel's own session, when that session is stalled. */
|
|
215
156
|
readonly stalled: Schema.optionalKey<Schema.Number>;
|
|
216
157
|
}>;
|
|
217
158
|
export type Row = typeof Row.Type;
|
|
218
159
|
export type Tree = typeof Tree.Type;
|
|
219
160
|
export type Wait = typeof Wait.Type;
|
|
220
|
-
/** What a stop did to each session, deepest first, as courier_stop reports it. */
|
|
221
161
|
declare const Stopped: Schema.Struct<{
|
|
222
162
|
readonly stopped: Schema.$Array<Schema.Struct<{
|
|
223
163
|
readonly sessionID: Schema.String;
|
|
224
164
|
readonly title: Schema.String;
|
|
225
165
|
readonly outcome: Schema.String;
|
|
226
166
|
}>>;
|
|
227
|
-
/** How many scheduled messages were cancelled. */
|
|
228
167
|
readonly cancelled: Schema.Int;
|
|
229
168
|
}>;
|
|
230
169
|
export type Stopped = typeof Stopped.Type;
|
|
231
|
-
/** What courier_cleanup did: forgot it, removed its worktree, found that already gone, or kept the worktree, saying why. */
|
|
232
170
|
declare const Forgotten: Schema.Union<readonly [Schema.Struct<{
|
|
233
171
|
readonly outcome: Schema.Literals<readonly ["forgotten", "removed", "gone"]>;
|
|
234
172
|
}>, Schema.Struct<{
|
|
@@ -268,13 +206,9 @@ export declare const treeRpc: {
|
|
|
268
206
|
readonly waiting: number;
|
|
269
207
|
readonly stalled?: number | undefined;
|
|
270
208
|
}> & Schema.Struct<{
|
|
271
|
-
/** Running, and waiting on no request or form. */
|
|
272
209
|
readonly running: Schema.Int;
|
|
273
|
-
/** Waiting on a permission request, a question or a form it shows, which go to the person. */
|
|
274
210
|
readonly waiting: Schema.Int;
|
|
275
|
-
/** Not running: done, or waiting for a message. */
|
|
276
211
|
readonly idle: Schema.Int;
|
|
277
|
-
/** Left a courier message waiting while idle, and did not take it once woken again; the session itself counts too. Absent at 0. */
|
|
278
212
|
readonly stalled: Schema.optionalKey<Schema.Int>;
|
|
279
213
|
readonly groups: Schema.$Array<Schema.Struct<{
|
|
280
214
|
readonly name: Schema.String;
|
|
@@ -313,6 +247,7 @@ export declare const treeRpc: {
|
|
|
313
247
|
})[];
|
|
314
248
|
readonly stopped?: boolean | undefined;
|
|
315
249
|
readonly stalled?: number | undefined;
|
|
250
|
+
readonly subagent?: boolean | undefined;
|
|
316
251
|
readonly group?: {
|
|
317
252
|
readonly name: string;
|
|
318
253
|
readonly standing: string;
|
|
@@ -356,6 +291,7 @@ export declare const treeRpc: {
|
|
|
356
291
|
})[];
|
|
357
292
|
readonly stopped?: boolean | undefined;
|
|
358
293
|
readonly stalled?: number | undefined;
|
|
294
|
+
readonly subagent?: boolean | undefined;
|
|
359
295
|
readonly group?: {
|
|
360
296
|
readonly name: string;
|
|
361
297
|
readonly standing: string;
|
|
@@ -400,6 +336,7 @@ export declare const treeRpc: {
|
|
|
400
336
|
})[];
|
|
401
337
|
readonly stopped?: boolean | undefined;
|
|
402
338
|
readonly stalled?: number | undefined;
|
|
339
|
+
readonly subagent?: boolean | undefined;
|
|
403
340
|
readonly group?: {
|
|
404
341
|
readonly name: string;
|
|
405
342
|
readonly standing: string;
|
|
@@ -443,6 +380,7 @@ export declare const treeRpc: {
|
|
|
443
380
|
})[];
|
|
444
381
|
readonly stopped?: boolean | undefined;
|
|
445
382
|
readonly stalled?: number | undefined;
|
|
383
|
+
readonly subagent?: boolean | undefined;
|
|
446
384
|
readonly group?: {
|
|
447
385
|
readonly name: string;
|
|
448
386
|
readonly standing: string;
|
|
@@ -470,45 +408,29 @@ export declare const treeRpc: {
|
|
|
470
408
|
readonly sessionID: Schema.String;
|
|
471
409
|
readonly parentID: Schema.String;
|
|
472
410
|
readonly title: Schema.String;
|
|
473
|
-
/** A child of the panel's session is at depth 1. */
|
|
474
411
|
readonly depth: Schema.Int;
|
|
475
|
-
/**
|
|
476
|
-
* `waiting` on a request to the person or a form it shows them; `stalled` when a courier message waits in its inbox and
|
|
477
|
-
* waking it again did not start a turn; `gone` when OpenCode no longer knows it.
|
|
478
|
-
*/
|
|
479
412
|
readonly state: Schema.Literals<readonly ["running", "waiting", "idle", "stalled", "gone"]>;
|
|
480
|
-
/** Since when its oldest message that did not wake it has waited, when it is stalled. */
|
|
481
413
|
readonly stalled: Schema.optionalKey<Schema.Number>;
|
|
482
|
-
/** How its last turn ended. */
|
|
483
414
|
readonly outcome: Schema.optionalKey<Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>>;
|
|
484
|
-
/** When the provider limit that failed its last turn lifts; left out once that has passed, or when it runs again or was stopped. */
|
|
485
415
|
readonly resumes: Schema.optionalKey<Schema.Number>;
|
|
486
|
-
/** Set when courier_stop stopped it since its last prompt. */
|
|
487
416
|
readonly stopped: Schema.optionalKey<Schema.Boolean>;
|
|
488
|
-
/** Its report since its last prompt: still owed, arrived (held with its group or delivered), or its turn ended without one. */
|
|
489
417
|
readonly report: Schema.optionalKey<Schema.Struct<{
|
|
490
418
|
readonly state: Schema.Literals<readonly ["owed", "reported", "ended"]>;
|
|
491
419
|
readonly status: Schema.optionalKey<Schema.String>;
|
|
492
420
|
readonly progressed: Schema.Boolean;
|
|
493
421
|
}>>;
|
|
494
|
-
/** Its join group, and its standing there: `held`, `out`, how it left, or `released`. */
|
|
495
422
|
readonly group: Schema.optionalKey<Schema.Struct<{
|
|
496
423
|
readonly name: Schema.String;
|
|
497
424
|
readonly standing: Schema.String;
|
|
498
425
|
}>>;
|
|
499
426
|
readonly isolated: Schema.Boolean;
|
|
500
|
-
/** Set when it is OpenCode's subagent of its parent (a native child), which OpenCode's session lists leave out. */
|
|
501
427
|
readonly native: Schema.optionalKey<Schema.Boolean>;
|
|
502
|
-
|
|
428
|
+
readonly subagent: Schema.optionalKey<Schema.Boolean>;
|
|
503
429
|
readonly model: Schema.optionalKey<Schema.String>;
|
|
504
430
|
readonly created: Schema.Number;
|
|
505
|
-
/** When its last turn ended, if it is not running. */
|
|
506
431
|
readonly idle: Schema.optionalKey<Schema.Number>;
|
|
507
|
-
/** What it has cost so far, in US dollars. */
|
|
508
432
|
readonly cost: Schema.optionalKey<Schema.Number>;
|
|
509
|
-
/** How full its context is, as a fraction of the model's window; left out when the model or its limit cannot be read. */
|
|
510
433
|
readonly context: Schema.optionalKey<Schema.Number>;
|
|
511
|
-
/** Its last tool call, and when it was made. */
|
|
512
434
|
readonly tool: Schema.optionalKey<Schema.Struct<{
|
|
513
435
|
readonly name: Schema.String;
|
|
514
436
|
readonly at: Schema.Number;
|
|
@@ -525,50 +447,33 @@ export declare const treeRpc: {
|
|
|
525
447
|
readonly title: Schema.String;
|
|
526
448
|
}>]>>;
|
|
527
449
|
}>>;
|
|
528
|
-
/** The panel's own session, at depth 0; absent when OpenCode no longer knows it, and from an older server. */
|
|
529
450
|
readonly top: Schema.optionalKey<Schema.Struct<{
|
|
530
451
|
readonly sessionID: Schema.String;
|
|
531
452
|
readonly parentID: Schema.String;
|
|
532
453
|
readonly title: Schema.String;
|
|
533
|
-
/** A child of the panel's session is at depth 1. */
|
|
534
454
|
readonly depth: Schema.Int;
|
|
535
|
-
/**
|
|
536
|
-
* `waiting` on a request to the person or a form it shows them; `stalled` when a courier message waits in its inbox and
|
|
537
|
-
* waking it again did not start a turn; `gone` when OpenCode no longer knows it.
|
|
538
|
-
*/
|
|
539
455
|
readonly state: Schema.Literals<readonly ["running", "waiting", "idle", "stalled", "gone"]>;
|
|
540
|
-
/** Since when its oldest message that did not wake it has waited, when it is stalled. */
|
|
541
456
|
readonly stalled: Schema.optionalKey<Schema.Number>;
|
|
542
|
-
/** How its last turn ended. */
|
|
543
457
|
readonly outcome: Schema.optionalKey<Schema.Literals<readonly ["succeeded", "failed", "interrupted"]>>;
|
|
544
|
-
/** When the provider limit that failed its last turn lifts; left out once that has passed, or when it runs again or was stopped. */
|
|
545
458
|
readonly resumes: Schema.optionalKey<Schema.Number>;
|
|
546
|
-
/** Set when courier_stop stopped it since its last prompt. */
|
|
547
459
|
readonly stopped: Schema.optionalKey<Schema.Boolean>;
|
|
548
|
-
/** Its report since its last prompt: still owed, arrived (held with its group or delivered), or its turn ended without one. */
|
|
549
460
|
readonly report: Schema.optionalKey<Schema.Struct<{
|
|
550
461
|
readonly state: Schema.Literals<readonly ["owed", "reported", "ended"]>;
|
|
551
462
|
readonly status: Schema.optionalKey<Schema.String>;
|
|
552
463
|
readonly progressed: Schema.Boolean;
|
|
553
464
|
}>>;
|
|
554
|
-
/** Its join group, and its standing there: `held`, `out`, how it left, or `released`. */
|
|
555
465
|
readonly group: Schema.optionalKey<Schema.Struct<{
|
|
556
466
|
readonly name: Schema.String;
|
|
557
467
|
readonly standing: Schema.String;
|
|
558
468
|
}>>;
|
|
559
469
|
readonly isolated: Schema.Boolean;
|
|
560
|
-
/** Set when it is OpenCode's subagent of its parent (a native child), which OpenCode's session lists leave out. */
|
|
561
470
|
readonly native: Schema.optionalKey<Schema.Boolean>;
|
|
562
|
-
|
|
471
|
+
readonly subagent: Schema.optionalKey<Schema.Boolean>;
|
|
563
472
|
readonly model: Schema.optionalKey<Schema.String>;
|
|
564
473
|
readonly created: Schema.Number;
|
|
565
|
-
/** When its last turn ended, if it is not running. */
|
|
566
474
|
readonly idle: Schema.optionalKey<Schema.Number>;
|
|
567
|
-
/** What it has cost so far, in US dollars. */
|
|
568
475
|
readonly cost: Schema.optionalKey<Schema.Number>;
|
|
569
|
-
/** How full its context is, as a fraction of the model's window; left out when the model or its limit cannot be read. */
|
|
570
476
|
readonly context: Schema.optionalKey<Schema.Number>;
|
|
571
|
-
/** Its last tool call, and when it was made. */
|
|
572
477
|
readonly tool: Schema.optionalKey<Schema.Struct<{
|
|
573
478
|
readonly name: Schema.String;
|
|
574
479
|
readonly at: Schema.Number;
|
|
@@ -585,13 +490,10 @@ export declare const treeRpc: {
|
|
|
585
490
|
readonly title: Schema.String;
|
|
586
491
|
}>]>>;
|
|
587
492
|
}>>;
|
|
588
|
-
/** How many older sessions the listing left out, when it had more than `maxTotal`: the live ones come first, then the newest. */
|
|
589
493
|
readonly truncated: Schema.optionalKey<Schema.Int>;
|
|
590
|
-
/** Since when a courier message has waited in the panel's own session, when that session is stalled. */
|
|
591
494
|
readonly stalled: Schema.optionalKey<Schema.Number>;
|
|
592
495
|
}>;
|
|
593
496
|
};
|
|
594
|
-
/** Stops `sessionID` and everything under it, as courier_stop called from `by`, which must be above it. */
|
|
595
497
|
readonly stop: {
|
|
596
498
|
readonly input: import("effect/StandardSchema").StandardSchemaV1<{
|
|
597
499
|
readonly sessionID: string;
|
|
@@ -623,14 +525,12 @@ export declare const treeRpc: {
|
|
|
623
525
|
readonly title: Schema.String;
|
|
624
526
|
readonly outcome: Schema.String;
|
|
625
527
|
}>>;
|
|
626
|
-
/** How many scheduled messages were cancelled. */
|
|
627
528
|
readonly cancelled: Schema.Int;
|
|
628
529
|
}>;
|
|
629
530
|
readonly errors: {
|
|
630
531
|
readonly refused: import("effect/StandardSchema").StandardSchemaV1<{}, {}> & Schema.Struct<{}>;
|
|
631
532
|
};
|
|
632
533
|
};
|
|
633
|
-
/** Forgets `sessionID` as courier_cleanup called from its parent, without `force`; `by` must be above it. */
|
|
634
534
|
readonly cleanup: {
|
|
635
535
|
readonly input: import("effect/StandardSchema").StandardSchemaV1<{
|
|
636
536
|
readonly sessionID: string;
|
package/dist/tree/rpc.js
CHANGED
|
@@ -1,87 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
* The tree's RPC, the contract its TUI part and its server half share. Standard Schema values, so the promise
|
|
3
|
-
* API's `rpc.register` and the TUI's `client.rpc` both type it; imports only `@opencode/plugin/rpc` and `effect`.
|
|
4
|
-
*/
|
|
1
|
+
// rpc.register and client.rpc both take Standard Schema (api-notes)
|
|
5
2
|
import { Rpc } from "@opencode/plugin/rpc";
|
|
6
3
|
import { Schema } from "effect";
|
|
7
4
|
const Count = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
|
|
8
|
-
/** A join group the session opened, with how many of its members have reported and how many have not left. */
|
|
9
5
|
const Group = Schema.Struct({ name: Schema.String, reported: Count, members: Count });
|
|
10
|
-
/** The sessions started under a session, as the prompt footer's status entry shows them. */
|
|
11
6
|
const Summary = Schema.Struct({
|
|
12
|
-
/** Running, and waiting on no request or form. */
|
|
13
7
|
running: Count,
|
|
14
|
-
/** Waiting on a permission request, a question or a form it shows, which go to the person. */
|
|
15
8
|
waiting: Count,
|
|
16
|
-
/** Not running: done, or waiting for a message. */
|
|
17
9
|
idle: Count,
|
|
18
|
-
/** Left a courier message waiting while idle, and did not take it once woken again; the session itself counts too. Absent at 0. */
|
|
19
10
|
stalled: Schema.optionalKey(Count),
|
|
20
11
|
groups: Schema.Array(Group),
|
|
21
12
|
});
|
|
22
|
-
/** A request a session waits on until the person answers it: a permission request, its first question, or a form it shows. */
|
|
23
13
|
const Wait = Schema.Union([
|
|
24
14
|
Schema.Struct({ type: Schema.Literal("permission"), action: Schema.String, resources: Schema.Array(Schema.String) }),
|
|
25
15
|
Schema.Struct({ type: Schema.Literal("question"), question: Schema.String }),
|
|
26
16
|
Schema.Struct({ type: Schema.Literal("form"), title: Schema.String }),
|
|
27
17
|
]);
|
|
28
|
-
/** One session of the tree panel: what courier_tree shows of it, and what it is doing, in epoch milliseconds. */
|
|
29
18
|
const Row = Schema.Struct({
|
|
30
19
|
sessionID: Schema.String,
|
|
31
20
|
parentID: Schema.String,
|
|
32
21
|
title: Schema.String,
|
|
33
|
-
/** A child of the panel's session is at depth 1. */
|
|
34
22
|
depth: Count,
|
|
35
|
-
/**
|
|
36
|
-
* `waiting` on a request to the person or a form it shows them; `stalled` when a courier message waits in its inbox and
|
|
37
|
-
* waking it again did not start a turn; `gone` when OpenCode no longer knows it.
|
|
38
|
-
*/
|
|
39
23
|
state: Schema.Literals(["running", "waiting", "idle", "stalled", "gone"]),
|
|
40
|
-
/** Since when its oldest message that did not wake it has waited, when it is stalled. */
|
|
41
24
|
stalled: Schema.optionalKey(Schema.Number),
|
|
42
|
-
/** How its last turn ended. */
|
|
43
25
|
outcome: Schema.optionalKey(Schema.Literals(["succeeded", "failed", "interrupted"])),
|
|
44
|
-
/** When the provider limit that failed its last turn lifts; left out once that has passed, or when it runs again or was stopped. */
|
|
45
26
|
resumes: Schema.optionalKey(Schema.Number),
|
|
46
|
-
/** Set when courier_stop stopped it since its last prompt. */
|
|
47
27
|
stopped: Schema.optionalKey(Schema.Boolean),
|
|
48
|
-
/** Its report since its last prompt: still owed, arrived (held with its group or delivered), or its turn ended without one. */
|
|
49
28
|
report: Schema.optionalKey(Schema.Struct({ state: Schema.Literals(["owed", "reported", "ended"]), status: Schema.optionalKey(Schema.String), progressed: Schema.Boolean })),
|
|
50
|
-
/** Its join group, and its standing there: `held`, `out`, how it left, or `released`. */
|
|
51
29
|
group: Schema.optionalKey(Schema.Struct({ name: Schema.String, standing: Schema.String })),
|
|
52
30
|
isolated: Schema.Boolean,
|
|
53
|
-
/** Set when it is OpenCode's subagent of its parent (a native child), which OpenCode's session lists leave out. */
|
|
54
31
|
native: Schema.optionalKey(Schema.Boolean),
|
|
55
|
-
|
|
32
|
+
subagent: Schema.optionalKey(Schema.Boolean),
|
|
56
33
|
model: Schema.optionalKey(Schema.String),
|
|
57
34
|
created: Schema.Number,
|
|
58
|
-
/** When its last turn ended, if it is not running. */
|
|
59
35
|
idle: Schema.optionalKey(Schema.Number),
|
|
60
|
-
/** What it has cost so far, in US dollars. */
|
|
61
36
|
cost: Schema.optionalKey(Schema.Number),
|
|
62
|
-
/** How full its context is, as a fraction of the model's window; left out when the model or its limit cannot be read. */
|
|
63
37
|
context: Schema.optionalKey(Schema.Number),
|
|
64
|
-
/** Its last tool call, and when it was made. */
|
|
65
38
|
tool: Schema.optionalKey(Schema.Struct({ name: Schema.String, at: Schema.Number })),
|
|
66
39
|
waits: Schema.Array(Wait),
|
|
67
40
|
});
|
|
68
|
-
/** The sessions under a session, as courier_tree lists them, in the order a tree is drawn. */
|
|
69
41
|
const Tree = Schema.Struct({
|
|
70
42
|
rows: Schema.Array(Row),
|
|
71
|
-
/** The panel's own session, at depth 0; absent when OpenCode no longer knows it, and from an older server. */
|
|
72
43
|
top: Schema.optionalKey(Row),
|
|
73
|
-
/** How many older sessions the listing left out, when it had more than `maxTotal`: the live ones come first, then the newest. */
|
|
74
44
|
truncated: Schema.optionalKey(Count),
|
|
75
|
-
/** Since when a courier message has waited in the panel's own session, when that session is stalled. */
|
|
76
45
|
stalled: Schema.optionalKey(Schema.Number),
|
|
77
46
|
});
|
|
78
|
-
/** What a stop did to each session, deepest first, as courier_stop reports it. */
|
|
79
47
|
const Stopped = Schema.Struct({
|
|
80
48
|
stopped: Schema.Array(Schema.Struct({ sessionID: Schema.String, title: Schema.String, outcome: Schema.String })),
|
|
81
|
-
/** How many scheduled messages were cancelled. */
|
|
82
49
|
cancelled: Count,
|
|
83
50
|
});
|
|
84
|
-
/** What courier_cleanup did: forgot it, removed its worktree, found that already gone, or kept the worktree, saying why. */
|
|
85
51
|
const Forgotten = Schema.Union([
|
|
86
52
|
Schema.Struct({ outcome: Schema.Literals(["forgotten", "removed", "gone"]) }),
|
|
87
53
|
Schema.Struct({ outcome: Schema.Literal("kept"), reason: Schema.String }),
|
|
@@ -97,13 +63,11 @@ export const treeRpc = Rpc.define({
|
|
|
97
63
|
input: Schema.toStandardSchemaV1(Schema.Struct({ sessionID: Schema.String })),
|
|
98
64
|
output: Schema.toStandardSchemaV1(Tree),
|
|
99
65
|
},
|
|
100
|
-
/** Stops `sessionID` and everything under it, as courier_stop called from `by`, which must be above it. */
|
|
101
66
|
stop: {
|
|
102
67
|
input: Schema.toStandardSchemaV1(Schema.Struct({ sessionID: Schema.String, by: Schema.String })),
|
|
103
68
|
output: Schema.toStandardSchemaV1(Stopped),
|
|
104
69
|
errors: { refused: Schema.toStandardSchemaV1(Schema.Struct({})) },
|
|
105
70
|
},
|
|
106
|
-
/** Forgets `sessionID` as courier_cleanup called from its parent, without `force`; `by` must be above it. */
|
|
107
71
|
cleanup: {
|
|
108
72
|
input: Schema.toStandardSchemaV1(Schema.Struct({ sessionID: Schema.String, by: Schema.String })),
|
|
109
73
|
output: Schema.toStandardSchemaV1(Forgotten),
|
package/dist/tree/running.d.ts
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import type { Plugin } from "@opencode/plugin";
|
|
2
2
|
import { type BusyTimes } from "./domain.js";
|
|
3
3
|
type Session = Pick<Plugin.Context["session"], "context">;
|
|
4
|
-
/** Whether a session runs and, when it does not, when its last turn ended, where known. */
|
|
5
4
|
export interface Turn {
|
|
6
5
|
readonly running: boolean;
|
|
7
6
|
readonly endedAt?: number;
|
|
8
7
|
}
|
|
9
8
|
type Messages = Awaited<ReturnType<Session["context"]>>;
|
|
10
|
-
/**
|
|
11
|
-
* Whether a session runs and, at rest, when its last turn ended: by its times when they show rest, else by its transcript
|
|
12
|
-
* (#324, #326), kept until the next stamp, a rest for `REST_MS` and not within `FRESH_MS` of it; one unread or empty runs.
|
|
13
|
-
*/
|
|
14
9
|
export declare function turnOf(session: Session, sessionID: string, time: BusyTimes, now?: number): Promise<Turn>;
|
|
15
|
-
/** `turnOf` for a caller that reads the transcript itself: it answers from these `messages`, read just now, and keeps the answer. */
|
|
16
10
|
export declare function turnIn(session: Session, sessionID: string, time: BusyTimes, messages: Promise<Messages>, now?: number): Promise<Turn>;
|
|
17
11
|
export declare const runs: (session: Session, sessionID: string, time: BusyTimes, now?: number) => Promise<boolean>;
|
|
18
12
|
export {};
|
package/dist/tree/running.js
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
import { millis } from "../platform/json.js";
|
|
2
2
|
import { setBounded } from "../platform/bounded.js";
|
|
3
3
|
import { busy, endedAt, turnEnd } from "./domain.js";
|
|
4
|
-
/** How many sessions' answers each session port remembers. */
|
|
5
4
|
const ANSWERS_MAX = 500;
|
|
6
|
-
|
|
5
|
+
// a delivered item stamps nothing until its first step (api-notes)
|
|
7
6
|
const FRESH_MS = 10_000;
|
|
8
|
-
|
|
7
|
+
// a re-sent wake's delivery stamps nothing until its step (api-notes)
|
|
9
8
|
const REST_MS = 30_000;
|
|
10
9
|
const RUNNING = { running: true };
|
|
11
10
|
const rest = (at) => (at === undefined ? { running: false } : { running: false, endedAt: at });
|
|
12
|
-
/** Each session port's last answer per session, which holds until the next stamp, but for those `turnOf` drops or keeps `until`. */
|
|
13
11
|
const answers = new WeakMap();
|
|
14
|
-
/**
|
|
15
|
-
* Whether a session runs and, at rest, when its last turn ended: by its times when they show rest, else by its transcript
|
|
16
|
-
* (#324, #326), kept until the next stamp, a rest for `REST_MS` and not within `FRESH_MS` of it; one unread or empty runs.
|
|
17
|
-
*/
|
|
18
12
|
export function turnOf(session, sessionID, time, now = Date.now()) {
|
|
19
13
|
return resolve(session, sessionID, time, now, () => session.context({ sessionID }), true);
|
|
20
14
|
}
|
|
21
|
-
/** `turnOf` for a caller that reads the transcript itself: it answers from these `messages`, read just now, and keeps the answer. */
|
|
22
15
|
export function turnIn(session, sessionID, time, messages, now = Date.now()) {
|
|
23
16
|
return resolve(session, sessionID, time, now, () => messages, false);
|
|
24
17
|
}
|
|
@@ -31,7 +24,6 @@ function resolve(session, sessionID, time, now, load, cached) {
|
|
|
31
24
|
const found = known.get(sessionID);
|
|
32
25
|
if (cached && found?.stamp === stamp && now < found.until)
|
|
33
26
|
return found.turn;
|
|
34
|
-
// Only its own answer: a newer read of the session may have taken its place meanwhile.
|
|
35
27
|
const forget = () => {
|
|
36
28
|
if (known.get(sessionID) === answer)
|
|
37
29
|
known.delete(sessionID);
|
package/dist/tree/send.d.ts
CHANGED
|
@@ -7,8 +7,4 @@ export interface SendInput {
|
|
|
7
7
|
readonly artifacts?: Artifacts;
|
|
8
8
|
readonly queue?: boolean;
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Drops a message into another session's inbox; OpenCode wakes that session if it is idle. From a spawned session
|
|
12
|
-
* to the one that started it, it is its report or its progress (`noteReport`); a group member's final report is held (`hold`).
|
|
13
|
-
*/
|
|
14
10
|
export declare function send(ports: CourierPorts, from: string, input: SendInput): Promise<Sent>;
|