@jxsuite/studio 8.1.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{2020-dg097k3e.js → 2020-j56903f1.js} +3 -3
- package/dist/chunks/adapter-wc5zvg9a.js +4 -0
- package/dist/chunks/add-new-flow-snx1s4b0.js +4 -0
- package/dist/chunks/cf-account-picker-xyqw0jex.js +4 -0
- package/dist/chunks/cf-settings-hp1pjm0n.js +4 -0
- package/dist/chunks/color-04361ttk.js +4 -0
- package/dist/chunks/{color-area-vh9cew51.js → color-area-h8dbasp1.js} +2 -2
- package/dist/chunks/{color-field-e78f16bs.js → color-field-qv5r2b16.js} +3 -3
- package/dist/chunks/{color-slider-fg4yhvk6.js → color-slider-nz2mrzky.js} +2 -2
- package/dist/chunks/components-nkwphrx3.js +4 -0
- package/dist/chunks/content-source-6a253wmk.js +4 -0
- package/dist/chunks/{convert-to-repeater-grnmea6c.js → convert-to-repeater-fhdwyg14.js} +3 -3
- package/dist/chunks/editor-wqrc68ca.js +4 -0
- package/dist/chunks/entry-commands-nef0wrmp.js +4 -0
- package/dist/chunks/{extension-sections-rp7fkega.js → extension-sections-8ez2rrk8.js} +3 -3
- package/dist/chunks/file-ops-y3w71k1n.js +4 -0
- package/dist/chunks/files-de90apn9.js +4 -0
- package/dist/chunks/format-host-zfjz4rzm.js +4 -0
- package/dist/chunks/fs-events-77c0mr0x.js +4 -0
- package/dist/chunks/grid-open-4n4fjfpf.js +4 -0
- package/dist/chunks/{grid-view-x26rfpz1.js → grid-view-ka55z38f.js} +10 -10
- package/dist/chunks/{iframe-entry-pkgmcgp0.js → iframe-entry-2x9bn5ng.js} +4 -4
- package/dist/chunks/{iframe-entry-02wzcyvy.js → iframe-entry-btck0e9s.js} +4 -4
- package/dist/chunks/iframe-host-na2mywz4.js +4 -0
- package/dist/chunks/index-ewmgdb7c.js +4 -0
- package/dist/chunks/{index-203h71wy.js → index-qb98xhse.js} +3 -3
- package/dist/chunks/{javascript-ww5pv5ae.js → javascript-ces13wny.js} +2 -2
- package/dist/chunks/{jsonMode-vwbdwwq3.js → jsonMode-6md16d4v.js} +6 -6
- package/dist/chunks/jx-validate-b309c020.js +4 -0
- package/dist/chunks/layers-8rn8y6qv.js +4 -0
- package/dist/chunks/layers-panel-eyah7h9z.js +4 -0
- package/dist/chunks/lit-html-wyqw04y2.js +4 -0
- package/dist/chunks/media-library-gs3np47y.js +4 -0
- package/dist/chunks/media-picker-tt7dk4tb.js +4 -0
- package/dist/chunks/{monaco-binding-63tqze27.js → monaco-binding-p8j80s4w.js} +3 -3
- package/dist/chunks/monaco-buffer-wsf6cmnq.js +4 -0
- package/dist/chunks/{monaco-setup-zyyynnj8.js → monaco-setup-wasktzfg.js} +3 -3
- package/dist/chunks/notify-qwst108r.js +4 -0
- package/dist/chunks/parse-n8dfxnqf.js +4 -0
- package/dist/chunks/platform-c16mqvmp.js +4 -0
- package/dist/chunks/publish-panel-d34bhvwj.js +4 -0
- package/dist/chunks/{publish-quick-ajzdhhs6.js → publish-quick-vr695j26.js} +3 -3
- package/dist/chunks/publish-workspace-2yr60mt4.js +4 -0
- package/dist/chunks/quick-search-e6xsdv0d.js +4 -0
- package/dist/chunks/references-gsj6trdv.js +4 -0
- package/dist/chunks/right-panel-33jv1knc.js +4 -0
- package/dist/chunks/source-control-bj9bejjv.js +4 -0
- package/dist/chunks/studio-03mqh8ax.js +5 -0
- package/dist/chunks/{studio-957jg8g3.js → studio-06j4en5h.js} +4 -4
- package/dist/chunks/studio-0ydxv2mr.js +7 -0
- package/dist/chunks/{studio-v2ek69cb.js → studio-1e8dw2w2.js} +4 -4
- package/dist/chunks/studio-2hsqbq7b.js +7 -0
- package/dist/chunks/studio-2j86y34y.js +6 -0
- package/dist/chunks/studio-2ks6ka4g.js +5 -0
- package/dist/chunks/studio-34jrz12k.js +5 -0
- package/dist/chunks/{studio-1meqbxns.js → studio-35vrtpdq.js} +4 -4
- package/dist/chunks/studio-38g0jdz7.js +5 -0
- package/dist/chunks/{studio-25a5by3h.js → studio-396srjbk.js} +4 -4
- package/dist/chunks/{studio-zm7dnr9g.js → studio-3c8pp7pb.js} +4 -4
- package/dist/chunks/{studio-x3ge4rts.js → studio-3v5cagy9.js} +4 -4
- package/dist/chunks/studio-3w35qvay.js +5 -0
- package/dist/chunks/studio-3zge48z4.js +7 -0
- package/dist/chunks/studio-45gyxpcq.js +5 -0
- package/dist/chunks/{studio-hw60n5dh.js → studio-4kzbrr5t.js} +3 -3
- package/dist/chunks/{studio-533py3yy.js → studio-5tzgq6fx.js} +4 -4
- package/dist/chunks/studio-5wzdy1jc.js +16 -0
- package/dist/chunks/studio-732mw0g8.js +5 -0
- package/dist/chunks/{studio-3q6n9qvq.js → studio-771k2n12.js} +4 -4
- package/dist/chunks/{studio-z42kysg7.js → studio-7dzyz9n8.js} +137 -137
- package/dist/chunks/{studio-fqs1a22a.js → studio-7xag4na8.js} +4 -4
- package/dist/chunks/{studio-jqrg9xxg.js → studio-881z1xrx.js} +4 -4
- package/dist/chunks/studio-88bmt9rh.js +5 -0
- package/dist/chunks/{studio-8nyw10dp.js → studio-9b7177jq.js} +4 -4
- package/dist/chunks/{studio-nm9qev4p.js → studio-9cxmp61c.js} +5 -5
- package/dist/chunks/{studio-4dsdnan2.js → studio-9dz76yqc.js} +5 -5
- package/dist/chunks/{studio-a6x058ew.js → studio-agyvzfm4.js} +4 -4
- package/dist/chunks/{studio-2b8443ms.js → studio-ajw4k8hp.js} +3 -3
- package/dist/chunks/studio-c1pxszat.js +5 -0
- package/dist/chunks/studio-cpkamjdn.js +14 -0
- package/dist/chunks/studio-d038kqbs.js +5 -0
- package/dist/chunks/studio-d83m0wyq.js +5 -0
- package/dist/chunks/studio-dbxv7w4s.js +5 -0
- package/dist/chunks/studio-de1s2x9v.js +5 -0
- package/dist/chunks/{studio-94ppxeqy.js → studio-dx73md4n.js} +8 -8
- package/dist/chunks/studio-ekgtrndg.js +5 -0
- package/dist/chunks/studio-epenqmvk.js +7 -0
- package/dist/chunks/studio-et2q4s8n.js +5 -0
- package/dist/chunks/{studio-txkx6586.js → studio-ewarnzm4.js} +7 -7
- package/dist/chunks/{studio-bf0rgyf7.js → studio-fy7jzj9j.js} +4 -4
- package/dist/chunks/{studio-332hesdk.js → studio-gr36vnte.js} +4 -4
- package/dist/chunks/{studio-rdnezzkd.js → studio-gwrhcrss.js} +5 -5
- package/dist/chunks/{studio-9wyqyfqy.js → studio-h310mbqm.js} +4 -4
- package/dist/chunks/{studio-zht0x0v3.js → studio-h5tpz5ke.js} +4 -4
- package/dist/chunks/studio-h7weqf2q.js +5 -0
- package/dist/chunks/{studio-1gdfsr49.js → studio-hcsba201.js} +7 -7
- package/dist/chunks/studio-hwejq03c.js +5 -0
- package/dist/chunks/{studio-wcakp5bt.js → studio-hy4ye0dx.js} +7 -7
- package/dist/chunks/{studio-02phtmqn.js → studio-jttyqrmh.js} +4 -4
- package/dist/chunks/{studio-j5jqvyn3.js → studio-jw0q5j6k.js} +4 -4
- package/dist/chunks/studio-k3a8rp3d.js +5 -0
- package/dist/chunks/{studio-hnx1h1pr.js → studio-k3bcy02e.js} +4 -4
- package/dist/chunks/studio-m48v13s3.js +4 -0
- package/dist/chunks/{studio-bqgs90r8.js → studio-ndskgqef.js} +4 -4
- package/dist/chunks/studio-p1n2xjda.js +5 -0
- package/dist/chunks/studio-pgm83a2f.js +6 -0
- package/dist/chunks/studio-pqqq6v85.js +5 -0
- package/dist/chunks/studio-psh8mwnw.js +4 -0
- package/dist/chunks/{studio-cpdzrdgp.js → studio-r17asgs0.js} +4 -4
- package/dist/chunks/{studio-6vrxzkba.js → studio-ry81j4q1.js} +4 -4
- package/dist/chunks/studio-rzg8hnkf.js +5 -0
- package/dist/chunks/{studio-nsv7g1qn.js → studio-s0fg2wav.js} +4 -4
- package/dist/chunks/{studio-v0gsjav0.js → studio-tj2s0tks.js} +4 -4
- package/dist/chunks/studio-tyw7tk0x.js +5 -0
- package/dist/chunks/studio-v9ywz2se.js +6 -0
- package/dist/chunks/{studio-dmn7gpba.js → studio-vswcpzk7.js} +5 -5
- package/dist/chunks/studio-vzgmyt0v.js +5 -0
- package/dist/chunks/{studio-2dtc90zs.js → studio-wxdcd42g.js} +6 -6
- package/dist/chunks/{studio-c5dj3dzk.js → studio-wxhy1yh7.js} +4 -4
- package/dist/chunks/studio-x08a3m0a.js +5 -0
- package/dist/chunks/studio-x3mjr5cc.js +5 -0
- package/dist/chunks/{studio-xddgbwhe.js → studio-x97ay0v4.js} +4 -4
- package/dist/chunks/{studio-mmqr9awv.js → studio-xdpz9rpe.js} +33 -33
- package/dist/chunks/studio-xh683qzy.js +5 -0
- package/dist/chunks/{studio-hxq1ebp0.js → studio-xkxetm65.js} +6 -6
- package/dist/chunks/{studio-73wz63nn.js → studio-y26hx9re.js} +4 -4
- package/dist/chunks/{studio-kdseew9m.js → studio-yg3djpnm.js} +4 -4
- package/dist/chunks/studio-yx8hzqja.js +5 -0
- package/dist/chunks/studio-zg16eeq1.js +5 -0
- package/dist/chunks/studio-zgx7svjd.js +9 -0
- package/dist/chunks/studio-zkq3r91p.js +5 -0
- package/dist/chunks/{toast-host-1yg5ar8d.js → toast-host-g3r2s0kn.js} +2 -2
- package/dist/chunks/toast-w11qpkyz.js +4 -0
- package/dist/chunks/{tsMode-vra2hh7y.js → tsMode-h6tkz0ea.js} +5 -5
- package/dist/chunks/workspace-home-zkkrxq3r.js +4 -0
- package/dist/chunks/workspace-tdqqjqaa.js +4 -0
- package/dist/chunks/{ws-client-72x5n99j.js → ws-client-e951my95.js} +3 -3
- package/dist/iframe-entry.js +13 -13
- package/dist/manifest.json +77 -77
- package/dist/studio.js +91 -92
- package/package.json +11 -12
- package/src/canvas/iframe-editable-root.ts +32 -2
- package/src/collab/collab-session.ts +6 -2
- package/src/commands/context.ts +4 -0
- package/src/commands/defaults.ts +2 -0
- package/src/commands/live-context.ts +2 -0
- package/src/files/files.ts +6 -3
- package/src/format/format-host.ts +1 -1
- package/src/github/github-auth-status.ts +2 -2
- package/src/media/media-library.ts +73 -3
- package/src/new-project/new-project-modal.ts +1 -4
- package/src/packages/ensure-deps.ts +5 -5
- package/src/packages/pull-package-sync.ts +4 -4
- package/src/panels/activity-panel.ts +1 -1
- package/src/panels/ai-panel.ts +27 -34
- package/src/platform.ts +20 -0
- package/src/platforms/cloud.ts +48 -34
- package/src/platforms/devserver.ts +2 -120
- package/src/services/ai-ask.ts +29 -171
- package/src/services/ai-command-tools.ts +40 -50
- package/src/services/ai-import-tools.ts +4 -5
- package/src/services/ai-project-tools.ts +13 -3
- package/src/services/ai-tools.ts +26 -564
- package/src/services/ai-writes.ts +84 -2
- package/src/services/document-assistant.ts +29 -58
- package/src/services/harness/assistant-tools.ts +68 -0
- package/src/services/harness/interaction-store.ts +118 -0
- package/src/services/harness/studio-documents.ts +105 -0
- package/src/services/harness/turn-hooks.ts +1 -6
- package/src/services/project-adoption.ts +8 -16
- package/src/services/tool-executor.ts +25 -22
- package/src/settings/extension-commands.ts +1 -1
- package/src/settings/extension-rows.ts +1 -6
- package/src/settings/extensions-section.ts +3 -6
- package/src/state.ts +3 -13
- package/src/surfaces/block-action-bar.json +1 -3
- package/src/surfaces/files-panel.json +12 -0
- package/src/surfaces/files-panel.ts +5 -2
- package/src/surfaces/media-library.json +35 -0
- package/src/surfaces/media-library.ts +2 -0
- package/src/surfaces/menu.ts +62 -1
- package/src/surfaces/settings-packages.ts +1 -1
- package/src/surfaces/welcome.ts +4 -1
- package/src/tabs/selection.ts +14 -109
- package/src/tabs/tab.ts +10 -1
- package/src/tabs/transact.ts +316 -124
- package/src/types.ts +23 -16
- package/src/ui/layers.ts +1 -1
- package/src/ui/progress-modal.ts +3 -3
- package/dist/chunks/adapter-tck81zft.js +0 -4
- package/dist/chunks/add-new-flow-a1w0bnm6.js +0 -4
- package/dist/chunks/cf-account-picker-ce3kp3x1.js +0 -4
- package/dist/chunks/cf-settings-7ye6x7g2.js +0 -4
- package/dist/chunks/color-4gj49xq6.js +0 -4
- package/dist/chunks/components-qce0v93f.js +0 -4
- package/dist/chunks/content-source-jjx8kgzr.js +0 -4
- package/dist/chunks/editor-bkja5dbv.js +0 -4
- package/dist/chunks/entry-commands-1wh0btvg.js +0 -4
- package/dist/chunks/file-ops-6pe4z7an.js +0 -4
- package/dist/chunks/files-ybpp3j38.js +0 -4
- package/dist/chunks/format-host-3mtbhxk1.js +0 -4
- package/dist/chunks/fs-events-xfanfxds.js +0 -4
- package/dist/chunks/grid-open-dg5qmnaj.js +0 -4
- package/dist/chunks/iframe-host-j2bk2xkc.js +0 -4
- package/dist/chunks/index-fkrm7pdk.js +0 -4
- package/dist/chunks/jx-validate-w7v32f6a.js +0 -4
- package/dist/chunks/layers-g7j732cm.js +0 -4
- package/dist/chunks/layers-panel-gjrsxcck.js +0 -4
- package/dist/chunks/lit-html-jdfz9rhc.js +0 -4
- package/dist/chunks/media-library-9j0v4wmk.js +0 -4
- package/dist/chunks/media-picker-cpyyt2m0.js +0 -4
- package/dist/chunks/monaco-buffer-9wcme176.js +0 -4
- package/dist/chunks/notify-rahnnnv4.js +0 -4
- package/dist/chunks/parse-v77xtwv7.js +0 -4
- package/dist/chunks/platform-b2aqv7v5.js +0 -4
- package/dist/chunks/publish-panel-4yk2461b.js +0 -4
- package/dist/chunks/publish-workspace-mxestzcf.js +0 -4
- package/dist/chunks/quick-search-9g6z65b0.js +0 -4
- package/dist/chunks/references-c26enpxs.js +0 -4
- package/dist/chunks/right-panel-9d0e0yg7.js +0 -4
- package/dist/chunks/source-control-xyn3a8ds.js +0 -4
- package/dist/chunks/studio-0khd0xdw.js +0 -5
- package/dist/chunks/studio-1fvzq9vs.js +0 -5
- package/dist/chunks/studio-1yhz0s8p.js +0 -5
- package/dist/chunks/studio-2c2mjyzj.js +0 -6
- package/dist/chunks/studio-3pndhat0.js +0 -9
- package/dist/chunks/studio-4fjqdzrb.js +0 -6
- package/dist/chunks/studio-5abge3wy.js +0 -5
- package/dist/chunks/studio-74nzv280.js +0 -5
- package/dist/chunks/studio-7cg75gtj.js +0 -14
- package/dist/chunks/studio-89cwmnae.js +0 -5
- package/dist/chunks/studio-8m1t83kn.js +0 -7
- package/dist/chunks/studio-a3evp7f6.js +0 -6
- package/dist/chunks/studio-ana67wax.js +0 -5
- package/dist/chunks/studio-b4xhpcwy.js +0 -4
- package/dist/chunks/studio-c4rcaftm.js +0 -5
- package/dist/chunks/studio-cgjt1zce.js +0 -5
- package/dist/chunks/studio-cq87hree.js +0 -5
- package/dist/chunks/studio-d140sy8e.js +0 -5
- package/dist/chunks/studio-e1g64q43.js +0 -5
- package/dist/chunks/studio-e8pzjjhf.js +0 -5
- package/dist/chunks/studio-f8kz3krj.js +0 -7
- package/dist/chunks/studio-fw3jp9m7.js +0 -5
- package/dist/chunks/studio-g6ysm05p.js +0 -7
- package/dist/chunks/studio-gmhd0j3f.js +0 -5
- package/dist/chunks/studio-gqpty626.js +0 -5
- package/dist/chunks/studio-grp684wx.js +0 -5
- package/dist/chunks/studio-h98520qr.js +0 -5
- package/dist/chunks/studio-hvxt8z79.js +0 -5
- package/dist/chunks/studio-j4e627w1.js +0 -5
- package/dist/chunks/studio-kt2j51sa.js +0 -5
- package/dist/chunks/studio-m4w6sygj.js +0 -16
- package/dist/chunks/studio-nqxqf8p2.js +0 -4
- package/dist/chunks/studio-p89w12s2.js +0 -7
- package/dist/chunks/studio-pbagym4j.js +0 -5
- package/dist/chunks/studio-pr23qhrw.js +0 -5
- package/dist/chunks/studio-r4ya3sb2.js +0 -5
- package/dist/chunks/studio-rm9m3z60.js +0 -5
- package/dist/chunks/studio-tpmnbgmt.js +0 -5
- package/dist/chunks/studio-ttxhq5yt.js +0 -5
- package/dist/chunks/studio-y1x65h5r.js +0 -5
- package/dist/chunks/studio-zf188hnd.js +0 -5
- package/dist/chunks/toast-1gv0h53h.js +0 -4
- package/dist/chunks/workspace-3nt93k48.js +0 -4
- package/dist/chunks/workspace-home-zbgyqqws.js +0 -4
- package/src/services/directory-picker.ts +0 -187
- package/src/services/gated-registry.ts +0 -77
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
* @license MIT
|
|
61
61
|
*/
|
|
62
62
|
|
|
63
|
+
import { toolFacts } from "@jxsuite/ai/jx-tools";
|
|
63
64
|
import { createToolContext, toolError } from "@jxsuite/ai/tools";
|
|
64
65
|
import type {
|
|
65
66
|
ToolArguments,
|
|
@@ -82,6 +83,7 @@ import type { WriteReportDeps, WriteSnapshot } from "./ai-write-report";
|
|
|
82
83
|
import type { CommandContext } from "../commands/context";
|
|
83
84
|
import type { AiToolReport, AnyCommand, CommandRegistry } from "../commands/registry";
|
|
84
85
|
import type { Tab } from "../tabs/tab";
|
|
86
|
+
import { runAsActor } from "../tabs/transact";
|
|
85
87
|
|
|
86
88
|
/**
|
|
87
89
|
* The record a selection-level projection composes through.
|
|
@@ -214,8 +216,9 @@ function definitionOf(
|
|
|
214
216
|
} else {
|
|
215
217
|
parameters = command.args ?? EMPTY_ARGS;
|
|
216
218
|
}
|
|
217
|
-
|
|
219
|
+
const definition: ToolDefinition = {
|
|
218
220
|
name: tool.name,
|
|
221
|
+
title: command.title,
|
|
219
222
|
description: `${tool.description}${undoSuffix(command)}`,
|
|
220
223
|
/* SAFETY: `parameters` is an `argsSchema()` object (or the selector's composed from one), a
|
|
221
224
|
JSON Schema object whose only departures from `JSONSchema` are readonly arrays and a
|
|
@@ -227,6 +230,13 @@ function definitionOf(
|
|
|
227
230
|
llmStrict: false,
|
|
228
231
|
execute: (args, ctx) => execute(tool.name, args, ctx),
|
|
229
232
|
};
|
|
233
|
+
/* The facts are the table's, by tool name (`@jxsuite/ai/jx-tools`). A record with none projects a
|
|
234
|
+
tool without them, which the catalog refuses: that is the test that keeps the table whole. */
|
|
235
|
+
const facts = toolFacts(tool.name);
|
|
236
|
+
if (facts) {
|
|
237
|
+
definition.annotations = facts.annotations;
|
|
238
|
+
}
|
|
239
|
+
return definition;
|
|
230
240
|
}
|
|
231
241
|
|
|
232
242
|
/**
|
|
@@ -347,13 +357,21 @@ function fileLedger(
|
|
|
347
357
|
}
|
|
348
358
|
}
|
|
349
359
|
|
|
360
|
+
/** The command view, which also answers what the catalog asks of it. */
|
|
361
|
+
export interface CommandToolRegistry extends ToolRegistry {
|
|
362
|
+
/** Every record's projection, offered or not: the catalog's members from this side. */
|
|
363
|
+
readonly members: () => ToolDefinition[];
|
|
364
|
+
/** Whether the record projecting `name` is offered this round (its gate, and a non-empty enum). */
|
|
365
|
+
readonly advertises: (name: string) => boolean;
|
|
366
|
+
}
|
|
367
|
+
|
|
350
368
|
/**
|
|
351
369
|
* A ToolRegistry whose tools are the active registry's `aiTool` records. Nothing is registered.
|
|
352
370
|
*
|
|
353
371
|
* @param {CommandToolDeps} deps
|
|
354
|
-
* @returns {
|
|
372
|
+
* @returns {CommandToolRegistry}
|
|
355
373
|
*/
|
|
356
|
-
export function createCommandToolRegistry(deps: CommandToolDeps):
|
|
374
|
+
export function createCommandToolRegistry(deps: CommandToolDeps): CommandToolRegistry {
|
|
357
375
|
/** The record projecting `name`, enabled or not — so `execute` can reach a refusal. */
|
|
358
376
|
function commandFor(name: string): AnyCommand | undefined {
|
|
359
377
|
return activeRegistry()
|
|
@@ -408,10 +426,10 @@ export function createCommandToolRegistry(deps: CommandToolDeps): ToolRegistry {
|
|
|
408
426
|
const { paths, ...rest } = args;
|
|
409
427
|
await registry.run(SELECTOR, { paths });
|
|
410
428
|
before = registry.context();
|
|
411
|
-
await registry.run(command.id, rest);
|
|
429
|
+
await runAsActor(ctx.actor, () => registry.run(command.id, rest));
|
|
412
430
|
} else {
|
|
413
431
|
before = registry.context();
|
|
414
|
-
await registry.run(command.id, args);
|
|
432
|
+
await runAsActor(ctx.actor, () => registry.run(command.id, args));
|
|
415
433
|
}
|
|
416
434
|
} catch (error) {
|
|
417
435
|
return { error: error instanceof Error ? error.message : String(error), success: false };
|
|
@@ -507,52 +525,24 @@ export function createCommandToolRegistry(deps: CommandToolDeps): ToolRegistry {
|
|
|
507
525
|
return { valid: true };
|
|
508
526
|
},
|
|
509
527
|
execute,
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
* @param {ToolRegistry} hand
|
|
524
|
-
* @param {ToolRegistry} commands
|
|
525
|
-
* @returns {ToolRegistry}
|
|
526
|
-
*/
|
|
527
|
-
export function composeToolRegistries(hand: ToolRegistry, commands: ToolRegistry): ToolRegistry {
|
|
528
|
-
function sideOf(name: string): ToolRegistry | undefined {
|
|
529
|
-
if (hand.getDefinition(name)) {
|
|
530
|
-
return hand;
|
|
531
|
-
}
|
|
532
|
-
return commands.getDefinition(name) ? commands : undefined;
|
|
533
|
-
}
|
|
534
|
-
return {
|
|
535
|
-
register(tool) {
|
|
536
|
-
hand.register(tool);
|
|
537
|
-
},
|
|
538
|
-
list() {
|
|
539
|
-
return [...hand.list(), ...commands.list()];
|
|
540
|
-
},
|
|
541
|
-
listForLLM() {
|
|
542
|
-
return [...hand.listForLLM(), ...commands.listForLLM()];
|
|
543
|
-
},
|
|
544
|
-
getDefinition(name) {
|
|
545
|
-
return sideOf(name)?.getDefinition(name);
|
|
546
|
-
},
|
|
547
|
-
validate(name, args) {
|
|
548
|
-
const side = sideOf(name);
|
|
549
|
-
return side
|
|
550
|
-
? side.validate(name, args)
|
|
551
|
-
: { valid: false, errors: [`Unknown tool: "${name}"`] };
|
|
528
|
+
members() {
|
|
529
|
+
const registry = activeRegistry();
|
|
530
|
+
if (!registry) {
|
|
531
|
+
return [];
|
|
532
|
+
}
|
|
533
|
+
const definitions: ToolDefinition[] = [];
|
|
534
|
+
for (const command of projected(registry)) {
|
|
535
|
+
const definition = definitionOf(registry, command, execute);
|
|
536
|
+
if (definition) {
|
|
537
|
+
definitions.push(definition);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
return definitions;
|
|
552
541
|
},
|
|
553
|
-
|
|
554
|
-
const
|
|
555
|
-
|
|
542
|
+
advertises(name) {
|
|
543
|
+
const registry = activeRegistry();
|
|
544
|
+
const command = commandFor(name);
|
|
545
|
+
return registry !== null && command !== undefined && advertised(registry, command);
|
|
556
546
|
},
|
|
557
547
|
};
|
|
558
548
|
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* @license MIT
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
+
import { JX_TOOL_FACTS } from "@jxsuite/ai/jx-tools";
|
|
24
25
|
import { createToolDefinition, toolError, toolSuccess } from "@jxsuite/ai/tools";
|
|
25
26
|
import { IMPORT_MAX_PAGES } from "@jxsuite/protocol";
|
|
26
27
|
import { isBoolean, isNumber, isString } from "@jxsuite/schema/guards";
|
|
@@ -35,7 +36,6 @@ import { adoptCreatedProject } from "./project-adoption";
|
|
|
35
36
|
import type { AdoptCreatedOptions, AdoptOutcome } from "./project-adoption";
|
|
36
37
|
|
|
37
38
|
import type { JsonValue, ToolRegistry } from "@jxsuite/ai/tools";
|
|
38
|
-
import type { Tab } from "../tabs/tab";
|
|
39
39
|
import type {
|
|
40
40
|
ImportBreakpointPolicy,
|
|
41
41
|
ImportReadyEvent,
|
|
@@ -62,8 +62,6 @@ const DEFAULT_MIN_FIDELITY = 25;
|
|
|
62
62
|
const MAX_FIDELITY = 100;
|
|
63
63
|
|
|
64
64
|
export interface ImportToolsCtx {
|
|
65
|
-
/** The active tab, read AFTER adoption to re-anchor the agent loop's undo batch. */
|
|
66
|
-
getTab: () => Tab | null;
|
|
67
65
|
/** Open the imported project in this window. Defaults to the late-bound adopter. */
|
|
68
66
|
adoptProject?: (root: string) => Promise<void>;
|
|
69
67
|
/** Fired once adoption is VERIFIED — the session store re-keys the live chat here. */
|
|
@@ -269,7 +267,6 @@ function describeRun(id: string, root: string, summary?: ImportSiteSummary): str
|
|
|
269
267
|
export function registerImportTools(
|
|
270
268
|
registry: Pick<ToolRegistry, "register">,
|
|
271
269
|
{
|
|
272
|
-
getTab,
|
|
273
270
|
adoptProject,
|
|
274
271
|
onProjectAdopted,
|
|
275
272
|
brief: briefStore = { clear: clearPendingImportBrief, read: pendingImportBrief },
|
|
@@ -278,6 +275,8 @@ export function registerImportTools(
|
|
|
278
275
|
registry.register(
|
|
279
276
|
createToolDefinition({
|
|
280
277
|
name: "import_site",
|
|
278
|
+
title: "Import a site",
|
|
279
|
+
annotations: JX_TOOL_FACTS.import_site.annotations,
|
|
281
280
|
description:
|
|
282
281
|
"Clone a live website into a new Jx project and open it in the studio: pages, styles, " +
|
|
283
282
|
"assets, a shared layout and recurring components. Only available while no project is " +
|
|
@@ -454,7 +453,7 @@ export function registerImportTools(
|
|
|
454
453
|
* failure here is not the run's failure: the import continues either way, and the terminal
|
|
455
454
|
* path below reports honestly on whichever state the window ended up in.
|
|
456
455
|
*/
|
|
457
|
-
const adoptOptions: AdoptCreatedOptions = {
|
|
456
|
+
const adoptOptions: AdoptCreatedOptions = {};
|
|
458
457
|
if (adoptProject) {
|
|
459
458
|
adoptOptions.adopt = adoptProject;
|
|
460
459
|
}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* @license MIT
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { JX_TOOL_FACTS } from "@jxsuite/ai/jx-tools";
|
|
17
18
|
import { createToolDefinition } from "@jxsuite/ai/tools";
|
|
18
19
|
import { isJsonObject, isNumber } from "@jxsuite/schema/guards";
|
|
19
20
|
import type { CreateProjectDestination, StudioPlatform } from "../types";
|
|
@@ -64,7 +65,6 @@ interface ListedEntry {
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
export interface ProjectToolsCtx {
|
|
67
|
-
getTab: () => Tab | null;
|
|
68
68
|
validate?: (doc: CandidateDocument) => Promise<string[]>;
|
|
69
69
|
/**
|
|
70
70
|
* Gate for `project.json` writes — the per-project entry document, not the document schema. It
|
|
@@ -113,7 +113,6 @@ export interface ProjectToolsCtx {
|
|
|
113
113
|
export function registerProjectTools(
|
|
114
114
|
registry: Pick<ToolRegistry, "register">,
|
|
115
115
|
{
|
|
116
|
-
getTab,
|
|
117
116
|
validate = validateDoc,
|
|
118
117
|
validateProject = validateProjectConfig,
|
|
119
118
|
renderCheck,
|
|
@@ -130,6 +129,8 @@ export function registerProjectTools(
|
|
|
130
129
|
registry.register(
|
|
131
130
|
createToolDefinition({
|
|
132
131
|
name: "list_files",
|
|
132
|
+
title: "List files",
|
|
133
|
+
annotations: JX_TOOL_FACTS.list_files.annotations,
|
|
133
134
|
description:
|
|
134
135
|
"List the project's files recursively (paths relative to the project root, with type and " +
|
|
135
136
|
"size). Use this to discover pages, layouts, components, content, data, and styles before " +
|
|
@@ -199,6 +200,8 @@ export function registerProjectTools(
|
|
|
199
200
|
registry.register(
|
|
200
201
|
createToolDefinition({
|
|
201
202
|
name: "read_file",
|
|
203
|
+
title: "Read a file",
|
|
204
|
+
annotations: JX_TOOL_FACTS.read_file.annotations,
|
|
202
205
|
description:
|
|
203
206
|
"Read a project file's content by its project-relative path. Works for any text file " +
|
|
204
207
|
"(Jx documents, markdown, CSS, data). Large files are truncated.",
|
|
@@ -247,6 +250,8 @@ export function registerProjectTools(
|
|
|
247
250
|
registry.register(
|
|
248
251
|
createToolDefinition({
|
|
249
252
|
name: "write_file",
|
|
253
|
+
title: "Write a file",
|
|
254
|
+
annotations: JX_TOOL_FACTS.write_file.annotations,
|
|
250
255
|
description:
|
|
251
256
|
"Write a project file (create or overwrite) at a project-relative path. Jx documents " +
|
|
252
257
|
"(.json under pages/, layouts/, components/) are schema-validated and render-checked " +
|
|
@@ -422,6 +427,8 @@ export function registerProjectTools(
|
|
|
422
427
|
registry.register(
|
|
423
428
|
createToolDefinition({
|
|
424
429
|
name: "search_files",
|
|
430
|
+
title: "Search files",
|
|
431
|
+
annotations: JX_TOOL_FACTS.search_files.annotations,
|
|
425
432
|
description:
|
|
426
433
|
"Search project files by file NAME (not content). Returns matching paths. Use list_files " +
|
|
427
434
|
"for a directory overview and read_file to inspect contents.",
|
|
@@ -465,6 +472,8 @@ export function registerProjectTools(
|
|
|
465
472
|
registry.register(
|
|
466
473
|
createToolDefinition({
|
|
467
474
|
name: "create_project",
|
|
475
|
+
title: "Create a project",
|
|
476
|
+
annotations: JX_TOOL_FACTS.create_project.annotations,
|
|
468
477
|
description:
|
|
469
478
|
"Create a new Jx project (project.json, conventional directories, starter pages) and open " +
|
|
470
479
|
"it in the studio. Only available while no project is open. After it succeeds, the file " +
|
|
@@ -625,7 +634,6 @@ export function registerProjectTools(
|
|
|
625
634
|
*/
|
|
626
635
|
const { adopted, error: adoptionError } = await adoptCreatedProject(result.root, {
|
|
627
636
|
adopt: adoptProject,
|
|
628
|
-
getTab,
|
|
629
637
|
});
|
|
630
638
|
if (adopted) {
|
|
631
639
|
onProjectAdopted?.(result.root);
|
|
@@ -653,6 +661,8 @@ export function registerProjectTools(
|
|
|
653
661
|
registry.register(
|
|
654
662
|
createToolDefinition({
|
|
655
663
|
name: "list_starters",
|
|
664
|
+
title: "List starters",
|
|
665
|
+
annotations: JX_TOOL_FACTS.list_starters.annotations,
|
|
656
666
|
description:
|
|
657
667
|
"List the starter templates available for new projects (id, name, description). " +
|
|
658
668
|
"Currently informational — create_project scaffolds from built-in template variants.",
|