toolroll 0.9.36 → 0.9.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -0
- package/dist/assignment-adapters.d.ts +12 -48
- package/dist/assignment-adapters.js +33 -43
- package/dist/build-review.d.ts +1 -1
- package/dist/build-review.js +2 -1
- package/dist/chat-acceptance.d.ts +1 -1
- package/dist/chat-actions.d.ts +18 -12
- package/dist/chat-actions.js +15 -65
- package/dist/chat-ask.js +5 -5
- package/dist/chat-decide.d.ts +14 -1
- package/dist/chat-decide.js +12 -6
- package/dist/chat-delivery-state.d.ts +12 -70
- package/dist/chat-delivery-state.js +17 -135
- package/dist/chat-delivery.js +58 -30
- package/dist/chat-flow.js +8 -6
- package/dist/chat-inbox.js +1 -1
- package/dist/coding-context.d.ts +2 -39
- package/dist/coding-context.js +2 -1
- package/dist/coding-handoff.d.ts +6 -25
- package/dist/coding-handoff.js +11 -5
- package/dist/coding-types.d.ts +2 -26
- package/dist/coding-workspace.d.ts +2 -0
- package/dist/coding-workspace.js +50 -14
- package/dist/contracts/acceptance-terms.d.ts +14 -0
- package/dist/contracts/acceptance-terms.js +16 -0
- package/dist/contracts/chat-actions.d.ts +328 -0
- package/dist/contracts/chat-actions.js +133 -0
- package/dist/contracts/chat-callback-rows.d.ts +59 -0
- package/dist/contracts/chat-callback-rows.js +46 -0
- package/dist/contracts/chat-content.d.ts +276 -0
- package/dist/contracts/chat-content.js +127 -0
- package/dist/contracts/chat-tables.d.ts +6 -0
- package/dist/contracts/chat-tables.js +136 -0
- package/dist/contracts/coding-context.d.ts +97 -0
- package/dist/contracts/coding-context.js +60 -0
- package/dist/contracts/coding-handoff.d.ts +44 -0
- package/dist/contracts/coding-handoff.js +47 -0
- package/dist/contracts/coding-workspace.d.ts +165 -0
- package/dist/contracts/coding-workspace.js +71 -0
- package/dist/contracts/contract.d.ts +7 -2
- package/dist/contracts/contract.js +21 -12
- package/dist/contracts/decision.d.ts +45 -0
- package/dist/contracts/decision.js +45 -0
- package/dist/contracts/discord-callback.d.ts +45 -0
- package/dist/contracts/discord-callback.js +34 -0
- package/dist/contracts/flow-card.d.ts +50 -0
- package/dist/contracts/flow-card.js +46 -0
- package/dist/contracts/flow-send.d.ts +119 -0
- package/dist/contracts/flow-send.js +112 -0
- package/dist/contracts/flow.d.ts +5 -0
- package/dist/contracts/flow.js +5 -0
- package/dist/contracts/gateway-tools.d.ts +374 -0
- package/dist/contracts/gateway-tools.js +94 -0
- package/dist/contracts/lead-context.d.ts +165 -0
- package/dist/contracts/lead-context.js +73 -0
- package/dist/contracts/lead-tools.d.ts +1905 -0
- package/dist/contracts/lead-tools.js +265 -0
- package/dist/contracts/memory-pass.d.ts +158 -0
- package/dist/contracts/memory-pass.js +102 -0
- package/dist/contracts/project-knowledge.d.ts +126 -0
- package/dist/contracts/project-knowledge.js +93 -0
- package/dist/contracts/project-memory.d.ts +117 -0
- package/dist/contracts/project-memory.js +51 -0
- package/dist/contracts/project-skills.d.ts +121 -0
- package/dist/contracts/project-skills.js +76 -0
- package/dist/contracts/review-findings.d.ts +46 -0
- package/dist/contracts/review-findings.js +48 -0
- package/dist/contracts/route.d.ts +484 -0
- package/dist/contracts/route.js +128 -0
- package/dist/contracts/scope.d.ts +105 -0
- package/dist/contracts/scope.js +114 -0
- package/dist/contracts/scout-report.d.ts +234 -0
- package/dist/contracts/scout-report.js +141 -0
- package/dist/contracts/slack-callback.d.ts +43 -0
- package/dist/contracts/slack-callback.js +35 -0
- package/dist/contracts/sort-answer.d.ts +83 -0
- package/dist/contracts/sort-answer.js +77 -0
- package/dist/contracts/stage-output.d.ts +127 -0
- package/dist/contracts/stage-output.js +166 -0
- package/dist/contracts/task-sizing.d.ts +24 -0
- package/dist/contracts/task-sizing.js +28 -0
- package/dist/contracts/teammate-turn.d.ts +43 -0
- package/dist/contracts/teammate-turn.js +51 -0
- package/dist/contracts/teams-callback.d.ts +14 -0
- package/dist/contracts/teams-callback.js +14 -0
- package/dist/contracts/telegram-callback.d.ts +120 -0
- package/dist/contracts/telegram-callback.js +97 -0
- package/dist/decision.d.ts +11 -20
- package/dist/decision.js +86 -167
- package/dist/desktop-update.d.ts +2 -2
- package/dist/discord-chat.js +31 -20
- package/dist/flow-engine.js +14 -17
- package/dist/flow-items.d.ts +4 -13
- package/dist/flow-items.js +1 -15
- package/dist/flow-send.d.ts +6 -37
- package/dist/flow-send.js +18 -14
- package/dist/flow-share.js +7 -1
- package/dist/flow-sort.d.ts +7 -26
- package/dist/flow-sort.js +25 -20
- package/dist/flow-steps.js +3 -2
- package/dist/flows.d.ts +2 -4
- package/dist/flows.js +9 -5
- package/dist/invoke.js +4 -4
- package/dist/lead-context.d.ts +4 -2
- package/dist/lead-context.js +24 -17
- package/dist/mate-tools.d.ts +4 -0
- package/dist/mate-tools.js +108 -275
- package/dist/mcp-connect.d.ts +24 -4
- package/dist/mcp-connect.js +78 -15
- package/dist/mcp.js +84 -216
- package/dist/memory-pass.d.ts +17 -42
- package/dist/memory-pass.js +54 -26
- package/dist/phase-routing.d.ts +19 -72
- package/dist/phase-routing.js +34 -164
- package/dist/project-knowledge.d.ts +16 -35
- package/dist/project-knowledge.js +42 -21
- package/dist/project-memory.d.ts +2 -28
- package/dist/project-memory.js +28 -13
- package/dist/project-skills.d.ts +16 -38
- package/dist/project-skills.js +41 -32
- package/dist/project-tools.d.ts +1 -0
- package/dist/project-tools.js +4 -4
- package/dist/provider.d.ts +2 -0
- package/dist/provider.js +4 -16
- package/dist/result-shots.d.ts +1 -1
- package/dist/result-shots.js +2 -1
- package/dist/review-switch.d.ts +3 -8
- package/dist/reviewer.d.ts +8 -12
- package/dist/reviewer.js +11 -35
- package/dist/scope.d.ts +21 -43
- package/dist/scope.js +42 -128
- package/dist/scout-report.d.ts +9 -194
- package/dist/scout-report.js +113 -264
- package/dist/scout.js +15 -11
- package/dist/serve.js +9 -2
- package/dist/setup-guide.d.ts +2 -2
- package/dist/slack-chat.js +26 -20
- package/dist/slack-state.js +2 -1
- package/dist/store.d.ts +9 -32
- package/dist/store.js +18 -15
- package/dist/structured-output.js +2 -1
- package/dist/subscription-chat.d.ts +4 -0
- package/dist/subscription-chat.js +4 -1
- package/dist/task-review-brief.d.ts +1 -7
- package/dist/task-review-brief.js +6 -6
- package/dist/task-sizing.d.ts +3 -27
- package/dist/task-sizing.js +11 -26
- package/dist/task-text.d.ts +0 -5
- package/dist/task-text.js +1 -3
- package/dist/teammate-question.js +7 -5
- package/dist/teammate-work.js +9 -5
- package/dist/teammates.d.ts +13 -64
- package/dist/teammates.js +32 -33
- package/dist/teams-chat.js +20 -11
- package/dist/telegram-flow.js +4 -3
- package/dist/telegram-mate.d.ts +4 -14
- package/dist/telegram-mate.js +8 -7
- package/dist/telegram-team.d.ts +2 -19
- package/dist/telegram.d.ts +1 -1
- package/dist/telegram.js +52 -42
- package/dist/text-limits.d.ts +142 -1
- package/dist/text-limits.js +144 -1
- package/dist/tools-ui.d.ts +2 -1
- package/dist/tools-ui.js +7 -4
- package/package.json +1 -1
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared chat actions (chat-actions.ts): one schema for each action's data — what the lead proposes and what a saved
|
|
3
|
+
* proposal carries after `prepareSharedAction` has checked and rewritten it — and one for the saved proposal itself.
|
|
4
|
+
* The allowed fields (`CHAT_ACTION_FIELDS`) and the request types are derived from these; what JSON Schema can't say
|
|
5
|
+
* (credentials and control characters in text, each field's length, a zone or option that exists, who may act) runs
|
|
6
|
+
* in `prepareSharedAction` after parsing, with its own named refusal.
|
|
7
|
+
*
|
|
8
|
+
* A flow drawing, trigger or script inside a request is read by its own contract (flows.ts `validateFlowDefinition`,
|
|
9
|
+
* flow-triggers.ts `validateTriggerConfig`, flow-scripts.ts `validateScript`) when the action is prepared, in every
|
|
10
|
+
* vocabulary those accept; here it is only "a value".
|
|
11
|
+
*/
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { type ContractResult } from "./contract.js";
|
|
14
|
+
/**
|
|
15
|
+
* Each action's data, field order as the lead reads it in `get_actions`. Fields a branch ignores or reads through
|
|
16
|
+
* its own validator stay unknown: 0.9.36 accepted null and other non-string values there. Preparation still checks
|
|
17
|
+
* the selected branch and saves the same request bytes. No schema defaults or coercion may change its stamp.
|
|
18
|
+
*/
|
|
19
|
+
export declare const chatActionRequestSchemas: {
|
|
20
|
+
readonly skill_import: z.ZodObject<{
|
|
21
|
+
repo: z.ZodString;
|
|
22
|
+
content: z.ZodOptional<z.ZodString>;
|
|
23
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
24
|
+
path: z.ZodString;
|
|
25
|
+
base64: z.ZodString;
|
|
26
|
+
}, z.core.$strict>>>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
readonly skill_enable: z.ZodObject<{
|
|
29
|
+
repo: z.ZodString;
|
|
30
|
+
version: z.ZodString;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
readonly skill_disable: z.ZodObject<{
|
|
33
|
+
repo: z.ZodString;
|
|
34
|
+
version: z.ZodString;
|
|
35
|
+
}, z.core.$strict>;
|
|
36
|
+
readonly skill_restore: z.ZodObject<{
|
|
37
|
+
repo: z.ZodString;
|
|
38
|
+
restore: z.ZodInt;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
readonly skill_test: z.ZodObject<{
|
|
41
|
+
repo: z.ZodString;
|
|
42
|
+
version: z.ZodString;
|
|
43
|
+
sample: z.ZodString;
|
|
44
|
+
nonce: z.ZodString;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
readonly knowledge_instructions: z.ZodObject<{
|
|
47
|
+
repo: z.ZodString;
|
|
48
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
readonly knowledge_save: z.ZodObject<{
|
|
51
|
+
repo: z.ZodString;
|
|
52
|
+
title: z.ZodString;
|
|
53
|
+
content: z.ZodString;
|
|
54
|
+
id: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
readonly knowledge_remove: z.ZodObject<{
|
|
57
|
+
repo: z.ZodString;
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
}, z.core.$strict>;
|
|
60
|
+
readonly knowledge_restore: z.ZodObject<{
|
|
61
|
+
repo: z.ZodString;
|
|
62
|
+
restore: z.ZodInt;
|
|
63
|
+
}, z.core.$strict>;
|
|
64
|
+
readonly tool_add: z.ZodObject<{
|
|
65
|
+
repo: z.ZodString;
|
|
66
|
+
catalog: z.ZodOptional<z.ZodUnknown>;
|
|
67
|
+
name: z.ZodOptional<z.ZodUnknown>;
|
|
68
|
+
command: z.ZodOptional<z.ZodUnknown>;
|
|
69
|
+
args: z.ZodOptional<z.ZodUnknown>;
|
|
70
|
+
url: z.ZodOptional<z.ZodUnknown>;
|
|
71
|
+
secrets: z.ZodOptional<z.ZodUnknown>;
|
|
72
|
+
about: z.ZodOptional<z.ZodUnknown>;
|
|
73
|
+
}, z.core.$strict>;
|
|
74
|
+
readonly tool_remove: z.ZodObject<{
|
|
75
|
+
repo: z.ZodString;
|
|
76
|
+
name: z.ZodString;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
readonly flow_create: z.ZodObject<{
|
|
79
|
+
repo: z.ZodString;
|
|
80
|
+
name: z.ZodString;
|
|
81
|
+
definition: z.ZodUnknown;
|
|
82
|
+
trigger: z.ZodOptional<z.ZodUnknown>;
|
|
83
|
+
}, z.core.$strict>;
|
|
84
|
+
readonly flow_starter: z.ZodObject<{
|
|
85
|
+
repo: z.ZodString;
|
|
86
|
+
starter: z.ZodString;
|
|
87
|
+
}, z.core.$strict>;
|
|
88
|
+
readonly flow_edit: z.ZodObject<{
|
|
89
|
+
flow: z.ZodInt;
|
|
90
|
+
name: z.ZodOptional<z.ZodString>;
|
|
91
|
+
definition: z.ZodOptional<z.ZodUnknown>;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
readonly flow_card_add: z.ZodObject<{
|
|
94
|
+
flow: z.ZodInt;
|
|
95
|
+
title: z.ZodString;
|
|
96
|
+
description: z.ZodOptional<z.ZodUnknown>;
|
|
97
|
+
zone: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strict>;
|
|
99
|
+
readonly flow_card_move: z.ZodObject<{
|
|
100
|
+
card: z.ZodInt;
|
|
101
|
+
zone: z.ZodString;
|
|
102
|
+
}, z.core.$strict>;
|
|
103
|
+
readonly flow_card_approve: z.ZodObject<{
|
|
104
|
+
card: z.ZodInt;
|
|
105
|
+
note: z.ZodOptional<z.ZodString>;
|
|
106
|
+
}, z.core.$strict>;
|
|
107
|
+
readonly flow_card_send_back: z.ZodObject<{
|
|
108
|
+
card: z.ZodInt;
|
|
109
|
+
note: z.ZodOptional<z.ZodString>;
|
|
110
|
+
}, z.core.$strict>;
|
|
111
|
+
/** An option by its number (from 1), or a reply that becomes the note. */
|
|
112
|
+
readonly flow_card_choose: z.ZodObject<{
|
|
113
|
+
card: z.ZodInt;
|
|
114
|
+
choice: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
115
|
+
note: z.ZodOptional<z.ZodUnknown>;
|
|
116
|
+
}, z.core.$strict>;
|
|
117
|
+
readonly flow_card_cancel: z.ZodObject<{
|
|
118
|
+
card: z.ZodInt;
|
|
119
|
+
}, z.core.$strict>;
|
|
120
|
+
readonly flow_card_comment: z.ZodObject<{
|
|
121
|
+
card: z.ZodInt;
|
|
122
|
+
note: z.ZodString;
|
|
123
|
+
}, z.core.$strict>;
|
|
124
|
+
readonly flow_card_assign: z.ZodObject<{
|
|
125
|
+
card: z.ZodInt;
|
|
126
|
+
owner: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
127
|
+
}, z.core.$strict>;
|
|
128
|
+
readonly flow_card_watch: z.ZodObject<{
|
|
129
|
+
card: z.ZodInt;
|
|
130
|
+
watching: z.ZodOptional<z.ZodUnknown>;
|
|
131
|
+
}, z.core.$strict>;
|
|
132
|
+
readonly flow_script_save: z.ZodObject<{
|
|
133
|
+
repo: z.ZodString;
|
|
134
|
+
script: z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>;
|
|
135
|
+
}, z.core.$strict>;
|
|
136
|
+
readonly flow_trigger_add: z.ZodObject<{
|
|
137
|
+
flow: z.ZodInt;
|
|
138
|
+
trigger: z.ZodUnknown;
|
|
139
|
+
}, z.core.$strict>;
|
|
140
|
+
readonly flow_trigger_pause: z.ZodObject<{
|
|
141
|
+
trigger: z.ZodInt;
|
|
142
|
+
}, z.core.$strict>;
|
|
143
|
+
readonly flow_trigger_resume: z.ZodObject<{
|
|
144
|
+
trigger: z.ZodInt;
|
|
145
|
+
}, z.core.$strict>;
|
|
146
|
+
readonly flow_trigger_remove: z.ZodObject<{
|
|
147
|
+
trigger: z.ZodInt;
|
|
148
|
+
}, z.core.$strict>;
|
|
149
|
+
readonly teammate_create: z.ZodObject<{
|
|
150
|
+
repo: z.ZodString;
|
|
151
|
+
template: z.ZodOptional<z.ZodUnknown>;
|
|
152
|
+
name: z.ZodOptional<z.ZodUnknown>;
|
|
153
|
+
soul: z.ZodOptional<z.ZodUnknown>;
|
|
154
|
+
}, z.core.$strict>;
|
|
155
|
+
readonly teammate_soul: z.ZodObject<{
|
|
156
|
+
teammate: z.ZodInt;
|
|
157
|
+
soul: z.ZodString;
|
|
158
|
+
}, z.core.$strict>;
|
|
159
|
+
readonly teammate_state: z.ZodObject<{
|
|
160
|
+
teammate: z.ZodInt;
|
|
161
|
+
state: z.ZodEnum<{
|
|
162
|
+
active: "active";
|
|
163
|
+
paused: "paused";
|
|
164
|
+
removed: "removed";
|
|
165
|
+
}>;
|
|
166
|
+
}, z.core.$strict>;
|
|
167
|
+
readonly teammate_note: z.ZodObject<{
|
|
168
|
+
teammate: z.ZodInt;
|
|
169
|
+
note: z.ZodString;
|
|
170
|
+
}, z.core.$strict>;
|
|
171
|
+
readonly teammate_answer: z.ZodObject<{
|
|
172
|
+
question: z.ZodInt;
|
|
173
|
+
choice: z.ZodOptional<z.ZodUnknown>;
|
|
174
|
+
text: z.ZodOptional<z.ZodUnknown>;
|
|
175
|
+
}, z.core.$strict>;
|
|
176
|
+
readonly teammate_tools: z.ZodObject<{
|
|
177
|
+
teammate: z.ZodInt;
|
|
178
|
+
tool: z.ZodString;
|
|
179
|
+
change: z.ZodEnum<{
|
|
180
|
+
grant: "grant";
|
|
181
|
+
revoke: "revoke";
|
|
182
|
+
rule: "rule";
|
|
183
|
+
}>;
|
|
184
|
+
action: z.ZodOptional<z.ZodUnknown>;
|
|
185
|
+
use: z.ZodOptional<z.ZodUnknown>;
|
|
186
|
+
limitField: z.ZodOptional<z.ZodUnknown>;
|
|
187
|
+
limitOver: z.ZodOptional<z.ZodUnknown>;
|
|
188
|
+
undoWith: z.ZodOptional<z.ZodUnknown>;
|
|
189
|
+
}, z.core.$strict>;
|
|
190
|
+
readonly teammate_memory: z.ZodObject<{
|
|
191
|
+
teammate: z.ZodInt;
|
|
192
|
+
memory: z.ZodInt;
|
|
193
|
+
change: z.ZodEnum<{
|
|
194
|
+
edit: "edit";
|
|
195
|
+
forget: "forget";
|
|
196
|
+
}>;
|
|
197
|
+
text: z.ZodOptional<z.ZodUnknown>;
|
|
198
|
+
}, z.core.$strict>;
|
|
199
|
+
readonly teammate_routine: z.ZodObject<{
|
|
200
|
+
teammate: z.ZodInt;
|
|
201
|
+
change: z.ZodEnum<{
|
|
202
|
+
add: "add";
|
|
203
|
+
remove: "remove";
|
|
204
|
+
}>;
|
|
205
|
+
routine: z.ZodOptional<z.ZodUnknown>;
|
|
206
|
+
schedule: z.ZodOptional<z.ZodUnknown>;
|
|
207
|
+
text: z.ZodOptional<z.ZodUnknown>;
|
|
208
|
+
}, z.core.$strict>;
|
|
209
|
+
readonly teammate_undo: z.ZodObject<{
|
|
210
|
+
teammate: z.ZodInt;
|
|
211
|
+
call: z.ZodInt;
|
|
212
|
+
}, z.core.$strict>;
|
|
213
|
+
readonly kit_setup: z.ZodObject<{
|
|
214
|
+
repo: z.ZodString;
|
|
215
|
+
kit: z.ZodString;
|
|
216
|
+
}, z.core.$strict>;
|
|
217
|
+
readonly decision_record: z.ZodObject<{
|
|
218
|
+
repo: z.ZodString;
|
|
219
|
+
claim: z.ZodString;
|
|
220
|
+
why: z.ZodString;
|
|
221
|
+
supersedes: z.ZodOptional<z.ZodInt>;
|
|
222
|
+
source: z.ZodOptional<z.ZodString>;
|
|
223
|
+
}, z.core.$strict>;
|
|
224
|
+
readonly decision_retire: z.ZodObject<{
|
|
225
|
+
repo: z.ZodString;
|
|
226
|
+
decision: z.ZodInt;
|
|
227
|
+
reason: z.ZodString;
|
|
228
|
+
}, z.core.$strict>;
|
|
229
|
+
/** The line, and (from 1) the line it replaces; 0 or none adds it. */
|
|
230
|
+
readonly lead_about_you: z.ZodObject<{
|
|
231
|
+
line: z.ZodString;
|
|
232
|
+
replaces: z.ZodOptional<z.ZodInt>;
|
|
233
|
+
}, z.core.$strict>;
|
|
234
|
+
readonly scope_approve: z.ZodObject<{
|
|
235
|
+
task: z.ZodString;
|
|
236
|
+
}, z.core.$strict>;
|
|
237
|
+
readonly result_accept: z.ZodObject<{
|
|
238
|
+
task: z.ZodString;
|
|
239
|
+
run: z.ZodInt;
|
|
240
|
+
}, z.core.$strict>;
|
|
241
|
+
readonly task_cancel: z.ZodObject<{
|
|
242
|
+
task: z.ZodString;
|
|
243
|
+
}, z.core.$strict>;
|
|
244
|
+
readonly task_resume: z.ZodObject<{
|
|
245
|
+
task: z.ZodString;
|
|
246
|
+
run: z.ZodInt;
|
|
247
|
+
}, z.core.$strict>;
|
|
248
|
+
};
|
|
249
|
+
export type ChatActionOperation = keyof typeof chatActionRequestSchemas;
|
|
250
|
+
export declare const CHAT_ACTION_OPERATIONS: [ChatActionOperation, ...ChatActionOperation[]];
|
|
251
|
+
export type ChatActionRequest<O extends ChatActionOperation = ChatActionOperation> = z.infer<(typeof chatActionRequestSchemas)[O]>;
|
|
252
|
+
/** The fields each action takes, from its schema. */
|
|
253
|
+
export declare const CHAT_ACTION_FIELDS: Record<ChatActionOperation, readonly string[]>;
|
|
254
|
+
/** One action's data, refused by path (`card: required`, `payload: unknown key 'cards' (did you mean card?)`). */
|
|
255
|
+
export declare function readChatActionRequest(operation: ChatActionOperation, input: unknown): ContractResult<Record<string, unknown>>;
|
|
256
|
+
export declare const SHARED_ACTION_VERSION = 1;
|
|
257
|
+
/**
|
|
258
|
+
* A prepared action as a proposal saves it: the action, its checked request, the project, the card's title and
|
|
259
|
+
* terms, the stamp that proves nothing changed before it is confirmed, and the state the stamp was taken over (each
|
|
260
|
+
* action's own staleness fence, read back only by that action).
|
|
261
|
+
*/
|
|
262
|
+
export declare const sharedActionSchema: z.ZodObject<{
|
|
263
|
+
version: z.ZodLiteral<1>;
|
|
264
|
+
operation: z.ZodEnum<{
|
|
265
|
+
decision_record: "decision_record";
|
|
266
|
+
decision_retire: "decision_retire";
|
|
267
|
+
flow_card_add: "flow_card_add";
|
|
268
|
+
flow_card_approve: "flow_card_approve";
|
|
269
|
+
flow_card_assign: "flow_card_assign";
|
|
270
|
+
flow_card_cancel: "flow_card_cancel";
|
|
271
|
+
flow_card_choose: "flow_card_choose";
|
|
272
|
+
flow_card_comment: "flow_card_comment";
|
|
273
|
+
flow_card_move: "flow_card_move";
|
|
274
|
+
flow_card_send_back: "flow_card_send_back";
|
|
275
|
+
flow_card_watch: "flow_card_watch";
|
|
276
|
+
flow_create: "flow_create";
|
|
277
|
+
flow_edit: "flow_edit";
|
|
278
|
+
flow_script_save: "flow_script_save";
|
|
279
|
+
flow_starter: "flow_starter";
|
|
280
|
+
flow_trigger_add: "flow_trigger_add";
|
|
281
|
+
flow_trigger_pause: "flow_trigger_pause";
|
|
282
|
+
flow_trigger_remove: "flow_trigger_remove";
|
|
283
|
+
flow_trigger_resume: "flow_trigger_resume";
|
|
284
|
+
kit_setup: "kit_setup";
|
|
285
|
+
knowledge_instructions: "knowledge_instructions";
|
|
286
|
+
knowledge_remove: "knowledge_remove";
|
|
287
|
+
knowledge_restore: "knowledge_restore";
|
|
288
|
+
knowledge_save: "knowledge_save";
|
|
289
|
+
lead_about_you: "lead_about_you";
|
|
290
|
+
result_accept: "result_accept";
|
|
291
|
+
scope_approve: "scope_approve";
|
|
292
|
+
skill_disable: "skill_disable";
|
|
293
|
+
skill_enable: "skill_enable";
|
|
294
|
+
skill_import: "skill_import";
|
|
295
|
+
skill_restore: "skill_restore";
|
|
296
|
+
skill_test: "skill_test";
|
|
297
|
+
task_cancel: "task_cancel";
|
|
298
|
+
task_resume: "task_resume";
|
|
299
|
+
teammate_answer: "teammate_answer";
|
|
300
|
+
teammate_create: "teammate_create";
|
|
301
|
+
teammate_memory: "teammate_memory";
|
|
302
|
+
teammate_note: "teammate_note";
|
|
303
|
+
teammate_routine: "teammate_routine";
|
|
304
|
+
teammate_soul: "teammate_soul";
|
|
305
|
+
teammate_state: "teammate_state";
|
|
306
|
+
teammate_tools: "teammate_tools";
|
|
307
|
+
teammate_undo: "teammate_undo";
|
|
308
|
+
tool_add: "tool_add";
|
|
309
|
+
tool_remove: "tool_remove";
|
|
310
|
+
}>;
|
|
311
|
+
request: z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>;
|
|
312
|
+
repo: z.ZodString;
|
|
313
|
+
title: z.ZodString;
|
|
314
|
+
terms: z.ZodArray<z.ZodString>;
|
|
315
|
+
stamp: z.ZodString;
|
|
316
|
+
state: z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>;
|
|
317
|
+
}, z.core.$strict>;
|
|
318
|
+
export type SharedAction = z.infer<typeof sharedActionSchema>;
|
|
319
|
+
/**
|
|
320
|
+
* A proposal saved before it carried `version` (every one through 0.9.36), as version 1. Its reader took the fields
|
|
321
|
+
* it knew and passed any others through unread, so this keeps exactly the known fields.
|
|
322
|
+
*/
|
|
323
|
+
export declare function upgradeUnversionedSharedAction(body: Record<string, unknown>): Record<string, unknown>;
|
|
324
|
+
export declare const SHARED_ACTION_UPGRADES: {
|
|
325
|
+
readonly 0: typeof upgradeUnversionedSharedAction;
|
|
326
|
+
};
|
|
327
|
+
/** Legacy readers checked only the envelope. Confirmation still prepares the request again before acting. */
|
|
328
|
+
export declare function readSharedAction(input: unknown): ContractResult<SharedAction>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared chat actions (chat-actions.ts): one schema for each action's data — what the lead proposes and what a saved
|
|
3
|
+
* proposal carries after `prepareSharedAction` has checked and rewritten it — and one for the saved proposal itself.
|
|
4
|
+
* The allowed fields (`CHAT_ACTION_FIELDS`) and the request types are derived from these; what JSON Schema can't say
|
|
5
|
+
* (credentials and control characters in text, each field's length, a zone or option that exists, who may act) runs
|
|
6
|
+
* in `prepareSharedAction` after parsing, with its own named refusal.
|
|
7
|
+
*
|
|
8
|
+
* A flow drawing, trigger or script inside a request is read by its own contract (flows.ts `validateFlowDefinition`,
|
|
9
|
+
* flow-triggers.ts `validateTriggerConfig`, flow-scripts.ts `validateScript`) when the action is prepared, in every
|
|
10
|
+
* vocabulary those accept; here it is only "a value".
|
|
11
|
+
*/
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { parseContract, readVersioned, versioned } from "./contract.js";
|
|
14
|
+
/** An id the store minted: a positive safe integer. */
|
|
15
|
+
const id = z.int().min(1);
|
|
16
|
+
const words = z.string();
|
|
17
|
+
/** A drawing, trigger or script: read by its own contract when the action is prepared. */
|
|
18
|
+
const nested = z.unknown();
|
|
19
|
+
const skillFile = z.strictObject({ path: z.string(), base64: z.string() });
|
|
20
|
+
/** An object whose keys its own reader knows (a script draft, an action's staleness fence). */
|
|
21
|
+
const anyObject = z.object({}).catchall(z.unknown());
|
|
22
|
+
/**
|
|
23
|
+
* Each action's data, field order as the lead reads it in `get_actions`. Fields a branch ignores or reads through
|
|
24
|
+
* its own validator stay unknown: 0.9.36 accepted null and other non-string values there. Preparation still checks
|
|
25
|
+
* the selected branch and saves the same request bytes. No schema defaults or coercion may change its stamp.
|
|
26
|
+
*/
|
|
27
|
+
export const chatActionRequestSchemas = {
|
|
28
|
+
skill_import: z.strictObject({ repo: words, content: words.optional(), files: z.array(skillFile).optional() }),
|
|
29
|
+
skill_enable: z.strictObject({ repo: words, version: words }),
|
|
30
|
+
skill_disable: z.strictObject({ repo: words, version: words }),
|
|
31
|
+
skill_restore: z.strictObject({ repo: words, restore: id }),
|
|
32
|
+
skill_test: z.strictObject({ repo: words, version: words, sample: words, nonce: words }),
|
|
33
|
+
knowledge_instructions: z.strictObject({ repo: words, instructions: words.optional() }),
|
|
34
|
+
knowledge_save: z.strictObject({ repo: words, title: words, content: words, id: words.optional() }),
|
|
35
|
+
knowledge_remove: z.strictObject({ repo: words, id: words }),
|
|
36
|
+
knowledge_restore: z.strictObject({ repo: words, restore: id }),
|
|
37
|
+
tool_add: z.strictObject({
|
|
38
|
+
repo: words, catalog: z.unknown().optional(), name: z.unknown().optional(), command: z.unknown().optional(), args: z.unknown().optional(),
|
|
39
|
+
url: z.unknown().optional(), secrets: z.unknown().optional(), about: z.unknown().optional(),
|
|
40
|
+
}),
|
|
41
|
+
tool_remove: z.strictObject({ repo: words, name: words }),
|
|
42
|
+
flow_create: z.strictObject({ repo: words, name: words, definition: nested, trigger: nested.optional() }),
|
|
43
|
+
flow_starter: z.strictObject({ repo: words, starter: words }),
|
|
44
|
+
flow_edit: z.strictObject({ flow: id, name: words.optional(), definition: nested.optional() }),
|
|
45
|
+
flow_card_add: z.strictObject({ flow: id, title: words, description: z.unknown().optional(), zone: words.optional() }),
|
|
46
|
+
flow_card_move: z.strictObject({ card: id, zone: words }),
|
|
47
|
+
flow_card_approve: z.strictObject({ card: id, note: words.optional() }),
|
|
48
|
+
flow_card_send_back: z.strictObject({ card: id, note: words.optional() }),
|
|
49
|
+
/** An option by its number (from 1), or a reply that becomes the note. */
|
|
50
|
+
flow_card_choose: z.strictObject({ card: id, choice: z.int().nullable().optional(), note: z.unknown().optional() }),
|
|
51
|
+
flow_card_cancel: z.strictObject({ card: id }),
|
|
52
|
+
flow_card_comment: z.strictObject({ card: id, note: words }),
|
|
53
|
+
flow_card_assign: z.strictObject({ card: id, owner: words.nullable().optional() }),
|
|
54
|
+
flow_card_watch: z.strictObject({ card: id, watching: z.unknown().optional() }),
|
|
55
|
+
flow_script_save: z.strictObject({ repo: words, script: anyObject }),
|
|
56
|
+
flow_trigger_add: z.strictObject({ flow: id, trigger: nested }),
|
|
57
|
+
flow_trigger_pause: z.strictObject({ trigger: id }),
|
|
58
|
+
flow_trigger_resume: z.strictObject({ trigger: id }),
|
|
59
|
+
flow_trigger_remove: z.strictObject({ trigger: id }),
|
|
60
|
+
teammate_create: z.strictObject({ repo: words, template: z.unknown().optional(), name: z.unknown().optional(), soul: z.unknown().optional() }),
|
|
61
|
+
teammate_soul: z.strictObject({ teammate: id, soul: words }),
|
|
62
|
+
teammate_state: z.strictObject({ teammate: id, state: z.enum(["active", "paused", "removed"]) }),
|
|
63
|
+
teammate_note: z.strictObject({ teammate: id, note: words }),
|
|
64
|
+
teammate_answer: z.strictObject({ question: id, choice: z.unknown().optional(), text: z.unknown().optional() }),
|
|
65
|
+
teammate_tools: z.strictObject({
|
|
66
|
+
teammate: id, tool: words, change: z.enum(["grant", "revoke", "rule"]), action: z.unknown().optional(), use: z.unknown().optional(),
|
|
67
|
+
limitField: z.unknown().optional(), limitOver: z.unknown().optional(), undoWith: z.unknown().optional(),
|
|
68
|
+
}),
|
|
69
|
+
teammate_memory: z.strictObject({ teammate: id, memory: id, change: z.enum(["edit", "forget"]), text: z.unknown().optional() }),
|
|
70
|
+
teammate_routine: z.strictObject({ teammate: id, change: z.enum(["add", "remove"]), routine: z.unknown().optional(), schedule: z.unknown().optional(), text: z.unknown().optional() }),
|
|
71
|
+
teammate_undo: z.strictObject({ teammate: id, call: id }),
|
|
72
|
+
kit_setup: z.strictObject({ repo: words, kit: words }),
|
|
73
|
+
decision_record: z.strictObject({ repo: words, claim: words, why: words, supersedes: id.optional(), source: words.optional() }),
|
|
74
|
+
decision_retire: z.strictObject({ repo: words, decision: id, reason: words }),
|
|
75
|
+
/** The line, and (from 1) the line it replaces; 0 or none adds it. */
|
|
76
|
+
lead_about_you: z.strictObject({ line: words, replaces: z.int().min(0).optional() }),
|
|
77
|
+
scope_approve: z.strictObject({ task: words }),
|
|
78
|
+
result_accept: z.strictObject({ task: words, run: id }),
|
|
79
|
+
task_cancel: z.strictObject({ task: words }),
|
|
80
|
+
task_resume: z.strictObject({ task: words, run: id }),
|
|
81
|
+
};
|
|
82
|
+
export const CHAT_ACTION_OPERATIONS = Object.keys(chatActionRequestSchemas);
|
|
83
|
+
/** The fields each action takes, from its schema. */
|
|
84
|
+
export const CHAT_ACTION_FIELDS = Object.fromEntries(CHAT_ACTION_OPERATIONS.map(operation => [operation, Object.keys(chatActionRequestSchemas[operation].shape)]));
|
|
85
|
+
const isOperation = (value) => typeof value === "string" && Object.hasOwn(chatActionRequestSchemas, value);
|
|
86
|
+
/** One action's data, refused by path (`card: required`, `payload: unknown key 'cards' (did you mean card?)`). */
|
|
87
|
+
export function readChatActionRequest(operation, input) {
|
|
88
|
+
return parseContract(chatActionRequestSchemas[operation], input);
|
|
89
|
+
}
|
|
90
|
+
export const SHARED_ACTION_VERSION = 1;
|
|
91
|
+
/**
|
|
92
|
+
* A prepared action as a proposal saves it: the action, its checked request, the project, the card's title and
|
|
93
|
+
* terms, the stamp that proves nothing changed before it is confirmed, and the state the stamp was taken over (each
|
|
94
|
+
* action's own staleness fence, read back only by that action).
|
|
95
|
+
*/
|
|
96
|
+
export const sharedActionSchema = versioned(SHARED_ACTION_VERSION, {
|
|
97
|
+
operation: z.enum(CHAT_ACTION_OPERATIONS),
|
|
98
|
+
request: anyObject,
|
|
99
|
+
repo: z.string(),
|
|
100
|
+
title: z.string(),
|
|
101
|
+
terms: z.array(z.string()),
|
|
102
|
+
stamp: z.string(),
|
|
103
|
+
state: anyObject,
|
|
104
|
+
});
|
|
105
|
+
const SHARED_ACTION_FIELDS = Object.keys(sharedActionSchema.shape).filter(field => field !== "version");
|
|
106
|
+
/**
|
|
107
|
+
* A proposal saved before it carried `version` (every one through 0.9.36), as version 1. Its reader took the fields
|
|
108
|
+
* it knew and passed any others through unread, so this keeps exactly the known fields.
|
|
109
|
+
*/
|
|
110
|
+
export function upgradeUnversionedSharedAction(body) {
|
|
111
|
+
const out = { version: SHARED_ACTION_VERSION };
|
|
112
|
+
for (const field of SHARED_ACTION_FIELDS)
|
|
113
|
+
if (Object.hasOwn(body, field))
|
|
114
|
+
out[field] = body[field];
|
|
115
|
+
return out;
|
|
116
|
+
}
|
|
117
|
+
export const SHARED_ACTION_UPGRADES = { 0: upgradeUnversionedSharedAction };
|
|
118
|
+
const under = (prefix, issues) => issues.map(issue => {
|
|
119
|
+
const path = issue.path === "payload" ? prefix : `${prefix}.${issue.path}`;
|
|
120
|
+
return { ...issue, path, line: `${path}${issue.line.slice(issue.path.length)}` };
|
|
121
|
+
});
|
|
122
|
+
/** Legacy readers checked only the envelope. Confirmation still prepares the request again before acting. */
|
|
123
|
+
export function readSharedAction(input) {
|
|
124
|
+
const read = readVersioned(sharedActionSchema, input, SHARED_ACTION_UPGRADES);
|
|
125
|
+
if (!read.ok)
|
|
126
|
+
return read;
|
|
127
|
+
if (!isOperation(read.value.operation))
|
|
128
|
+
return { ok: false, issues: [{ path: "operation", kind: "bad-value", line: "operation: not an action" }] };
|
|
129
|
+
if (!Object.hasOwn(input, "version") || input["version"] === 0)
|
|
130
|
+
return read;
|
|
131
|
+
const request = readChatActionRequest(read.value.operation, read.value.request);
|
|
132
|
+
return request.ok ? read : { ok: false, issues: under("request", request.issues) };
|
|
133
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The saved side of a chat button: the row its one-time token names. A proposal card's buttons in Slack, Discord and
|
|
3
|
+
* Teams (`chat_action`, read with the part and event it rides) and a result's, plan's, failure's or pull request's own
|
|
4
|
+
* buttons (`chat_decide_action`, chat-decide.ts). SQLite's own CHECKs bound them when written; these say what a
|
|
5
|
+
* reader may rely on, so a row that isn't that is refused by column, never read as a guess.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { type ContractResult } from "./contract.js";
|
|
9
|
+
/** A proposal card's button (chat-delivery.ts), with the part's message and the event's binding, channel and thread. */
|
|
10
|
+
export declare const proposalActionRowSchema: z.ZodObject<{
|
|
11
|
+
token: z.ZodString;
|
|
12
|
+
part: z.ZodInt;
|
|
13
|
+
proposal: z.ZodInt;
|
|
14
|
+
phase: z.ZodEnum<{
|
|
15
|
+
cancel: "cancel";
|
|
16
|
+
confirm: "confirm";
|
|
17
|
+
dismiss: "dismiss";
|
|
18
|
+
yes: "yes";
|
|
19
|
+
}>;
|
|
20
|
+
expires: z.ZodString;
|
|
21
|
+
consumed: z.ZodNullable<z.ZodString>;
|
|
22
|
+
message: z.ZodNullable<z.ZodString>;
|
|
23
|
+
binding: z.ZodNullable<z.ZodInt>;
|
|
24
|
+
channel: z.ZodString;
|
|
25
|
+
thread: z.ZodString;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
export type ProposalActionRow = z.infer<typeof proposalActionRowSchema>;
|
|
28
|
+
export declare function readProposalActionRow(row: unknown): ContractResult<ProposalActionRow>;
|
|
29
|
+
export declare const DECIDE_ACTS: readonly ["accept", "changes", "retry", "approve", "not-now", "merge"];
|
|
30
|
+
export declare const DECIDE_PHASES: readonly ["offer", "yes", "cancel"];
|
|
31
|
+
/** A decide button (chat-decide.ts): who and where it was sent, what it does to which task and run, and the stamp it holds. */
|
|
32
|
+
export declare const decideActionRowSchema: z.ZodObject<{
|
|
33
|
+
token: z.ZodString;
|
|
34
|
+
channel: z.ZodString;
|
|
35
|
+
binding: z.ZodInt;
|
|
36
|
+
chat: z.ZodString;
|
|
37
|
+
message: z.ZodNullable<z.ZodString>;
|
|
38
|
+
act: z.ZodEnum<{
|
|
39
|
+
accept: "accept";
|
|
40
|
+
approve: "approve";
|
|
41
|
+
changes: "changes";
|
|
42
|
+
merge: "merge";
|
|
43
|
+
"not-now": "not-now";
|
|
44
|
+
retry: "retry";
|
|
45
|
+
}>;
|
|
46
|
+
phase: z.ZodEnum<{
|
|
47
|
+
cancel: "cancel";
|
|
48
|
+
offer: "offer";
|
|
49
|
+
yes: "yes";
|
|
50
|
+
}>;
|
|
51
|
+
task_id: z.ZodString;
|
|
52
|
+
run: z.ZodNullable<z.ZodInt>;
|
|
53
|
+
digest: z.ZodString;
|
|
54
|
+
created_at: z.ZodString;
|
|
55
|
+
expires_at: z.ZodString;
|
|
56
|
+
consumed_at: z.ZodNullable<z.ZodString>;
|
|
57
|
+
}, z.core.$strict>;
|
|
58
|
+
export type DecideActionRow = z.infer<typeof decideActionRowSchema>;
|
|
59
|
+
export declare function readDecideActionRow(row: unknown): ContractResult<DecideActionRow>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The saved side of a chat button: the row its one-time token names. A proposal card's buttons in Slack, Discord and
|
|
3
|
+
* Teams (`chat_action`, read with the part and event it rides) and a result's, plan's, failure's or pull request's own
|
|
4
|
+
* buttons (`chat_decide_action`, chat-decide.ts). SQLite's own CHECKs bound them when written; these say what a
|
|
5
|
+
* reader may rely on, so a row that isn't that is refused by column, never read as a guess.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { parseContract } from "./contract.js";
|
|
9
|
+
const when = z.string();
|
|
10
|
+
/** A proposal card's button (chat-delivery.ts), with the part's message and the event's binding, channel and thread. */
|
|
11
|
+
export const proposalActionRowSchema = z.strictObject({
|
|
12
|
+
token: z.string(),
|
|
13
|
+
part: z.int(),
|
|
14
|
+
proposal: z.int(),
|
|
15
|
+
phase: z.enum(["confirm", "dismiss", "yes", "cancel"]),
|
|
16
|
+
expires: when,
|
|
17
|
+
consumed: when.nullable(),
|
|
18
|
+
message: z.string().nullable(),
|
|
19
|
+
binding: z.int().nullable(),
|
|
20
|
+
channel: z.string(),
|
|
21
|
+
thread: z.string(),
|
|
22
|
+
});
|
|
23
|
+
export function readProposalActionRow(row) {
|
|
24
|
+
return parseContract(proposalActionRowSchema, row);
|
|
25
|
+
}
|
|
26
|
+
export const DECIDE_ACTS = ["accept", "changes", "retry", "approve", "not-now", "merge"];
|
|
27
|
+
export const DECIDE_PHASES = ["offer", "yes", "cancel"];
|
|
28
|
+
/** A decide button (chat-decide.ts): who and where it was sent, what it does to which task and run, and the stamp it holds. */
|
|
29
|
+
export const decideActionRowSchema = z.strictObject({
|
|
30
|
+
token: z.string().regex(/^d:[a-f0-9]{24}$/),
|
|
31
|
+
channel: z.string(),
|
|
32
|
+
binding: z.int(),
|
|
33
|
+
chat: z.string(),
|
|
34
|
+
message: z.string().nullable(),
|
|
35
|
+
act: z.enum(DECIDE_ACTS),
|
|
36
|
+
phase: z.enum(DECIDE_PHASES),
|
|
37
|
+
task_id: z.string(),
|
|
38
|
+
run: z.int().nullable(),
|
|
39
|
+
digest: z.string(),
|
|
40
|
+
created_at: when,
|
|
41
|
+
expires_at: when,
|
|
42
|
+
consumed_at: when.nullable(),
|
|
43
|
+
});
|
|
44
|
+
export function readDecideActionRow(row) {
|
|
45
|
+
return parseContract(decideActionRowSchema, row);
|
|
46
|
+
}
|