@absolutejs/ai 0.0.39 → 0.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/index.js +476 -3
- package/dist/ai/index.js.map +4 -4
- package/dist/ai/ui/index.js +474 -2
- package/dist/ai/ui/index.js.map +3 -3
- package/dist/src/ai/ui/catalog.d.ts +173 -4
- package/dist/src/ai/ui/index.d.ts +7 -4
- package/dist/types/ai.d.ts +6 -2
- package/package.json +1 -1
package/dist/ai/ui/index.js
CHANGED
|
@@ -104,6 +104,12 @@ var FORM_FIELD_TYPES = [
|
|
|
104
104
|
"checkbox",
|
|
105
105
|
"password"
|
|
106
106
|
];
|
|
107
|
+
var PLAN_STEP_STATUSES = [
|
|
108
|
+
"pending",
|
|
109
|
+
"active",
|
|
110
|
+
"done",
|
|
111
|
+
"error"
|
|
112
|
+
];
|
|
107
113
|
var CHART_MAX_SERIES = 8;
|
|
108
114
|
var CHART_MAX_POINTS = 24;
|
|
109
115
|
var TABLE_MAX_COLUMNS = 8;
|
|
@@ -112,14 +118,28 @@ var STAT_TILES_MAX = 6;
|
|
|
112
118
|
var UI_ACTIONS_MAX = 3;
|
|
113
119
|
var FORM_MAX_FIELDS = 8;
|
|
114
120
|
var FORM_SELECT_MAX_OPTIONS = 12;
|
|
121
|
+
var CHOICE_MAX_OPTIONS = 8;
|
|
122
|
+
var CONFIRM_CONSEQUENCE_MAX_CHARS = 500;
|
|
123
|
+
var DIFF_MAX_FILES = 6;
|
|
124
|
+
var DIFF_MAX_LINES = 400;
|
|
125
|
+
var PLAN_MAX_STEPS = 12;
|
|
126
|
+
var CREDENTIAL_MAX_KEYS = 8;
|
|
127
|
+
var CARD_ID_MAX_CHARS = 64;
|
|
115
128
|
var LABEL_MAX_CHARS = 80;
|
|
116
129
|
var TITLE_MAX_CHARS = 120;
|
|
117
130
|
var CELL_MAX_CHARS = 160;
|
|
118
131
|
var UNIT_MAX_CHARS = 8;
|
|
119
132
|
var ACTION_LABEL_MAX_CHARS = 40;
|
|
120
133
|
var DESCRIPTION_MAX_CHARS = 280;
|
|
134
|
+
var BADGE_MAX_CHARS = 24;
|
|
135
|
+
var DIFF_PATH_MAX_CHARS = 260;
|
|
136
|
+
var DIFF_LINE_MAX_CHARS = 300;
|
|
137
|
+
var DOCS_URL_MAX_CHARS = 300;
|
|
121
138
|
var ACTION_TOOL_PATTERN = /^[a-z][a-z0-9_]{1,63}$/;
|
|
122
139
|
var FIELD_NAME_PATTERN = /^[a-z][a-zA-Z0-9_]{0,63}$/;
|
|
140
|
+
var CARD_ID_PATTERN = /^[A-Za-z0-9_-]{1,64}$/;
|
|
141
|
+
var ENV_KEY_PATTERN = /^[A-Z][A-Z0-9_]{0,63}$/;
|
|
142
|
+
var DOCS_URL_PATTERN = /^https?:\/\//;
|
|
123
143
|
var isRecord = (value) => typeof value === "object" && value !== null;
|
|
124
144
|
var cleanString = (value, maxChars) => typeof value === "string" && value.trim().length > 0 ? value.trim().slice(0, maxChars) : null;
|
|
125
145
|
var cleanStringArray = (value, maxItems, maxChars) => {
|
|
@@ -143,6 +163,17 @@ var cleanNumberArray = (value, maxItems) => {
|
|
|
143
163
|
}
|
|
144
164
|
return cleaned;
|
|
145
165
|
};
|
|
166
|
+
var cleanId = (value) => {
|
|
167
|
+
if (typeof value !== "string")
|
|
168
|
+
return null;
|
|
169
|
+
const trimmed = value.trim().slice(0, CARD_ID_MAX_CHARS);
|
|
170
|
+
return CARD_ID_PATTERN.test(trimmed) ? trimmed : null;
|
|
171
|
+
};
|
|
172
|
+
var applyCardId = (spec, raw) => {
|
|
173
|
+
const cardId = cleanId(raw);
|
|
174
|
+
if (cardId)
|
|
175
|
+
spec.cardId = cardId;
|
|
176
|
+
};
|
|
146
177
|
var parseUiActions = (value) => {
|
|
147
178
|
if (!Array.isArray(value) || value.length === 0)
|
|
148
179
|
return;
|
|
@@ -177,6 +208,22 @@ var ACTIONS_SCHEMA = {
|
|
|
177
208
|
},
|
|
178
209
|
type: "array"
|
|
179
210
|
};
|
|
211
|
+
var CARD_ID_SCHEMA = {
|
|
212
|
+
description: "Optional stable card identity (letters/digits/_/-, max 64 chars). Re-emit a card with the SAME cardId to update the earlier render in place instead of adding a new card.",
|
|
213
|
+
type: "string"
|
|
214
|
+
};
|
|
215
|
+
var ACTION_BINDING_SCHEMA = {
|
|
216
|
+
properties: {
|
|
217
|
+
input: {
|
|
218
|
+
description: "The exact tool input to send (real ids you looked up, never placeholders)",
|
|
219
|
+
type: "object"
|
|
220
|
+
},
|
|
221
|
+
label: { description: "Button label", type: "string" },
|
|
222
|
+
tool: { description: "The tool name to invoke", type: "string" }
|
|
223
|
+
},
|
|
224
|
+
required: ["label", "tool", "input"],
|
|
225
|
+
type: "object"
|
|
226
|
+
};
|
|
180
227
|
var parseChartSpec = (input) => {
|
|
181
228
|
if (!isRecord(input))
|
|
182
229
|
return null;
|
|
@@ -216,6 +263,7 @@ var parseChartSpec = (input) => {
|
|
|
216
263
|
const actions = parseUiActions(input.actions);
|
|
217
264
|
if (actions)
|
|
218
265
|
spec.actions = actions;
|
|
266
|
+
applyCardId(spec, input.cardId);
|
|
219
267
|
return spec;
|
|
220
268
|
};
|
|
221
269
|
var parseTableSpec = (input) => {
|
|
@@ -242,6 +290,7 @@ var parseTableSpec = (input) => {
|
|
|
242
290
|
const actions = parseUiActions(input.actions);
|
|
243
291
|
if (actions)
|
|
244
292
|
spec.actions = actions;
|
|
293
|
+
applyCardId(spec, input.cardId);
|
|
245
294
|
return spec;
|
|
246
295
|
};
|
|
247
296
|
var parseStatTilesSpec = (input) => {
|
|
@@ -270,6 +319,7 @@ var parseStatTilesSpec = (input) => {
|
|
|
270
319
|
const actions = parseUiActions(input.actions);
|
|
271
320
|
if (actions)
|
|
272
321
|
spec.actions = actions;
|
|
322
|
+
applyCardId(spec, input.cardId);
|
|
273
323
|
return spec;
|
|
274
324
|
};
|
|
275
325
|
var parseFormField = (raw) => {
|
|
@@ -322,6 +372,188 @@ var parseFormSpec = (input) => {
|
|
|
322
372
|
const description = cleanString(input.description, DESCRIPTION_MAX_CHARS);
|
|
323
373
|
if (description)
|
|
324
374
|
spec.description = description;
|
|
375
|
+
applyCardId(spec, input.cardId);
|
|
376
|
+
return spec;
|
|
377
|
+
};
|
|
378
|
+
var parseChoiceOption = (raw) => {
|
|
379
|
+
if (!isRecord(raw))
|
|
380
|
+
return null;
|
|
381
|
+
const id = cleanId(raw.id);
|
|
382
|
+
const label = cleanString(raw.label, LABEL_MAX_CHARS);
|
|
383
|
+
if (!id || !label)
|
|
384
|
+
return null;
|
|
385
|
+
const option = { id, label };
|
|
386
|
+
const description = cleanString(raw.description, DESCRIPTION_MAX_CHARS);
|
|
387
|
+
if (description)
|
|
388
|
+
option.description = description;
|
|
389
|
+
const badge = cleanString(raw.badge, BADGE_MAX_CHARS);
|
|
390
|
+
if (badge)
|
|
391
|
+
option.badge = badge;
|
|
392
|
+
return option;
|
|
393
|
+
};
|
|
394
|
+
var parseChoiceSpec = (input) => {
|
|
395
|
+
if (!isRecord(input))
|
|
396
|
+
return null;
|
|
397
|
+
const title = cleanString(input.title, TITLE_MAX_CHARS);
|
|
398
|
+
const [submit] = parseUiActions([input.submit]) ?? [];
|
|
399
|
+
if (!title || !submit)
|
|
400
|
+
return null;
|
|
401
|
+
if (!Array.isArray(input.options) || input.options.length === 0)
|
|
402
|
+
return null;
|
|
403
|
+
const options = [];
|
|
404
|
+
const seen = new Set;
|
|
405
|
+
for (const raw of input.options.slice(0, CHOICE_MAX_OPTIONS)) {
|
|
406
|
+
const option = parseChoiceOption(raw);
|
|
407
|
+
if (!option || seen.has(option.id))
|
|
408
|
+
return null;
|
|
409
|
+
seen.add(option.id);
|
|
410
|
+
options.push(option);
|
|
411
|
+
}
|
|
412
|
+
const spec = { options, submit, title };
|
|
413
|
+
const description = cleanString(input.description, DESCRIPTION_MAX_CHARS);
|
|
414
|
+
if (description)
|
|
415
|
+
spec.description = description;
|
|
416
|
+
if (input.multi === true)
|
|
417
|
+
spec.multi = true;
|
|
418
|
+
applyCardId(spec, input.cardId);
|
|
419
|
+
return spec;
|
|
420
|
+
};
|
|
421
|
+
var parseConfirmSpec = (input) => {
|
|
422
|
+
if (!isRecord(input))
|
|
423
|
+
return null;
|
|
424
|
+
const title = cleanString(input.title, TITLE_MAX_CHARS);
|
|
425
|
+
const consequence = cleanString(input.consequence, CONFIRM_CONSEQUENCE_MAX_CHARS);
|
|
426
|
+
const confirmLabel = cleanString(input.confirmLabel, ACTION_LABEL_MAX_CHARS);
|
|
427
|
+
const [confirm] = parseUiActions([input.confirm]) ?? [];
|
|
428
|
+
if (!title || !consequence || !confirmLabel || !confirm)
|
|
429
|
+
return null;
|
|
430
|
+
const spec = { confirm, confirmLabel, consequence, title };
|
|
431
|
+
const cancelLabel = cleanString(input.cancelLabel, ACTION_LABEL_MAX_CHARS);
|
|
432
|
+
if (cancelLabel)
|
|
433
|
+
spec.cancelLabel = cancelLabel;
|
|
434
|
+
if (input.danger === true)
|
|
435
|
+
spec.danger = true;
|
|
436
|
+
applyCardId(spec, input.cardId);
|
|
437
|
+
return spec;
|
|
438
|
+
};
|
|
439
|
+
var parseDiffFile = (raw, budget) => {
|
|
440
|
+
if (!isRecord(raw))
|
|
441
|
+
return null;
|
|
442
|
+
const path = cleanString(raw.path, DIFF_PATH_MAX_CHARS);
|
|
443
|
+
if (!path || typeof raw.diff !== "string" || raw.diff.trim().length === 0) {
|
|
444
|
+
return null;
|
|
445
|
+
}
|
|
446
|
+
const lines = raw.diff.split(/\r?\n/).map((line) => line.slice(0, DIFF_LINE_MAX_CHARS));
|
|
447
|
+
const kept = lines.slice(0, Math.max(budget.remaining, 0));
|
|
448
|
+
budget.remaining -= kept.length;
|
|
449
|
+
const file = { diff: kept.join(`
|
|
450
|
+
`), path };
|
|
451
|
+
if (raw.truncated === true || kept.length < lines.length) {
|
|
452
|
+
file.truncated = true;
|
|
453
|
+
}
|
|
454
|
+
return file;
|
|
455
|
+
};
|
|
456
|
+
var parseDiffSpec = (input) => {
|
|
457
|
+
if (!isRecord(input))
|
|
458
|
+
return null;
|
|
459
|
+
const title = cleanString(input.title, TITLE_MAX_CHARS);
|
|
460
|
+
const [apply] = parseUiActions([input.apply]) ?? [];
|
|
461
|
+
if (!title || !apply)
|
|
462
|
+
return null;
|
|
463
|
+
if (!Array.isArray(input.files) || input.files.length === 0)
|
|
464
|
+
return null;
|
|
465
|
+
const budget = { remaining: DIFF_MAX_LINES };
|
|
466
|
+
const files = [];
|
|
467
|
+
for (const raw of input.files.slice(0, DIFF_MAX_FILES)) {
|
|
468
|
+
const file = parseDiffFile(raw, budget);
|
|
469
|
+
if (!file)
|
|
470
|
+
return null;
|
|
471
|
+
files.push(file);
|
|
472
|
+
}
|
|
473
|
+
const spec = { apply, files, title };
|
|
474
|
+
const [reject] = parseUiActions([input.reject]) ?? [];
|
|
475
|
+
if (reject)
|
|
476
|
+
spec.reject = reject;
|
|
477
|
+
const note = cleanString(input.note, DESCRIPTION_MAX_CHARS);
|
|
478
|
+
if (note)
|
|
479
|
+
spec.note = note;
|
|
480
|
+
applyCardId(spec, input.cardId);
|
|
481
|
+
return spec;
|
|
482
|
+
};
|
|
483
|
+
var parsePlanStep = (raw) => {
|
|
484
|
+
if (!isRecord(raw))
|
|
485
|
+
return null;
|
|
486
|
+
const id = cleanId(raw.id);
|
|
487
|
+
const label = cleanString(raw.label, LABEL_MAX_CHARS);
|
|
488
|
+
const status = PLAN_STEP_STATUSES.find((entry) => entry === raw.status);
|
|
489
|
+
if (!id || !label || !status)
|
|
490
|
+
return null;
|
|
491
|
+
const step = { id, label, status };
|
|
492
|
+
const detail = cleanString(raw.detail, CELL_MAX_CHARS);
|
|
493
|
+
if (detail)
|
|
494
|
+
step.detail = detail;
|
|
495
|
+
return step;
|
|
496
|
+
};
|
|
497
|
+
var parsePlanSpec = (input) => {
|
|
498
|
+
if (!isRecord(input))
|
|
499
|
+
return null;
|
|
500
|
+
const title = cleanString(input.title, TITLE_MAX_CHARS);
|
|
501
|
+
if (!title)
|
|
502
|
+
return null;
|
|
503
|
+
if (!Array.isArray(input.steps) || input.steps.length === 0)
|
|
504
|
+
return null;
|
|
505
|
+
const steps = [];
|
|
506
|
+
const seen = new Set;
|
|
507
|
+
for (const raw of input.steps.slice(0, PLAN_MAX_STEPS)) {
|
|
508
|
+
const step = parsePlanStep(raw);
|
|
509
|
+
if (!step || seen.has(step.id))
|
|
510
|
+
return null;
|
|
511
|
+
seen.add(step.id);
|
|
512
|
+
steps.push(step);
|
|
513
|
+
}
|
|
514
|
+
const spec = { steps, title };
|
|
515
|
+
const note = cleanString(input.note, DESCRIPTION_MAX_CHARS);
|
|
516
|
+
if (note)
|
|
517
|
+
spec.note = note;
|
|
518
|
+
applyCardId(spec, input.cardId);
|
|
519
|
+
return spec;
|
|
520
|
+
};
|
|
521
|
+
var parseCredentialKey = (raw) => {
|
|
522
|
+
if (!isRecord(raw))
|
|
523
|
+
return null;
|
|
524
|
+
const key = typeof raw.key === "string" && ENV_KEY_PATTERN.test(raw.key) ? raw.key : null;
|
|
525
|
+
if (!key)
|
|
526
|
+
return null;
|
|
527
|
+
const entry = { key, secret: raw.secret !== false };
|
|
528
|
+
const label = cleanString(raw.label, LABEL_MAX_CHARS);
|
|
529
|
+
if (label)
|
|
530
|
+
entry.label = label;
|
|
531
|
+
const docsUrl = cleanString(raw.docsUrl, DOCS_URL_MAX_CHARS);
|
|
532
|
+
if (docsUrl && DOCS_URL_PATTERN.test(docsUrl))
|
|
533
|
+
entry.docsUrl = docsUrl;
|
|
534
|
+
if (typeof raw.isSet === "boolean")
|
|
535
|
+
entry.isSet = raw.isSet;
|
|
536
|
+
return entry;
|
|
537
|
+
};
|
|
538
|
+
var parseCredentialSpec = (input) => {
|
|
539
|
+
if (!isRecord(input))
|
|
540
|
+
return null;
|
|
541
|
+
const title = cleanString(input.title, TITLE_MAX_CHARS);
|
|
542
|
+
if (!title)
|
|
543
|
+
return null;
|
|
544
|
+
if (!Array.isArray(input.keys) || input.keys.length === 0)
|
|
545
|
+
return null;
|
|
546
|
+
const keys = [];
|
|
547
|
+
const seen = new Set;
|
|
548
|
+
for (const raw of input.keys.slice(0, CREDENTIAL_MAX_KEYS)) {
|
|
549
|
+
const entry = parseCredentialKey(raw);
|
|
550
|
+
if (!entry || seen.has(entry.key))
|
|
551
|
+
return null;
|
|
552
|
+
seen.add(entry.key);
|
|
553
|
+
keys.push(entry);
|
|
554
|
+
}
|
|
555
|
+
const spec = { keys, title };
|
|
556
|
+
applyCardId(spec, input.cardId);
|
|
325
557
|
return spec;
|
|
326
558
|
};
|
|
327
559
|
var SERIES_SCHEMA = {
|
|
@@ -342,6 +574,7 @@ var chartCard = {
|
|
|
342
574
|
inputSchema: {
|
|
343
575
|
properties: {
|
|
344
576
|
actions: ACTIONS_SCHEMA,
|
|
577
|
+
cardId: CARD_ID_SCHEMA,
|
|
345
578
|
labels: {
|
|
346
579
|
description: "Category labels — x-axis for bar/line, slice names for donut (max 24)",
|
|
347
580
|
items: { type: "string" },
|
|
@@ -375,6 +608,7 @@ var tableCard = {
|
|
|
375
608
|
inputSchema: {
|
|
376
609
|
properties: {
|
|
377
610
|
actions: ACTIONS_SCHEMA,
|
|
611
|
+
cardId: CARD_ID_SCHEMA,
|
|
378
612
|
columns: {
|
|
379
613
|
description: "Column headers (max 8)",
|
|
380
614
|
items: { type: "string" },
|
|
@@ -399,6 +633,7 @@ var statTilesCard = {
|
|
|
399
633
|
inputSchema: {
|
|
400
634
|
properties: {
|
|
401
635
|
actions: ACTIONS_SCHEMA,
|
|
636
|
+
cardId: CARD_ID_SCHEMA,
|
|
402
637
|
tiles: {
|
|
403
638
|
description: "The tiles (max 6)",
|
|
404
639
|
items: {
|
|
@@ -431,6 +666,7 @@ var formCard = {
|
|
|
431
666
|
description: `Render an inline form when you need SEVERAL structured inputs from the member before running a tool (task details, scheduling constraints, outreach parameters) — one form beats asking field-by-field in prose. Bind submit to one of YOUR tools with any values you already know pre-filled in submit.input; on submit the member's field values are merged into submit.input under each field's name and the tool runs exactly like a clicked action button. Field names must therefore be the tool's actual input property names. Never use it for values you could look up yourself. Use type "password" for sensitive values (API keys, secrets, credentials) — the host renders it masked and never pre-fill a value for it.`,
|
|
432
667
|
inputSchema: {
|
|
433
668
|
properties: {
|
|
669
|
+
cardId: CARD_ID_SCHEMA,
|
|
434
670
|
description: {
|
|
435
671
|
description: "Optional one-line helper text under the title",
|
|
436
672
|
type: "string"
|
|
@@ -486,11 +722,229 @@ var formCard = {
|
|
|
486
722
|
name: "render_form",
|
|
487
723
|
parse: parseFormSpec
|
|
488
724
|
};
|
|
725
|
+
var choiceCard = {
|
|
726
|
+
ack: "(choice card rendered inline — the member picks an option, which runs the bound tool with their selection merged in. Do not re-ask in text; wait for the selection)",
|
|
727
|
+
description: "Render a structured choice card whenever the member must pick between concrete options (which plan, which duplicate record to keep, which time slot) — never ask them to 'reply 1 or 2' in prose. Give every option a stable id; on selection the host merges { choice: id } (or { choices: [ids] } when multi is true) into submit.input and invokes submit.tool exactly like a clicked action button, so put everything you already resolved into submit.input. Max 8 options.",
|
|
728
|
+
inputSchema: {
|
|
729
|
+
properties: {
|
|
730
|
+
cardId: CARD_ID_SCHEMA,
|
|
731
|
+
description: {
|
|
732
|
+
description: "Optional one-line helper text under the title",
|
|
733
|
+
type: "string"
|
|
734
|
+
},
|
|
735
|
+
multi: {
|
|
736
|
+
description: "Allow selecting several options — submits { choices: [ids] } instead of { choice: id }",
|
|
737
|
+
type: "boolean"
|
|
738
|
+
},
|
|
739
|
+
options: {
|
|
740
|
+
description: "The options to choose between (max 8)",
|
|
741
|
+
items: {
|
|
742
|
+
properties: {
|
|
743
|
+
badge: {
|
|
744
|
+
description: 'Tiny annotation beside the label, e.g. "recommended"',
|
|
745
|
+
type: "string"
|
|
746
|
+
},
|
|
747
|
+
description: {
|
|
748
|
+
description: "One-line explanation of the option",
|
|
749
|
+
type: "string"
|
|
750
|
+
},
|
|
751
|
+
id: {
|
|
752
|
+
description: "Stable option id merged into submit.input on selection (letters/digits/_/-)",
|
|
753
|
+
type: "string"
|
|
754
|
+
},
|
|
755
|
+
label: { description: "What the member sees", type: "string" }
|
|
756
|
+
},
|
|
757
|
+
required: ["id", "label"],
|
|
758
|
+
type: "object"
|
|
759
|
+
},
|
|
760
|
+
type: "array"
|
|
761
|
+
},
|
|
762
|
+
submit: {
|
|
763
|
+
...ACTION_BINDING_SCHEMA,
|
|
764
|
+
description: "The submit binding: the tool to run once a choice is made. The selection is merged into input as { choice: id } (or { choices: [ids] })"
|
|
765
|
+
},
|
|
766
|
+
title: { description: "The decision being made", type: "string" }
|
|
767
|
+
},
|
|
768
|
+
required: ["title", "options", "submit"],
|
|
769
|
+
type: "object"
|
|
770
|
+
},
|
|
771
|
+
name: "render_choice",
|
|
772
|
+
parse: parseChoiceSpec
|
|
773
|
+
};
|
|
774
|
+
var confirmCard = {
|
|
775
|
+
ack: "(confirmation card rendered inline — NOTHING has run yet; the action only runs if the member clicks confirm. Do not claim or assume it happened; wait for the outcome)",
|
|
776
|
+
description: "Render an explicit confirmation card before any destructive or irreversible action (deleting data, sending money or bulk email, cancelling a subscription). State the consequence in plain language — exactly what will happen. TRUST CONTRACT: the host invokes confirm ONLY on a real member click, never on your say-so; hosts SHOULD mint an unforgeable server-side confirmation token at click time and require it on the downstream action, so a confirmation can never be fabricated in text. Set danger: true for destructive styling. Rendering this card is never itself consent.",
|
|
777
|
+
inputSchema: {
|
|
778
|
+
properties: {
|
|
779
|
+
cancelLabel: {
|
|
780
|
+
description: 'Optional dismiss label, e.g. "Keep project"',
|
|
781
|
+
type: "string"
|
|
782
|
+
},
|
|
783
|
+
cardId: CARD_ID_SCHEMA,
|
|
784
|
+
confirm: {
|
|
785
|
+
...ACTION_BINDING_SCHEMA,
|
|
786
|
+
description: "The action to run ONLY when the member clicks confirm (fully-resolved input, real ids)"
|
|
787
|
+
},
|
|
788
|
+
confirmLabel: {
|
|
789
|
+
description: 'The confirm button label, e.g. "Delete project"',
|
|
790
|
+
type: "string"
|
|
791
|
+
},
|
|
792
|
+
consequence: {
|
|
793
|
+
description: "What will happen if confirmed, in plain language (max 500 chars)",
|
|
794
|
+
type: "string"
|
|
795
|
+
},
|
|
796
|
+
danger: {
|
|
797
|
+
description: "Render destructive (red) styling",
|
|
798
|
+
type: "boolean"
|
|
799
|
+
},
|
|
800
|
+
title: { description: "Short question being confirmed", type: "string" }
|
|
801
|
+
},
|
|
802
|
+
required: ["title", "consequence", "confirmLabel", "confirm"],
|
|
803
|
+
type: "object"
|
|
804
|
+
},
|
|
805
|
+
name: "render_confirm",
|
|
806
|
+
parse: parseConfirmSpec
|
|
807
|
+
};
|
|
808
|
+
var diffCard = {
|
|
809
|
+
ack: "(diff card rendered inline — the member reviews the changes and clicks apply or reject. Do not restate the diff in text and do not assume it was applied; wait for their decision)",
|
|
810
|
+
description: "Render proposed file changes as reviewable unified diffs before applying them (max 6 files and 400 diff lines total — oversized diffs are truncated for display with truncated: true, never rejected). The diffs are DISPLAY data: the host renders the +/- coloring and nothing executes from the text. Bind apply (and optionally reject) to YOUR tools with fully-resolved input; hosts SHOULD route apply through a click-minted server-side token exactly like a confirmation card, because applying changes is destructive.",
|
|
811
|
+
inputSchema: {
|
|
812
|
+
properties: {
|
|
813
|
+
apply: {
|
|
814
|
+
...ACTION_BINDING_SCHEMA,
|
|
815
|
+
description: "The action that applies the changes when the member clicks it"
|
|
816
|
+
},
|
|
817
|
+
cardId: CARD_ID_SCHEMA,
|
|
818
|
+
files: {
|
|
819
|
+
description: "The changed files (max 6, 400 diff lines total)",
|
|
820
|
+
items: {
|
|
821
|
+
properties: {
|
|
822
|
+
diff: {
|
|
823
|
+
description: "Unified diff text for this file (display only)",
|
|
824
|
+
type: "string"
|
|
825
|
+
},
|
|
826
|
+
path: { description: "File path being changed", type: "string" },
|
|
827
|
+
truncated: {
|
|
828
|
+
description: "Set true if you already cut the diff for size",
|
|
829
|
+
type: "boolean"
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
required: ["path", "diff"],
|
|
833
|
+
type: "object"
|
|
834
|
+
},
|
|
835
|
+
type: "array"
|
|
836
|
+
},
|
|
837
|
+
note: {
|
|
838
|
+
description: "Optional one-line note under the diffs",
|
|
839
|
+
type: "string"
|
|
840
|
+
},
|
|
841
|
+
reject: {
|
|
842
|
+
...ACTION_BINDING_SCHEMA,
|
|
843
|
+
description: "Optional action to run when the member rejects"
|
|
844
|
+
},
|
|
845
|
+
title: { description: "What the change set does", type: "string" }
|
|
846
|
+
},
|
|
847
|
+
required: ["title", "files", "apply"],
|
|
848
|
+
type: "object"
|
|
849
|
+
},
|
|
850
|
+
name: "render_diff",
|
|
851
|
+
parse: parseDiffSpec
|
|
852
|
+
};
|
|
853
|
+
var planCard = {
|
|
854
|
+
ack: "(plan rendered inline — as you work, re-emit render_plan with the SAME cardId and updated step statuses instead of narrating progress; do not restate the steps as text)",
|
|
855
|
+
description: "Render a live multi-step plan card (max 12 steps) when you start multi-step work. Display-only — it has no buttons. Set a cardId and give every step a stable id, then as you progress RE-EMIT this card with the SAME cardId and updated step statuses (pending / active / done / error): the host replaces the earlier render in place, so the member sees one live plan instead of a stack of copies.",
|
|
856
|
+
inputSchema: {
|
|
857
|
+
properties: {
|
|
858
|
+
cardId: CARD_ID_SCHEMA,
|
|
859
|
+
note: {
|
|
860
|
+
description: "Optional one-line note under the steps",
|
|
861
|
+
type: "string"
|
|
862
|
+
},
|
|
863
|
+
steps: {
|
|
864
|
+
description: "The plan steps in order (max 12)",
|
|
865
|
+
items: {
|
|
866
|
+
properties: {
|
|
867
|
+
detail: {
|
|
868
|
+
description: "One-line progress or error note under the label",
|
|
869
|
+
type: "string"
|
|
870
|
+
},
|
|
871
|
+
id: {
|
|
872
|
+
description: "Stable step id — keep it identical across re-emits (letters/digits/_/-)",
|
|
873
|
+
type: "string"
|
|
874
|
+
},
|
|
875
|
+
label: { description: "What this step does", type: "string" },
|
|
876
|
+
status: { enum: [...PLAN_STEP_STATUSES], type: "string" }
|
|
877
|
+
},
|
|
878
|
+
required: ["id", "label", "status"],
|
|
879
|
+
type: "object"
|
|
880
|
+
},
|
|
881
|
+
type: "array"
|
|
882
|
+
},
|
|
883
|
+
title: { description: "What the plan accomplishes", type: "string" }
|
|
884
|
+
},
|
|
885
|
+
required: ["title", "steps"],
|
|
886
|
+
type: "object"
|
|
887
|
+
},
|
|
888
|
+
name: "render_plan",
|
|
889
|
+
parse: parsePlanSpec
|
|
890
|
+
};
|
|
891
|
+
var credentialCard = {
|
|
892
|
+
ack: "(credential request rendered inline — the member enters the values in the host UI and they are stored outside this conversation; you will receive a message naming which keys were set, never the values. Do not ask for the values in text)",
|
|
893
|
+
description: "Render a credential-request card when setup needs environment values from the member (API keys, secrets, connection strings) — max 8 keys, each an ENV_STYLE name with an optional label and docs link. This card deliberately has NO submit binding and collects NOTHING through you: the host UI gathers the values and stores them outside the model loop (its own .env or secret store), then sends a continuation message naming WHICH keys were set — never the values. Never ask for secret values in plain text, and never attach values to this card (any value-like field is dropped).",
|
|
894
|
+
inputSchema: {
|
|
895
|
+
properties: {
|
|
896
|
+
cardId: CARD_ID_SCHEMA,
|
|
897
|
+
keys: {
|
|
898
|
+
description: "The environment keys to request (max 8)",
|
|
899
|
+
items: {
|
|
900
|
+
properties: {
|
|
901
|
+
docsUrl: {
|
|
902
|
+
description: "Where to obtain the credential (provider dashboard URL)",
|
|
903
|
+
type: "string"
|
|
904
|
+
},
|
|
905
|
+
isSet: {
|
|
906
|
+
description: "Already configured on the host — rendered as set, with a replace affordance",
|
|
907
|
+
type: "boolean"
|
|
908
|
+
},
|
|
909
|
+
key: {
|
|
910
|
+
description: 'Environment variable name, e.g. "STRIPE_SECRET_KEY"',
|
|
911
|
+
type: "string"
|
|
912
|
+
},
|
|
913
|
+
label: {
|
|
914
|
+
description: 'Human label, e.g. "Stripe secret key"',
|
|
915
|
+
type: "string"
|
|
916
|
+
},
|
|
917
|
+
secret: {
|
|
918
|
+
description: "Mask and never echo (default true — only set false for genuinely public values)",
|
|
919
|
+
type: "boolean"
|
|
920
|
+
}
|
|
921
|
+
},
|
|
922
|
+
required: ["key"],
|
|
923
|
+
type: "object"
|
|
924
|
+
},
|
|
925
|
+
type: "array"
|
|
926
|
+
},
|
|
927
|
+
title: {
|
|
928
|
+
description: 'What the credentials unlock, e.g. "Connect Stripe"',
|
|
929
|
+
type: "string"
|
|
930
|
+
}
|
|
931
|
+
},
|
|
932
|
+
required: ["title", "keys"],
|
|
933
|
+
type: "object"
|
|
934
|
+
},
|
|
935
|
+
name: "request_credentials",
|
|
936
|
+
parse: parseCredentialSpec
|
|
937
|
+
};
|
|
489
938
|
var BUILTIN_UI_CARDS = [
|
|
490
939
|
chartCard,
|
|
491
940
|
tableCard,
|
|
492
941
|
statTilesCard,
|
|
493
|
-
formCard
|
|
942
|
+
formCard,
|
|
943
|
+
choiceCard,
|
|
944
|
+
confirmCard,
|
|
945
|
+
diffCard,
|
|
946
|
+
planCard,
|
|
947
|
+
credentialCard
|
|
494
948
|
];
|
|
495
949
|
// src/ai/ui/svg.ts
|
|
496
950
|
var LIGHT_UI_THEME = {
|
|
@@ -712,28 +1166,46 @@ export {
|
|
|
712
1166
|
tableCard,
|
|
713
1167
|
statTilesCard,
|
|
714
1168
|
renderChartSvg,
|
|
1169
|
+
planCard,
|
|
715
1170
|
parseUiActions,
|
|
716
1171
|
parseTableSpec,
|
|
717
1172
|
parseStatTilesSpec,
|
|
1173
|
+
parsePlanSpec,
|
|
718
1174
|
parseFormSpec,
|
|
1175
|
+
parseDiffSpec,
|
|
1176
|
+
parseCredentialSpec,
|
|
1177
|
+
parseConfirmSpec,
|
|
1178
|
+
parseChoiceSpec,
|
|
719
1179
|
parseChartSpec,
|
|
720
1180
|
formCard,
|
|
1181
|
+
diffCard,
|
|
1182
|
+
credentialCard,
|
|
721
1183
|
createUiCards,
|
|
1184
|
+
confirmCard,
|
|
1185
|
+
choiceCard,
|
|
722
1186
|
chartCard,
|
|
723
1187
|
UI_ACTIONS_MAX,
|
|
724
1188
|
TABLE_MAX_ROWS,
|
|
725
1189
|
TABLE_MAX_COLUMNS,
|
|
726
1190
|
STAT_TILES_MAX,
|
|
1191
|
+
PLAN_STEP_STATUSES,
|
|
1192
|
+
PLAN_MAX_STEPS,
|
|
727
1193
|
LIGHT_UI_THEME,
|
|
728
1194
|
FORM_SELECT_MAX_OPTIONS,
|
|
729
1195
|
FORM_MAX_FIELDS,
|
|
730
1196
|
FORM_FIELD_TYPES,
|
|
1197
|
+
DIFF_MAX_LINES,
|
|
1198
|
+
DIFF_MAX_FILES,
|
|
731
1199
|
DARK_UI_THEME,
|
|
1200
|
+
CREDENTIAL_MAX_KEYS,
|
|
1201
|
+
CONFIRM_CONSEQUENCE_MAX_CHARS,
|
|
1202
|
+
CHOICE_MAX_OPTIONS,
|
|
732
1203
|
CHART_TYPES,
|
|
733
1204
|
CHART_MAX_SERIES,
|
|
734
1205
|
CHART_MAX_POINTS,
|
|
1206
|
+
CARD_ID_MAX_CHARS,
|
|
735
1207
|
BUILTIN_UI_CARDS
|
|
736
1208
|
};
|
|
737
1209
|
|
|
738
|
-
//# debugId=
|
|
1210
|
+
//# debugId=59E12D813D37D12064756E2164756E21
|
|
739
1211
|
//# sourceMappingURL=index.js.map
|