zigmini 1.0.0-beta.3 → 1.1.0-beta.2
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.ko.md +29 -2
- package/README.md +29 -2
- package/assets/agent/gateway-request-rules.md +9 -2
- package/assets/agent/gateway-rules.md +13 -6
- package/assets/android/zigmini.apk +0 -0
- package/assets/android/zigmini.apk.json +3 -3
- package/assets/build.json +1 -1
- package/assets/document-reader/document-reader +0 -0
- package/assets/document-reader/host-selector +0 -0
- package/assets/document-reader/manifest.json +27 -0
- package/docs/manual.ko.md +114 -10
- package/docs/manual.md +117 -11
- package/host/document-reader/DocumentRead.swift +370 -0
- package/host/document-reader/HostSelector.swift +192 -0
- package/host/document-reader/Protocol.swift +647 -0
- package/host/document-reader/main.swift +22 -0
- package/host/omo-bridge/agent-aside-tool.ts +119 -0
- package/host/omo-bridge/agent-aside.ts +522 -0
- package/host/omo-bridge/agent-collaboration-files.ts +282 -0
- package/host/omo-bridge/agent-collaboration.ts +385 -0
- package/host/omo-bridge/agent-control.ts +400 -28
- package/host/omo-bridge/agent-execution.sb +42 -0
- package/host/omo-bridge/agent-execution.ts +158 -0
- package/host/omo-bridge/agent-tool-adapters.ts +388 -0
- package/host/omo-bridge/agent-tool-permissions.ts +96 -0
- package/host/omo-bridge/aside-tabs.ts +41 -0
- package/host/omo-bridge/attachment-read.ts +100 -0
- package/host/omo-bridge/bridge.ts +10 -0
- package/host/omo-bridge/managed-call.ts +46 -0
- package/host/omo-bridge/task-control.ts +39 -5
- package/host/omo-check/patches/attachments-293/README.md +138 -0
- package/host/omo-check/patches/attachments-293/document-content.js +234 -0
- package/host/omo-check/patches/attachments-293/document-content.types.txt +91 -0
- package/host/omo-check/patches/attachments-293/omo-5.1.51-documents.patch +831 -0
- package/host/omo-check/patches/attachments-293/omo-5.1.51-gateway-port.manifest.json +471 -0
- package/host/omo-check/patches/omo-5.1.51-agent-tool-authority.patch +471 -0
- package/host/omo-check/patches/omo-5.1.51-gateway-port.manifest.json +28 -6
- package/host/omo-check/patches/omo-5.1.51-memory-receipts.patch +5 -0
- package/package.json +5 -3
- package/src/agent/api.ts +345 -20
- package/src/agent/artifacts.ts +196 -0
- package/src/agent/aside-target-routes.ts +369 -0
- package/src/agent/aside-targets.ts +215 -0
- package/src/agent/collaboration-admission.ts +47 -0
- package/src/agent/collaboration-read.ts +117 -0
- package/src/agent/collaboration-session.ts +196 -0
- package/src/agent/collaboration-types.ts +258 -0
- package/src/agent/collaboration.ts +399 -0
- package/src/agent/definition.ts +65 -3
- package/src/agent/fields.ts +9 -3
- package/src/agent/file-core.ts +325 -0
- package/src/agent/files.ts +87 -8
- package/src/agent/list.ts +3 -3
- package/src/agent/managed-call.ts +144 -0
- package/src/agent/tool-catalog.ts +184 -0
- package/src/agent/tool-delivery.ts +359 -0
- package/src/agent/tool-permission-types.ts +81 -0
- package/src/agent/tool-permissions.ts +1366 -0
- package/src/attachments/api.ts +161 -0
- package/src/attachments/document-reader.ts +325 -0
- package/src/attachments/host-selector.ts +410 -0
- package/src/attachments/managed-binding.ts +83 -0
- package/src/attachments/prepare.ts +214 -0
- package/src/attachments/selector-port.ts +28 -0
- package/src/attachments/service.ts +729 -0
- package/src/attachments/store.ts +698 -0
- package/src/attachments/types.ts +123 -0
- package/src/cli/doctor.ts +30 -10
- package/src/decisions.ts +109 -10
- package/src/engine/apply-patch.ts +21 -0
- package/src/engine/compat.json +2 -1
- package/src/engine/install.ts +45 -4
- package/src/engine/sandbox-cell.ts +2 -0
- package/src/gc.ts +33 -225
- package/src/housekeeping/api.ts +163 -0
- package/src/housekeeping/audit.ts +61 -0
- package/src/housekeeping/collectors/agent-collaboration.ts +33 -0
- package/src/housekeeping/collectors/agent-drafts.ts +43 -0
- package/src/housekeeping/collectors/agent-file-trash.ts +36 -0
- package/src/housekeeping/collectors/agent-trash.ts +28 -0
- package/src/housekeeping/collectors/attachment-cleanup.ts +35 -0
- package/src/housekeeping/collectors/db-backup.ts +25 -0
- package/src/housekeeping/collectors/docker-build-cache.ts +29 -0
- package/src/housekeeping/collectors/docker-image.ts +135 -0
- package/src/housekeeping/collectors/omo-version.ts +32 -0
- package/src/housekeeping/collectors/orphan-test-process.ts +205 -0
- package/src/housekeeping/collectors/reconcile-work.ts +55 -0
- package/src/housekeeping/collectors/rpc-daemon.ts +39 -0
- package/src/housekeeping/collectors/shared.ts +149 -0
- package/src/housekeeping/collectors/temp-dir.ts +28 -0
- package/src/housekeeping/collectors/update-file.ts +25 -0
- package/src/housekeeping/collectors/worktree.ts +193 -0
- package/src/housekeeping/engine.ts +125 -0
- package/src/housekeeping/reconcile/work.ts +130 -0
- package/src/housekeeping/registry.ts +63 -0
- package/src/housekeeping/trash.ts +59 -0
- package/src/housekeeping/types.ts +31 -0
- package/src/hub.ts +1095 -41
- package/src/main.ts +228 -30
- package/src/message-references.ts +14 -5
- package/src/profile-prompt.ts +13 -1
- package/src/protocol.ts +41 -6
- package/src/security-allow.ts +79 -2
- package/src/security-check.ts +1 -1
- package/src/store.ts +1946 -23
- package/src/test-crash.ts +20 -0
- package/src/work-watch.ts +55 -7
- package/src/work.ts +192 -3
- package/web/DESIGN.md +33 -0
- package/web/agents.d.ts +189 -12
- package/web/agents.js +898 -39
- package/web/app.js +2634 -210
- package/web/attachments.d.ts +91 -0
- package/web/attachments.js +422 -0
- package/web/collaboration.d.ts +87 -0
- package/web/collaboration.js +290 -0
- package/web/decisions.d.ts +39 -2
- package/web/decisions.js +354 -2
- package/web/gc.d.ts +26 -5
- package/web/gc.js +113 -13
- package/web/i18n/agents.d.ts +4 -0
- package/web/i18n/agents.js +200 -8
- package/web/i18n/attachments.js +78 -0
- package/web/i18n/decisions.d.ts +4 -0
- package/web/i18n/decisions.js +68 -0
- package/web/i18n/gc.d.ts +4 -0
- package/web/i18n/gc.js +184 -2
- package/web/i18n/main.js +80 -8
- package/web/i18n/tour.d.ts +4 -0
- package/web/i18n/tour.js +37 -0
- package/web/index.html +20 -3
- package/web/profile.d.ts +2 -2
- package/web/profile.js +11 -6
- package/web/style.css +342 -21
- package/web/tooltip.d.ts +2 -0
- package/web/tooltip.js +12 -0
- package/web/tour.d.ts +57 -0
- package/web/tour.js +450 -0
package/web/agents.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type FieldOrigin = "package" | "defaults" | "agent" | "none";
|
|
2
|
-
export type FieldWidget = "text" | "textarea" | "number" | "toggle" | "model" | "select" | "skills" | "group";
|
|
2
|
+
export type FieldWidget = "text" | "textarea" | "number" | "toggle" | "model" | "select" | "skills" | "targets" | "group";
|
|
3
3
|
export type FieldType = "string" | "integer" | "boolean" | "object" | "strings";
|
|
4
4
|
export type EditorKind = "new" | "agent" | "defaults";
|
|
5
5
|
|
|
@@ -13,12 +13,16 @@ export interface AgentFieldMeta {
|
|
|
13
13
|
readonly applies: "gateway" | "extension";
|
|
14
14
|
readonly widget: FieldWidget;
|
|
15
15
|
readonly forbidden: boolean;
|
|
16
|
+
/** Kept out of the editor (the value stays in the source); sent by newer gateways, set by the web's presentation for schema. */
|
|
17
|
+
readonly hidden?: boolean;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
/** The editor's labels and hints for one registry field name. */
|
|
19
21
|
export interface FieldPresentation {
|
|
20
22
|
readonly label: string;
|
|
21
23
|
readonly help?: string;
|
|
24
|
+
readonly hidden?: boolean;
|
|
25
|
+
readonly widget?: FieldWidget;
|
|
22
26
|
readonly options?: readonly string[];
|
|
23
27
|
readonly min?: number;
|
|
24
28
|
readonly max?: number;
|
|
@@ -42,23 +46,36 @@ export interface AgentSummary {
|
|
|
42
46
|
readonly convId: string;
|
|
43
47
|
readonly definitionSha: string;
|
|
44
48
|
readonly stale: boolean;
|
|
49
|
+
/** "unknown" while the gateway could not learn which definition the open session applied (todo 3); the state is then stale. Other values are not a known state. */
|
|
50
|
+
readonly staleReason?: string;
|
|
45
51
|
}
|
|
46
52
|
|
|
47
|
-
/** GET /api/agents/:id: the summary with the definition text, the merged result and the field registry. */
|
|
53
|
+
/** GET /api/agents/:id: the summary with the definition text, the merged result, the parsed shared layer and the field registry. */
|
|
48
54
|
export interface AgentDetail extends AgentSummary {
|
|
49
55
|
readonly source: string;
|
|
50
56
|
readonly fields: Readonly<Record<string, unknown>>;
|
|
51
57
|
readonly body: string;
|
|
52
58
|
readonly defaultsBody: string;
|
|
59
|
+
/** defaults.md as the gateway parsed it: the layer its merge applied under the agent's own values (agent-ux todo 12 fix 2). */
|
|
60
|
+
readonly defaultsFields: Readonly<Record<string, unknown>>;
|
|
53
61
|
readonly origins: Readonly<Record<string, "package" | "defaults" | "agent">>;
|
|
54
62
|
readonly sha: string;
|
|
55
63
|
readonly registry: readonly AgentFieldMeta[];
|
|
56
64
|
}
|
|
57
65
|
|
|
58
|
-
/** GET and PUT /api/agents/defaults: the defaults.md text and the same field registry. */
|
|
66
|
+
/** GET and PUT /api/agents/defaults: the defaults.md text, the same text as the gateway parsed it, and the same field registry. */
|
|
59
67
|
export interface AgentDefaults {
|
|
60
68
|
readonly source: string;
|
|
69
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
70
|
+
readonly registry: readonly AgentFieldMeta[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** What the create screen opens from: the defaults registry and parsed layer, and for a reopened draft its text and id (agent-ux todo 11). */
|
|
74
|
+
export interface NewAgentInput {
|
|
61
75
|
readonly registry: readonly AgentFieldMeta[];
|
|
76
|
+
readonly defaultsFields?: Readonly<Record<string, unknown>>;
|
|
77
|
+
readonly source?: string;
|
|
78
|
+
readonly draftId?: string;
|
|
62
79
|
}
|
|
63
80
|
|
|
64
81
|
export interface ConversationRow {
|
|
@@ -81,8 +98,18 @@ export interface EditorState {
|
|
|
81
98
|
readonly registry: readonly AgentFieldRow[];
|
|
82
99
|
readonly id: string | null;
|
|
83
100
|
readonly name: string | null;
|
|
101
|
+
/** defaults.md as the gateway parsed it (the answer's `fields` or `defaultsFields`): the shared layer under this definition's own values; {} for the defaults editor. */
|
|
102
|
+
readonly defaults: Readonly<Record<string, unknown>>;
|
|
84
103
|
readonly convId: string | null;
|
|
85
104
|
readonly stale: boolean;
|
|
105
|
+
/** A new agent's draft id (todo 11); null for an existing agent and the defaults. */
|
|
106
|
+
readonly draftId: string | null;
|
|
107
|
+
/** The files a reopened draft had picked (names and sizes only); app.js shows them as "pick again". */
|
|
108
|
+
readonly draftFiles?: readonly { readonly name: string; readonly size: number }[];
|
|
109
|
+
/** The merged sha the gateway holds (an existing agent), compared with the save answer (todo 13). */
|
|
110
|
+
readonly definitionSha: string | null;
|
|
111
|
+
/** The gateway's text as sent; an untouched editor composes it byte for byte, so there is nothing to save. */
|
|
112
|
+
readonly serverSource: string | null;
|
|
86
113
|
readonly own: Record<string, unknown>;
|
|
87
114
|
readonly rawByKey: Readonly<Record<string, string>>;
|
|
88
115
|
readonly touched: ReadonlySet<string>;
|
|
@@ -92,13 +119,18 @@ export interface EditorState {
|
|
|
92
119
|
readonly preamble: string;
|
|
93
120
|
readonly body: string;
|
|
94
121
|
readonly bodyTouched: boolean;
|
|
122
|
+
/** The layers under the own values: the registry's package defaults with defaults.md over them. */
|
|
95
123
|
readonly inherited: Readonly<Record<string, unknown>>;
|
|
124
|
+
/** What the gateway merged for an existing agent (its own values included); {} for the other kinds. */
|
|
125
|
+
readonly merged: Readonly<Record<string, unknown>>;
|
|
96
126
|
readonly origins: Readonly<Record<string, string>>;
|
|
97
127
|
readonly dirty: boolean;
|
|
98
128
|
}
|
|
99
129
|
|
|
100
130
|
export type EditorRow =
|
|
101
131
|
| { readonly kind: "group"; readonly name: string; readonly label: string; readonly help: string }
|
|
132
|
+
/** A prohibited field: drawn as a switch that cannot be turned on, with the reason in `help`; never written to the source. */
|
|
133
|
+
| { readonly kind: "forbidden"; readonly name: string; readonly label: string; readonly help: string }
|
|
102
134
|
| {
|
|
103
135
|
readonly kind: "field";
|
|
104
136
|
readonly name: string;
|
|
@@ -121,7 +153,7 @@ export type EditorRow =
|
|
|
121
153
|
/** What widgetValue() reads from a registry row or an editor field row. */
|
|
122
154
|
export type WidgetSpec = Pick<AgentFieldRow, "widget" | "required" | "label"> & Partial<Pick<AgentFieldRow, "options" | "min" | "max">>;
|
|
123
155
|
export interface EditorError { readonly name: string; readonly message: string }
|
|
124
|
-
export interface ApiRequest { readonly method: "GET" | "POST" | "PUT"; readonly path: string; readonly headers?: Readonly<Record<string, string>>; readonly body?: string }
|
|
156
|
+
export interface ApiRequest { readonly method: "GET" | "POST" | "PUT" | "DELETE"; readonly path: string; readonly headers?: Readonly<Record<string, string>>; readonly body?: string }
|
|
125
157
|
|
|
126
158
|
export interface SidebarItem {
|
|
127
159
|
readonly convId: string;
|
|
@@ -142,29 +174,62 @@ export interface SidebarView {
|
|
|
142
174
|
readonly pending: ReadonlyMap<string, number>;
|
|
143
175
|
}
|
|
144
176
|
|
|
145
|
-
export interface HeaderView { readonly agent: boolean; readonly agentId: string | null; readonly icon: string; readonly name: string; readonly stale: boolean }
|
|
177
|
+
export interface HeaderView { readonly agent: boolean; readonly agentId: string | null; readonly icon: string; readonly name: string; readonly stale: boolean; readonly staleReason: "unknown" | null }
|
|
178
|
+
/** Bug 283: the header's definition status line and the new-session button's state; the texts are keys of web/i18n/main.js. */
|
|
179
|
+
export interface StaleNotice {
|
|
180
|
+
readonly shown: boolean;
|
|
181
|
+
readonly textKey: "agent.stale.changed" | "agent.stale.unknown" | null;
|
|
182
|
+
readonly attention: boolean;
|
|
183
|
+
readonly labelKey: "head.newSession" | "head.newSession.apply";
|
|
184
|
+
readonly confirmKey: "head.newSession.confirm" | "head.newSession.confirm.apply";
|
|
185
|
+
}
|
|
186
|
+
/** The speaker of a conversation's bot rows and sidebar profile: a text `icon` for an agent, an `iconUrl` picture for main. */
|
|
187
|
+
export interface SpeakerView { readonly agent: boolean; readonly agentId: string | null; readonly name: string; readonly icon: string | null; readonly iconUrl: string | null }
|
|
146
188
|
export interface TrashRow { readonly entry: string; readonly id: string | null; readonly name: string; readonly description: string; readonly icon: string; readonly deletedAt: string | null }
|
|
147
|
-
export
|
|
189
|
+
export type KnowledgeArea = "source" | "outputs" | "notes" | "memory" | "other";
|
|
190
|
+
export type FileOrigin = "user-upload" | "collaboration-copy";
|
|
191
|
+
export interface FileRow { readonly path: string; readonly type: "file" | "directory"; readonly size: number; readonly depth: number; readonly name: string; readonly label: string; readonly source: boolean; readonly area: KnowledgeArea; readonly modifiedAt: string | null; readonly origin?: FileOrigin | null }
|
|
192
|
+
export interface FileAreas { readonly source: FileRow[]; readonly outputs: FileRow[]; readonly notes: FileRow[] }
|
|
193
|
+
/** A deleted knowledge file as the gateway archives it (agent-ux todo 16). */
|
|
194
|
+
export interface FileTrashRow { readonly entry: string; readonly path: string; readonly name: string; readonly area: KnowledgeArea; readonly size: number; readonly label: string; readonly deletedAt: string | null }
|
|
195
|
+
/** One accepted upload as the status line reports it: the picked name, the name the gateway saved, and its size. */
|
|
196
|
+
export interface SavedUpload { readonly name: string; readonly savedName: string; readonly size: number }
|
|
197
|
+
/** One queued upload (agent-ux todo 14): the picked file, its state, progress 0..1, the refusal code and sentence, and the name the gateway saved it under. */
|
|
198
|
+
export type UploadStatus = "queued" | "waiting" | "uploading" | "done" | "failed";
|
|
199
|
+
export interface UploadRow {
|
|
200
|
+
readonly key: string;
|
|
201
|
+
readonly file: unknown;
|
|
202
|
+
readonly name: string;
|
|
203
|
+
readonly size: number;
|
|
204
|
+
readonly status: UploadStatus;
|
|
205
|
+
readonly progress: number;
|
|
206
|
+
readonly error: string | null;
|
|
207
|
+
readonly errorLine: string | null;
|
|
208
|
+
readonly savedName: string | null;
|
|
209
|
+
}
|
|
210
|
+
export interface UploadPatch { readonly status?: UploadStatus; readonly progress?: number; readonly error?: string | null; readonly errorLine?: string | null; readonly savedName?: string | null }
|
|
211
|
+
export interface UploadSummary { readonly total: number; readonly done: number; readonly failed: number; readonly waiting: number; readonly uploading: number; readonly active: boolean }
|
|
148
212
|
export interface AgentUpdateResult<P, C> { readonly agents: readonly P[]; readonly conversations: readonly C[]; readonly removedConv: string | null; readonly restoredConv: string | null }
|
|
149
213
|
|
|
150
214
|
export const AGENTS_PATH: string;
|
|
151
215
|
export const DEFAULTS_PATH: string;
|
|
152
216
|
export const TRASH_PATH: string;
|
|
217
|
+
export const DRAFTS_PATH: string;
|
|
218
|
+
export const DRAFT_DELAY_MS: number;
|
|
153
219
|
export const AGENT_MAX_BYTES: number;
|
|
154
220
|
export const DESCRIPTION_MAX: number;
|
|
155
221
|
export const MEMORY_MAX_BYTES: number;
|
|
156
222
|
export const THINKING_LEVELS: readonly string[];
|
|
157
223
|
export const ORIGIN_LABELS: Readonly<Record<FieldOrigin, string>>;
|
|
158
224
|
export const DEFAULT_ICON: string;
|
|
159
|
-
export const STALE_LABEL: string;
|
|
160
225
|
export const STALE_TITLE: string;
|
|
161
226
|
export const DELETE_HINT: string;
|
|
162
227
|
export const EMPTY_AGENTS_LINE: string;
|
|
163
228
|
export const EMPTY_TRASH_LINE: string;
|
|
164
|
-
export const EMPTY_FILES_LINE: string;
|
|
165
|
-
export const NEW_AGENT_BODY: string;
|
|
166
229
|
export const FIELD_PRESENTATION: Readonly<Record<string, FieldPresentation>>;
|
|
167
230
|
|
|
231
|
+
/** The role-instruction guide's four headings in the UI language (agent-ux todo 9). */
|
|
232
|
+
export function roleGuideItems(): { readonly key: "scope" | "tasks" | "limits" | "address"; readonly label: string; readonly text: string }[];
|
|
168
233
|
export function fieldAt(fields: unknown, name: string): unknown;
|
|
169
234
|
export function editorFields(registry: readonly AgentFieldMeta[] | null | undefined): AgentFieldRow[];
|
|
170
235
|
export function topLevelKeys(registry: readonly AgentFieldMeta[]): string[];
|
|
@@ -172,30 +237,142 @@ export function parseYaml(text: string): unknown;
|
|
|
172
237
|
export function emitScalar(value: unknown): string;
|
|
173
238
|
export function emitEntry(key: string, value: unknown): string;
|
|
174
239
|
export function splitSource(source: string): SourceSplit;
|
|
175
|
-
|
|
240
|
+
/** What the editor opens from: a gateway answer or the create screen's input; the shared layer arrives parsed by the gateway (`defaultsFields`), never as text. */
|
|
241
|
+
export type EditorInput = Partial<AgentDetail> | Partial<AgentDefaults> | Partial<NewAgentInput>;
|
|
242
|
+
export function editorState(detail: EditorInput | null | undefined, kind?: EditorKind): EditorState;
|
|
176
243
|
export function packageDefaults(registry: readonly AgentFieldMeta[]): Record<string, unknown>;
|
|
177
244
|
export function editorRows(state: EditorState): EditorRow[];
|
|
178
245
|
export function widgetValue(field: WidgetSpec, input: unknown): { value?: unknown; error?: string };
|
|
246
|
+
export const DRAFT_REOPEN_WAIT_MS: number;
|
|
247
|
+
export const PREVIEW_PATH: string;
|
|
248
|
+
export const PREVIEW_DELAY_MS: number;
|
|
249
|
+
/** The can/cannot box's state (agent-ux todo 12): the merged fields the gateway answered for the editor's current text, or why there are none (`failed`: the request did not bring an answer for that text). */
|
|
250
|
+
export interface PreviewState { readonly status: "loading" | "ready" | "unavailable" | "failed"; readonly fields: Readonly<Record<string, unknown>> | null }
|
|
251
|
+
/** POST /api/agents/preview with the editor's composed text; the gateway evaluates it as a save would and writes nothing. */
|
|
252
|
+
export function previewRequest(state: EditorState): ApiRequest;
|
|
253
|
+
/** The box's state after an answer: ready with the gateway's fields, unavailable for refused text, failed for a request that brought no readable answer. */
|
|
254
|
+
export function previewState(answer: unknown): PreviewState;
|
|
255
|
+
/** One line of the can/cannot box (agent-ux todo 12); `tip` is the tooltip detail. */
|
|
256
|
+
export interface CapabilityItem { readonly key: string; readonly text: string; readonly tip: string }
|
|
257
|
+
export function capabilities(merged: Record<string, unknown>): { readonly can: CapabilityItem[]; readonly cannot: CapabilityItem[] };
|
|
258
|
+
/** One row of the allowed-skills check list (agent-ux todo 10); `installed` is null while the list could not be loaded. */
|
|
259
|
+
export interface SkillOption {
|
|
260
|
+
readonly name: string;
|
|
261
|
+
readonly checked: boolean;
|
|
262
|
+
readonly installed: boolean | null;
|
|
263
|
+
readonly description: string;
|
|
264
|
+
}
|
|
265
|
+
export function skillOptions(commands: unknown, saved: unknown): { readonly loaded: boolean; readonly options: SkillOption[] };
|
|
179
266
|
export function setField(state: EditorState, name: string, value: unknown): EditorState;
|
|
180
267
|
export function clearField(state: EditorState, name: string): EditorState;
|
|
181
268
|
export function setBody(state: EditorState, body: string): EditorState;
|
|
182
269
|
export function setUnknownRaw(state: EditorState, unknownRaw: string): EditorState;
|
|
183
270
|
export function composeSource(state: EditorState): string;
|
|
271
|
+
export function editorUpdateAction(editor: { readonly kind?: unknown; readonly id?: unknown; readonly definitionSha?: unknown; readonly dirty?: unknown } | null | undefined, data: unknown): "reload" | "changed" | null;
|
|
184
272
|
export function validateEditor(state: EditorState): EditorError[];
|
|
185
273
|
export function saveRequest(state: EditorState): ApiRequest;
|
|
274
|
+
/** An injectable scheduler, so tests count timer calls exactly. */
|
|
275
|
+
export interface DebounceOptions { readonly delayMs?: number; readonly setTimer?: (fn: () => void, ms: number) => unknown; readonly clearTimer?: (handle: unknown) => void }
|
|
276
|
+
/**
|
|
277
|
+
* The create screen's draft autosave (agent-ux todo 11, 18): durable, one lane per draft id. A state whose quiet period ended, or
|
|
278
|
+
* that was flushed, is due and always reaches the server, in order, behind that draft's request on the wire.
|
|
279
|
+
*/
|
|
280
|
+
export interface DraftSaver<S extends { readonly draftId: string | null } = EditorState> {
|
|
281
|
+
touch(state: S): void;
|
|
282
|
+
/** Makes every waiting state due at once (the dialog closes); true when one was waiting. */
|
|
283
|
+
flush(): boolean;
|
|
284
|
+
/** Drains that draft's waiting writes; false means its last write failed, not that it is still pending. */
|
|
285
|
+
settle(draftId: string | null): Promise<boolean>;
|
|
286
|
+
/** The newest state this page holds for that draft (waiting, due or sent), or null. */
|
|
287
|
+
latest(draftId: string | null): S | null;
|
|
288
|
+
/** A state waits for its timer or for its draft's wire. */
|
|
289
|
+
readonly pending: boolean;
|
|
290
|
+
/** Resolves once every request on the wire has answered; nothing is dropped. */
|
|
291
|
+
readonly idle: Promise<void>;
|
|
292
|
+
}
|
|
293
|
+
export function createDraftSaver<S extends { readonly draftId: string | null } = EditorState>(save: (state: S) => void | boolean | Promise<unknown>, options?: DebounceOptions): DraftSaver<S>;
|
|
294
|
+
/**
|
|
295
|
+
* The can/cannot box's preview requests (agent-ux todo 12, 18): disposable, owned by one editor at a time. `request` gets the owner
|
|
296
|
+
* token of the moment it goes out; `discard()` drops what waits and moves the token on, so an earlier owner's answer is not applied.
|
|
297
|
+
*/
|
|
298
|
+
export interface PreviewRequester<S = EditorState> {
|
|
299
|
+
touch(state: S): void;
|
|
300
|
+
flush(): boolean;
|
|
301
|
+
discard(): void;
|
|
302
|
+
owns(token: number): boolean;
|
|
303
|
+
readonly token: number;
|
|
304
|
+
/** A state waits for its timer or for the wire. */
|
|
305
|
+
readonly pending: boolean;
|
|
306
|
+
/** Resolves once the request on the wire (if any) has answered. */
|
|
307
|
+
readonly idle: Promise<void>;
|
|
308
|
+
}
|
|
309
|
+
export function createPreviewRequester<S = EditorState>(request: (state: S, token: number) => void | Promise<unknown>, options?: DebounceOptions): PreviewRequester<S>;
|
|
310
|
+
export function newDraftId(random?: () => number): string;
|
|
311
|
+
export function draftRequest(state: EditorState, files?: readonly { readonly name: string; readonly size: number }[]): ApiRequest;
|
|
312
|
+
export interface DraftRow { readonly id: string; readonly name: string | null; readonly updatedAt: string }
|
|
313
|
+
export function draftRows(list: unknown): DraftRow[];
|
|
314
|
+
export function draftLoadRequest(id: string): ApiRequest;
|
|
315
|
+
export function discardDraftRequest(id: string): ApiRequest;
|
|
186
316
|
export function deleteEnabled(typed: string, name: string | null | undefined): boolean;
|
|
187
317
|
export function deleteRequest(id: string, name: string): ApiRequest;
|
|
188
318
|
export function cloneRequest(id: string): ApiRequest;
|
|
189
|
-
export function restoreRequest(entry: string): ApiRequest;
|
|
319
|
+
export function restoreRequest(entry: string, options?: { readonly newId?: boolean }): ApiRequest;
|
|
320
|
+
export type RestoreOutcome =
|
|
321
|
+
| { readonly kind: "restored"; readonly detail: AgentDetail }
|
|
322
|
+
| { readonly kind: "conflict"; readonly id: string }
|
|
323
|
+
| { readonly kind: "error"; readonly message: string };
|
|
324
|
+
export function restoreOutcome(status: number, body: unknown): RestoreOutcome;
|
|
325
|
+
export const UPLOAD_MAX_BYTES: number;
|
|
326
|
+
export function uploadRows(files: ArrayLike<{ readonly name?: unknown; readonly size?: unknown }> | null | undefined): UploadRow[];
|
|
327
|
+
export function uploadErrorLine(code: string | null | undefined): string;
|
|
328
|
+
export function queuedUploadRows(files: ArrayLike<{ readonly name?: unknown; readonly size?: unknown }> | null | undefined): UploadRow[];
|
|
329
|
+
export function draftFileList(rows: readonly UploadRow[]): { readonly name: string; readonly size: number }[];
|
|
330
|
+
export function uploadsAfterCreate(body: unknown, rows: readonly UploadRow[] | null | undefined): { readonly id: string; readonly rows: UploadRow[] } | null;
|
|
331
|
+
export function nextUpload(rows: readonly UploadRow[]): UploadRow | null;
|
|
332
|
+
export function advanceUpload(rows: readonly UploadRow[], key: string, patch: UploadPatch): UploadRow[];
|
|
333
|
+
export function retryUpload(rows: readonly UploadRow[], key: string): UploadRow[];
|
|
334
|
+
export function uploadSummary(rows: readonly UploadRow[]): UploadSummary;
|
|
335
|
+
export function uploadStateLine(row: UploadRow): string;
|
|
190
336
|
export function filesPath(id: string): string;
|
|
191
337
|
export function sourceUploadPath(id: string): string;
|
|
192
338
|
export function errorLine(body: unknown, status: number): string;
|
|
339
|
+
export function unchangedSource(state: EditorState): boolean;
|
|
340
|
+
export function saveOutcome(state: EditorState, body: unknown): { readonly changed: boolean; readonly stale: boolean };
|
|
341
|
+
/** agent-ux todo 21: what "지금 적용" applies after a changed save of a stale agent. */
|
|
342
|
+
export interface ApplyTarget { readonly agentId: string; readonly convId: string; readonly sha: string }
|
|
343
|
+
export type ApplyResult = "applied" | "mismatch" | "open_failed" | "turn_running" | "unconfirmed";
|
|
344
|
+
export function applyNowTarget(outcome: { readonly changed: boolean; readonly stale: boolean }, body: unknown): ApplyTarget | null;
|
|
345
|
+
export function applyNowShown(target: ApplyTarget | null, agents: readonly { readonly id?: string; readonly stale?: boolean }[]): boolean;
|
|
346
|
+
export function rotateRequest(convId: string, view: Pick<HeaderView, "agent" | "stale">): { readonly type: "conversation.rotate"; readonly conv: string; readonly open?: true };
|
|
347
|
+
export const APPLY_WAIT_MS: number;
|
|
348
|
+
export function applyWatch(target: ApplyTarget): (event: { readonly type?: string; readonly conv?: string; readonly data?: unknown } | null | undefined) => Exclude<ApplyResult, "unconfirmed"> | null;
|
|
349
|
+
export function applyLine(result: string): string;
|
|
350
|
+
export function freshListAnswer(sentStamp: number, stampNow: number): boolean;
|
|
351
|
+
export function reconcileAgents(event: { readonly type?: string; readonly conv?: string; readonly data?: unknown } | null | undefined, agents: readonly { readonly convId?: string }[]): boolean;
|
|
352
|
+
/** The error app.js agentApi throws: the gateway's code and field, the HTTP status, or `network` when nothing answered. */
|
|
353
|
+
export interface RequestFailure { readonly code?: string | null; readonly field?: string | null; readonly status?: number; readonly network?: boolean; readonly message?: string }
|
|
354
|
+
export function saveErrorLine(error: RequestFailure | Error | unknown, fields?: readonly { readonly name: string; readonly label: string }[]): string;
|
|
193
355
|
export function applyAgentUpdate<P extends { id: string; convId?: string }, C extends ConversationRow>(agents: readonly P[], conversations: readonly C[], data: unknown, now?: number): AgentUpdateResult<P | AgentSummary, C | ConversationRow>;
|
|
194
|
-
export function applyAgentApplied<P extends { convId: string; definitionSha: string; stale: boolean }>(agents: readonly P[], convId: string, data: unknown): P
|
|
356
|
+
export function applyAgentApplied<P extends { convId: string; definitionSha: string; stale: boolean; staleReason?: string }>(agents: readonly P[], convId: string, data: unknown): Array<Omit<P, "staleReason"> & { readonly staleReason?: string }>;
|
|
195
357
|
export function mainConversations<C extends ConversationRow>(conversations: readonly C[]): C[];
|
|
196
358
|
export function shownConversation(conversations: readonly ConversationRow[], id: string): string;
|
|
197
359
|
export function agentInitial(name: unknown): string;
|
|
198
360
|
export function sidebarItems(conversations: readonly ConversationRow[], agents: readonly Partial<AgentSummary>[], view: SidebarView): SidebarItem[];
|
|
199
361
|
export function headerView(conv: ConversationRow | null | undefined, agents: readonly Partial<AgentSummary>[]): HeaderView;
|
|
362
|
+
export function staleNotice(view: Pick<HeaderView, "stale" | "staleReason">): StaleNotice;
|
|
363
|
+
export function speakerView(conv: ConversationRow | null | undefined, agents: readonly Partial<AgentSummary>[], main: { readonly name: string; readonly iconUrl?: string | null }): SpeakerView;
|
|
200
364
|
export function trashRows(entries: unknown): TrashRow[];
|
|
201
365
|
export function fileRows(entries: unknown): FileRow[];
|
|
366
|
+
export function fileAreas(rows: readonly FileRow[]): FileAreas;
|
|
367
|
+
export function deletableFile(row: FileRow): boolean;
|
|
368
|
+
export function downloadable(row: FileRow): boolean;
|
|
369
|
+
export function downloadPath(id: string, path: string): string;
|
|
370
|
+
export function modifiedLabel(modifiedAt: string | null | undefined, locale: string): string;
|
|
371
|
+
export function turnEndRefreshes(editor: { readonly kind: string; readonly id?: string | null; readonly convId?: string | null } | null | undefined, conv: string | null | undefined): boolean;
|
|
372
|
+
export function fileDeleteRequest(id: string, path: string): ApiRequest;
|
|
373
|
+
export function fileTrashPath(id: string): string;
|
|
374
|
+
export function fileRestoreRequest(id: string, entry: string): ApiRequest;
|
|
375
|
+
export function fileTrashRows(entries: unknown): FileTrashRow[];
|
|
376
|
+
export function fileTrashLabel(count: number): string;
|
|
377
|
+
export function uploadedLine(saved: readonly SavedUpload[]): string;
|
|
378
|
+
export function lastDailyLine(lastDaily: string | null | undefined): string;
|