@agentdocumentformat/cli 0.8.0 → 0.8.1
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/adf.mjs +6 -6
- package/dist/chunks/{App-A5GUFCFJ.mjs → App-4AZZJNN2.mjs} +511 -406
- package/dist/chunks/{adf-schema-YJSGLMA4.mjs → adf-schema-AIPBQTR2.mjs} +9 -3
- package/dist/chunks/{chunk-AZYOXXVL.mjs → chunk-2Z7X3UUR.mjs} +11 -198
- package/dist/chunks/{chunk-4OGZFUKA.mjs → chunk-7JZXMDDF.mjs} +33 -1
- package/dist/chunks/{chunk-V2T6NZX2.mjs → chunk-AEAJDCVK.mjs} +1 -1
- package/dist/chunks/{chunk-NZO5O4VN.mjs → chunk-BR3AD5QZ.mjs} +7 -1
- package/dist/chunks/{chunk-WVTPPOKK.mjs → chunk-BS3USVEA.mjs} +14 -3
- package/dist/chunks/{chunk-JVPZIMXW.mjs → chunk-D7A77SNL.mjs} +1 -1
- package/dist/chunks/{chunk-LCMANRYY.mjs → chunk-E7LC6SHP.mjs} +1 -1
- package/dist/chunks/{chunk-LGL6ML37.mjs → chunk-F3WSCAJD.mjs} +1 -1
- package/dist/chunks/{chunk-6XQZGYMK.mjs → chunk-IMVMSU3A.mjs} +6 -2
- package/dist/chunks/{chunk-C4GA5SI4.mjs → chunk-KCIRFUZH.mjs} +2 -2
- package/dist/chunks/{chunk-YRMKSHW3.mjs → chunk-LVF2DRBR.mjs} +25 -12
- package/dist/chunks/{chunk-PRPTKMQW.mjs → chunk-RHBGCOS3.mjs} +2 -2
- package/dist/chunks/{chunk-WX6QCUWI.mjs → chunk-RJDOVMM4.mjs} +95 -12
- package/dist/chunks/{chunk-G6NBFYG5.mjs → chunk-SOSPQPEN.mjs} +189 -0
- package/dist/chunks/chunk-VENQBMOA.mjs +62 -0
- package/dist/chunks/{chunk-XT2BJUFC.mjs → chunk-YRBFIDLB.mjs} +33 -6
- package/dist/chunks/{claude-subscription-33BMZB6I.mjs → claude-subscription-EB4LAAVV.mjs} +3 -3
- package/dist/chunks/{cli-I47IFDHJ.mjs → cli-PCVFB6B4.mjs} +5 -5
- package/dist/chunks/{commands-E4EQUHE5.mjs → commands-KOMPXJZS.mjs} +3 -3
- package/dist/chunks/{daemon-FQ5BV3AP.mjs → daemon-BVDB565V.mjs} +729 -111
- package/dist/chunks/{daemon-control-L3CLG63P.mjs → daemon-control-MKN7G5M3.mjs} +4 -4
- package/dist/chunks/{layout-EPJQNFAI.mjs → layout-ECWGJF6M.mjs} +2 -2
- package/dist/chunks/{open-TLGS2Z3Q.mjs → open-3OR6WT4T.mjs} +4 -4
- package/dist/chunks/{pipeline-executor-FD4FBWQA.mjs → pipeline-executor-DRYEEFDR.mjs} +4 -4
- package/dist/chunks/{remote-access-cli-XXAPQWH6.mjs → remote-access-cli-GLEEP7DI.mjs} +2 -2
- package/dist/chunks/sdk-OJOAF4DP.mjs +30014 -0
- package/dist/chunks/{store-ZRN2WCFB.mjs → store-55CQSAOX.mjs} +3 -2
- package/dist/chunks/{tui-SPSPDADM.mjs → tui-RAUVFOYY.mjs} +11 -11
- package/package.json +1 -1
- package/dist/chunks/sdk-5FD2ZP7N.mjs +0 -28422
- package/dist/chunks/{chunk-APRU6PHC.mjs → chunk-JZ7AQNPM.mjs} +3 -3
|
@@ -14,20 +14,25 @@ import {
|
|
|
14
14
|
cjs
|
|
15
15
|
} from "./chunk-SGUTYISF.mjs";
|
|
16
16
|
import {
|
|
17
|
-
loop_parser_exports
|
|
18
|
-
|
|
17
|
+
loop_parser_exports,
|
|
18
|
+
owner_command_row_exports
|
|
19
|
+
} from "./chunk-7JZXMDDF.mjs";
|
|
19
20
|
import {
|
|
20
21
|
require_react
|
|
21
22
|
} from "./chunk-6GJ4QHRI.mjs";
|
|
22
23
|
import {
|
|
23
24
|
file_ref_exports
|
|
24
25
|
} from "./chunk-LKFHERRV.mjs";
|
|
26
|
+
import {
|
|
27
|
+
agent_commands_exports
|
|
28
|
+
} from "./chunk-VENQBMOA.mjs";
|
|
25
29
|
import {
|
|
26
30
|
__toESM
|
|
27
31
|
} from "./chunk-M2RX3S2T.mjs";
|
|
28
32
|
|
|
29
33
|
// src/main/tui/state/store.tsx
|
|
30
34
|
var import_react = __toESM(require_react(), 1);
|
|
35
|
+
import { randomUUID } from "node:crypto";
|
|
31
36
|
|
|
32
37
|
// src/main/tui/api/types.ts
|
|
33
38
|
var shared = cjs(types_exports), MAIN_LOOP = shared.MAIN_LOOP, DaemonError = shared.DaemonError, isCredentialsLocked = shared.isCredentialsLocked, SUPPORTED_CLIENT_API_VERSION = shared.SUPPORTED_CLIENT_API_VERSION;
|
|
@@ -192,7 +197,13 @@ function historyToItems(entries) {
|
|
|
192
197
|
items.push({ ...base, kind: "user", text: entry.content, origin: "runtime" });
|
|
193
198
|
break;
|
|
194
199
|
case "context":
|
|
195
|
-
meta.category === "loop" && typeof meta.fromLoop == "string" ? items.push({ ...base, kind: "user", text: entry.content, origin: "loop", from: meta.fromLoop }) : meta.category === "runtime" ? items.push({ ...base, kind: "user", text: entry.content, origin: "runtime" }) : items.push({
|
|
200
|
+
meta.category === "loop" && typeof meta.fromLoop == "string" ? items.push({ ...base, kind: "user", text: entry.content, origin: "loop", from: meta.fromLoop }) : meta.category === "runtime" ? items.push({ ...base, kind: "user", text: entry.content, origin: "runtime" }) : items.push({
|
|
201
|
+
...base,
|
|
202
|
+
kind: "context",
|
|
203
|
+
category: String(meta.category ?? "context"),
|
|
204
|
+
text: entry.content,
|
|
205
|
+
...meta.category === "owner_command" ? { ownerCommand: meta.ownerCommand } : {}
|
|
206
|
+
});
|
|
196
207
|
break;
|
|
197
208
|
case "compaction":
|
|
198
209
|
items.push({ ...base, kind: "context", category: "compaction", text: entry.content });
|
|
@@ -243,7 +254,7 @@ function mergeHistory(existing, incoming) {
|
|
|
243
254
|
if (item.kind !== "tool" || item.taskRef === void 0 || !item.toolUseId) return item;
|
|
244
255
|
let live = finished.get(item.toolUseId);
|
|
245
256
|
return live ? { ...item, status: live.status, result: live.result, completedAt: live.completedAt } : item;
|
|
246
|
-
}), historyTools = /* @__PURE__ */ new Set(), historyTexts = /* @__PURE__ */ new Map(), countText = (key) => historyTexts.set(key, (historyTexts.get(key) ?? 0) + 1);
|
|
257
|
+
}), historyTools = /* @__PURE__ */ new Set(), historyCommands = new Set(history.flatMap((item) => item.kind === "context" && item.ownerCommand ? [item.ownerCommand.id] : [])), historyTexts = /* @__PURE__ */ new Map(), countText = (key) => historyTexts.set(key, (historyTexts.get(key) ?? 0) + 1);
|
|
247
258
|
for (let item of history)
|
|
248
259
|
item.kind === "tool" && item.toolUseId && historyTools.add(item.toolUseId), (item.kind === "user" || item.kind === "assistant" || item.kind === "thinking") && countText(`${item.kind}:${item.text.trim()}`), item.kind === "tool" && item.name === "ask" && countText(`ask:${askQuestion(item.input).trim()}`);
|
|
249
260
|
let consume = (key) => {
|
|
@@ -259,7 +270,7 @@ function mergeHistory(existing, incoming) {
|
|
|
259
270
|
case "thinking":
|
|
260
271
|
return !consume(`${item.kind}:${item.text.trim()}`);
|
|
261
272
|
case "context":
|
|
262
|
-
return !
|
|
273
|
+
return !!item.ownerCommand && !historyCommands.has(item.ownerCommand.id);
|
|
263
274
|
case "ask":
|
|
264
275
|
return !consume(`ask:${item.question.trim()}`);
|
|
265
276
|
default:
|
|
@@ -272,7 +283,9 @@ function prependHistory(existing, older) {
|
|
|
272
283
|
let ids = new Set(existing.map((item) => item.id)), orphans = /* @__PURE__ */ new Map();
|
|
273
284
|
for (let item of existing)
|
|
274
285
|
item.kind === "tool" && !item.local && item.toolUseId && item.status !== "running" && orphans.set(item.toolUseId, item);
|
|
275
|
-
let merged = /* @__PURE__ */ new Set();
|
|
286
|
+
let merged = /* @__PURE__ */ new Set(), commands = new Set(older.flatMap((item) => item.kind === "context" && item.ownerCommand ? [item.ownerCommand.id] : []));
|
|
287
|
+
for (let item of existing)
|
|
288
|
+
item.local && item.kind === "context" && item.ownerCommand && commands.has(item.ownerCommand.id) && (merged.add(item), ids.delete(item.id));
|
|
276
289
|
return [...older.filter((item) => !ids.has(item.id)).map((item) => {
|
|
277
290
|
if (item.kind !== "tool" || item.status !== "running" || !item.toolUseId) return item;
|
|
278
291
|
let result = orphans.get(item.toolUseId);
|
|
@@ -675,6 +688,13 @@ function tuiReducer(state, action) {
|
|
|
675
688
|
return patchTranscript(state, action.key, (t) => ({ ...t, loading: !1, error: action.error }));
|
|
676
689
|
case "transcript/append":
|
|
677
690
|
return patchTranscript(state, action.key, (t) => ({ ...t, items: [...t.items, action.item] }));
|
|
691
|
+
case "transcript/owner-command":
|
|
692
|
+
return patchTranscript(state, action.key, (t) => {
|
|
693
|
+
let matches = (item) => item.kind === "context" && item.ownerCommand?.id === action.item.ownerCommand?.id, existing = t.items.find(matches);
|
|
694
|
+
return existing?.seq !== void 0 && (action.item.seq === void 0 || existing.seq === action.item.seq) ? t : { ...t, items: [...t.items.filter((item) => !matches(item)), action.item] };
|
|
695
|
+
});
|
|
696
|
+
case "transcript/remove":
|
|
697
|
+
return patchTranscript(state, action.key, (t) => ({ ...t, items: t.items.filter((item) => item.id !== action.id || item.seq !== void 0) }));
|
|
678
698
|
case "transcript/update":
|
|
679
699
|
return patchTranscript(state, action.key, (t) => {
|
|
680
700
|
let index = t.items.findIndex((item) => item.id === action.id);
|
|
@@ -868,7 +888,7 @@ function num(value) {
|
|
|
868
888
|
}
|
|
869
889
|
|
|
870
890
|
// src/main/tui/state/client-stream.ts
|
|
871
|
-
var MAIN = "main", NONE = { frames: [] };
|
|
891
|
+
var { parseOwnerCommandRow } = cjs(owner_command_row_exports), TUI_CLIENT_NAME = "tui", MAIN = "main", NONE = { frames: [] };
|
|
872
892
|
function clientFrameEffects(frame) {
|
|
873
893
|
if (frame.kind === "umbilical") return { frames: [{ cursor: frame.cursor, event: frame.event }] };
|
|
874
894
|
if (frame.kind === "push" && frame.topic === "daemon_orphan_hold") {
|
|
@@ -878,6 +898,20 @@ function clientFrameEffects(frame) {
|
|
|
878
898
|
if (frame.kind !== "executor") return NONE;
|
|
879
899
|
let { event, agentId } = frame, loop = frame.loop ?? event.loop ?? MAIN, payload = event.payload ?? {};
|
|
880
900
|
switch (event.type) {
|
|
901
|
+
case "context_injected": {
|
|
902
|
+
if (payload.category !== "owner_command") return NONE;
|
|
903
|
+
let record = typeof payload.content == "string" ? parseOwnerCommandRow(payload.content) : null;
|
|
904
|
+
return !record || typeof payload.seq != "number" ? { frames: [], reload: { agentId, loop } } : { frames: [], ownerCommand: { agentId, loop, item: {
|
|
905
|
+
id: `command:${record.header.id}`,
|
|
906
|
+
at: event.timestamp,
|
|
907
|
+
local: !0,
|
|
908
|
+
seq: payload.seq,
|
|
909
|
+
kind: "context",
|
|
910
|
+
category: "owner_command",
|
|
911
|
+
ownerCommand: record.header,
|
|
912
|
+
text: record.body
|
|
913
|
+
} } };
|
|
914
|
+
}
|
|
881
915
|
case "text_delta":
|
|
882
916
|
case "text_delta_batch":
|
|
883
917
|
case "thinking_delta":
|
|
@@ -994,7 +1028,7 @@ function serverText(server) {
|
|
|
994
1028
|
}
|
|
995
1029
|
|
|
996
1030
|
// src/main/tui/state/store.tsx
|
|
997
|
-
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1), TUI_MIN_CLIENT_API_VERSION = 1, REFRESH_DEBOUNCE_MS = 120, WEB_EVENT_DEBOUNCE_MS = 900, RESUME_VERDICT_MS = 1500, WEB_POLL_MS = 2e4, TRACKED_POLL_MS = 15e3, FOLDER_OVERLAY = "fleet.track", PROMPT_PREFILL_KEY = "shell.prompt.prefill", CHAT_VIEW_ID = "chat";
|
|
1031
|
+
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1), { parseAuthorizeToken } = cjs(agent_commands_exports), TUI_MIN_CLIENT_API_VERSION = 1, REFRESH_DEBOUNCE_MS = 120, WEB_EVENT_DEBOUNCE_MS = 900, RESUME_VERDICT_MS = 1500, WEB_POLL_MS = 2e4, TRACKED_POLL_MS = 15e3, FOLDER_OVERLAY = "fleet.track", PROMPT_PREFILL_KEY = "shell.prompt.prefill", CHAT_VIEW_ID = "chat";
|
|
998
1032
|
function createTuiStore(options) {
|
|
999
1033
|
let client = options.client, plain = options.client, current = new WeakSet([client]), pageSize = options.pageSize ?? 100, state = initialState(client.baseUrl, options.initialView), selectionRevision = 0, listeners = /* @__PURE__ */ new Set(), confirmResolvers = /* @__PURE__ */ new Map(), toastTimers = /* @__PURE__ */ new Map(), debounced = /* @__PURE__ */ new Map(), stream = null, sessionId = null, fallbackNoticed = !1, sessionRetry = !1, reopening = !1, focusSent, focusInFlight = !1, focusRetryAt = 0, lastResyncAt = 0, webTick = null, trackedTick = null, stopped = !1, needsResync = !1, resumeFallback = null, getState = () => state, dispatch = (action) => {
|
|
1000
1034
|
let next = tuiReducer(state, action);
|
|
@@ -1282,6 +1316,45 @@ function createTuiStore(options) {
|
|
|
1282
1316
|
return dispatch({ type: "transcript/update", key, id: item.id, patch: { pending: !1 } }), dispatch({ type: "transcript/append", key, item: { id: localId(), at: Date.now(), local: !0, kind: "error", text: `Not sent: ${describe(err)}` } }), !1;
|
|
1283
1317
|
}
|
|
1284
1318
|
},
|
|
1319
|
+
async runAgentCommand(agentId, loop, name, rawArgs) {
|
|
1320
|
+
let c = client;
|
|
1321
|
+
if (isTrackedKey(agentId)) {
|
|
1322
|
+
toast(`Agent is off. Start it, then run /${name} again.`, "warn");
|
|
1323
|
+
return;
|
|
1324
|
+
}
|
|
1325
|
+
if (rawArgs.includes(`
|
|
1326
|
+
`) || rawArgs.includes("\r") || rawArgs.length > 4096) {
|
|
1327
|
+
toast(`/${name}: arguments must be one line of at most 4096 characters.`, "warn");
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
let { args, authorize } = parseAuthorizeToken(rawArgs), requestId = randomUUID(), key = transcriptKey(agentId, loop), registered = state.agents[agentId]?.config?.commands, lambda = Array.isArray(registered) ? registered.find((command) => command?.name === name)?.lambda : void 0, item = {
|
|
1331
|
+
id: `command:${requestId}`,
|
|
1332
|
+
at: Date.now(),
|
|
1333
|
+
local: !0,
|
|
1334
|
+
kind: "context",
|
|
1335
|
+
category: "owner_command",
|
|
1336
|
+
text: "",
|
|
1337
|
+
ownerCommand: { v: 1, id: requestId, command: `/${name}${args ? ` ${args}` : ""}`, lambda: typeof lambda == "string" ? lambda : "", authorized: authorize, status: "running", duration_ms: 0 }
|
|
1338
|
+
};
|
|
1339
|
+
dispatch({ type: "transcript/owner-command", key, item });
|
|
1340
|
+
try {
|
|
1341
|
+
let result = await c.runCommand(agentId, name, { args, authorize, loop, requestId });
|
|
1342
|
+
if (stale(c) || stopped) return;
|
|
1343
|
+
dispatch({ type: "transcript/owner-command", key, item: {
|
|
1344
|
+
...item,
|
|
1345
|
+
seq: result.seq,
|
|
1346
|
+
text: result.result,
|
|
1347
|
+
deferred: result.deferred,
|
|
1348
|
+
unrecorded: !result.deferred && result.seq === void 0,
|
|
1349
|
+
ownerCommand: { ...item.ownerCommand, authorized: result.authorized, status: result.status, duration_ms: result.durationMs }
|
|
1350
|
+
} });
|
|
1351
|
+
let label = `${agentLabel(agentId)} /${name} (${loop})`;
|
|
1352
|
+
toast(`${label}: ${result.status === "denied" ? "permission denied; add !authorize for one authorized run" : result.status}${result.deferred ? " \u2014 recording after the current step" : ""}`, result.status === "ok" ? "success" : result.status === "denied" ? "warn" : "error");
|
|
1353
|
+
} catch (err) {
|
|
1354
|
+
if (stale(c) || stopped) return;
|
|
1355
|
+
dispatch({ type: "transcript/remove", key, id: item.id }), err instanceof DaemonError && err.unreachable && dispatch({ type: "daemon/reachable", reachable: !1 }), toast(`/${name}: ${describe(err)}`, "error");
|
|
1356
|
+
}
|
|
1357
|
+
},
|
|
1285
1358
|
async clearLoopHistory(agentId, loop) {
|
|
1286
1359
|
await run("Clear", (c) => c.clearChat(agentId, loop)) && (dispatch({ type: "transcript/reset", key: transcriptKey(agentId, loop) }), toast(`Cleared ${loop} history`, "success"), await actions.refreshLoops(agentId));
|
|
1287
1360
|
},
|
|
@@ -1451,6 +1524,11 @@ function createTuiStore(options) {
|
|
|
1451
1524
|
}, WEB_EVENT_DEBOUNCE_MS), !agentId || !state.agents[agentId]) return;
|
|
1452
1525
|
let loop = eventLoop(event), key = transcriptKey(agentId, loop);
|
|
1453
1526
|
switch (event.event_type) {
|
|
1527
|
+
case "context.injected":
|
|
1528
|
+
event.payload?.category === "owner_command" && debounce(`t:${key}`, () => {
|
|
1529
|
+
actions.loadTranscript(agentId, loop);
|
|
1530
|
+
});
|
|
1531
|
+
break;
|
|
1454
1532
|
case "turn.completed":
|
|
1455
1533
|
case "loop.cleared":
|
|
1456
1534
|
case "loop.compacted":
|
|
@@ -1534,6 +1612,11 @@ function createTuiStore(options) {
|
|
|
1534
1612
|
function onClientFrame(frame) {
|
|
1535
1613
|
let effects = clientFrameEffects(frame);
|
|
1536
1614
|
for (let envelope of effects.frames) onFrame(envelope);
|
|
1615
|
+
if (effects.ownerCommand) {
|
|
1616
|
+
flushFrames();
|
|
1617
|
+
let { agentId, loop, item } = effects.ownerCommand;
|
|
1618
|
+
dispatch({ type: "transcript/owner-command", key: transcriptKey(agentId, loop), item });
|
|
1619
|
+
}
|
|
1537
1620
|
if (effects.toolResult) {
|
|
1538
1621
|
flushFrames();
|
|
1539
1622
|
let { agentId, loop, toolUseId, result, isError } = effects.toolResult;
|
|
@@ -1558,7 +1641,7 @@ function createTuiStore(options) {
|
|
|
1558
1641
|
return err instanceof DaemonError && err.unreachable ? (sessionRetry = !0, null) : (noticeFallback(err instanceof DaemonError && err.status === 404 ? "the daemon has no client sessions (an older version)" : `GET /version failed (${describe(err)})`), null);
|
|
1559
1642
|
}
|
|
1560
1643
|
try {
|
|
1561
|
-
return (await c.createClientSession({ client:
|
|
1644
|
+
return (await c.createClientSession({ client: TUI_CLIENT_NAME, version: options.clientVersion ?? process.env.ADF_VERSION ?? "dev", umbilical: !0 })).sessionId;
|
|
1562
1645
|
} catch (err) {
|
|
1563
1646
|
return err instanceof DaemonError && err.unreachable ? (sessionRetry = !0, null) : (noticeFallback(err instanceof DaemonError && err.status === 404 ? "the daemon has no client sessions (an older version)" : `opening a client session failed (${describe(err)})`), null);
|
|
1564
1647
|
}
|
|
@@ -1697,14 +1780,14 @@ export {
|
|
|
1697
1780
|
MAIN_LOOP,
|
|
1698
1781
|
DaemonError,
|
|
1699
1782
|
isCredentialsLocked,
|
|
1700
|
-
emptyTranscript,
|
|
1701
|
-
isAsyncInput,
|
|
1702
|
-
askQuestion,
|
|
1703
1783
|
isTrackedKey,
|
|
1704
1784
|
folderName,
|
|
1705
1785
|
stoppedLabel,
|
|
1706
1786
|
stoppedError,
|
|
1707
1787
|
findTracked,
|
|
1788
|
+
emptyTranscript,
|
|
1789
|
+
isAsyncInput,
|
|
1790
|
+
askQuestion,
|
|
1708
1791
|
transcriptKey,
|
|
1709
1792
|
isBusyState,
|
|
1710
1793
|
parseServer,
|
|
@@ -163,6 +163,193 @@ function reconcileHostApprovedRegistrations(prev, next, approved, approvedSource
|
|
|
163
163
|
return { approved: result, sources };
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
// src/shared/constants/provider-catalog.ts
|
|
167
|
+
var provider_catalog_exports = {};
|
|
168
|
+
__export(provider_catalog_exports, {
|
|
169
|
+
PROVIDER_CATALOG: () => PROVIDER_CATALOG,
|
|
170
|
+
PROVIDER_CATALOG_GROUPS: () => PROVIDER_CATALOG_GROUPS,
|
|
171
|
+
catalogEntryForProvider: () => catalogEntryForProvider,
|
|
172
|
+
findCatalogEntry: () => findCatalogEntry,
|
|
173
|
+
isSubscriptionType: () => isSubscriptionType,
|
|
174
|
+
nextProviderName: () => nextProviderName,
|
|
175
|
+
providerTypeHint: () => providerTypeHint
|
|
176
|
+
});
|
|
177
|
+
var PROVIDER_CATALOG_GROUPS = [
|
|
178
|
+
{ id: "subscription", label: "Subscriptions", hint: "Sign in with an existing consumer plan. No API key." },
|
|
179
|
+
{ id: "api", label: "APIs", hint: "Pay-as-you-go endpoints. Paste an API key." },
|
|
180
|
+
{ id: "local", label: "Local", hint: "Servers running on this machine. Usually no key." },
|
|
181
|
+
{ id: "other", label: "Other", hint: "Anything that speaks the OpenAI API." }
|
|
182
|
+
], oc = (key, label, baseUrl, description, extra = {}) => ({
|
|
183
|
+
key,
|
|
184
|
+
label,
|
|
185
|
+
type: "openai-compatible",
|
|
186
|
+
group: "api",
|
|
187
|
+
baseUrl,
|
|
188
|
+
description,
|
|
189
|
+
keyPlaceholder: "API key",
|
|
190
|
+
modelPlaceholder: "model id",
|
|
191
|
+
...extra
|
|
192
|
+
}), local = (key, label, baseUrl, description, extra = {}) => ({
|
|
193
|
+
key,
|
|
194
|
+
label,
|
|
195
|
+
type: "openai-compatible",
|
|
196
|
+
group: "local",
|
|
197
|
+
baseUrl,
|
|
198
|
+
description,
|
|
199
|
+
keyPlaceholder: "Usually not needed",
|
|
200
|
+
modelPlaceholder: "loaded model id",
|
|
201
|
+
keyOptional: !0,
|
|
202
|
+
...extra
|
|
203
|
+
}), PROVIDER_CATALOG = [
|
|
204
|
+
// ---- Subscriptions --------------------------------------------------------
|
|
205
|
+
{
|
|
206
|
+
key: "chatgpt-subscription",
|
|
207
|
+
label: "ChatGPT",
|
|
208
|
+
type: "chatgpt-subscription",
|
|
209
|
+
group: "subscription",
|
|
210
|
+
description: "Use your ChatGPT Plus / Pro plan. Sign in with your OpenAI account.",
|
|
211
|
+
modelPlaceholder: "e.g. gpt-5.6-sol",
|
|
212
|
+
iconKey: "openai"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
key: "grok-subscription",
|
|
216
|
+
label: "Grok",
|
|
217
|
+
type: "grok-subscription",
|
|
218
|
+
group: "subscription",
|
|
219
|
+
description: "Use your SuperGrok or X Premium plan. Sign in with xAI.",
|
|
220
|
+
modelPlaceholder: "e.g. grok-4.5",
|
|
221
|
+
iconKey: "x"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
key: "claude-subscription",
|
|
225
|
+
label: "Claude",
|
|
226
|
+
type: "claude-subscription",
|
|
227
|
+
group: "subscription",
|
|
228
|
+
description: "Use your Claude Pro or Max plan, via Claude Code.",
|
|
229
|
+
modelPlaceholder: "e.g. claude-sonnet-5-5",
|
|
230
|
+
iconKey: "anthropic"
|
|
231
|
+
},
|
|
232
|
+
// ---- First-party APIs -----------------------------------------------------
|
|
233
|
+
{
|
|
234
|
+
key: "anthropic",
|
|
235
|
+
label: "Anthropic",
|
|
236
|
+
type: "anthropic",
|
|
237
|
+
group: "api",
|
|
238
|
+
description: "Claude models via the Anthropic API.",
|
|
239
|
+
keyPlaceholder: "sk-ant-...",
|
|
240
|
+
modelPlaceholder: "e.g. claude-sonnet-4-5",
|
|
241
|
+
iconKey: "anthropic",
|
|
242
|
+
keysUrl: "https://console.anthropic.com/settings/keys"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
key: "openai",
|
|
246
|
+
label: "OpenAI",
|
|
247
|
+
type: "openai",
|
|
248
|
+
group: "api",
|
|
249
|
+
description: "GPT and o-series models via the OpenAI API.",
|
|
250
|
+
keyPlaceholder: "sk-...",
|
|
251
|
+
modelPlaceholder: "e.g. gpt-4o, o3-mini",
|
|
252
|
+
iconKey: "openai",
|
|
253
|
+
keysUrl: "https://platform.openai.com/api-keys"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
key: "openrouter",
|
|
257
|
+
label: "OpenRouter",
|
|
258
|
+
type: "openrouter",
|
|
259
|
+
group: "api",
|
|
260
|
+
description: "One key for hundreds of models across providers.",
|
|
261
|
+
keyPlaceholder: "sk-or-...",
|
|
262
|
+
modelPlaceholder: "e.g. anthropic/claude-sonnet-4",
|
|
263
|
+
iconKey: "openrouter",
|
|
264
|
+
keysUrl: "https://openrouter.ai/keys"
|
|
265
|
+
},
|
|
266
|
+
// ---- OpenAI-compatible hosted APIs ---------------------------------------
|
|
267
|
+
oc("gemini", "Google Gemini", "https://generativelanguage.googleapis.com/v1beta/openai", "Gemini models through the OpenAI-compatible endpoint.", { iconKey: "gemini", keysUrl: "https://aistudio.google.com/apikey", modelPlaceholder: "e.g. gemini-2.5-pro" }),
|
|
268
|
+
oc("xai", "xAI", "https://api.x.ai/v1", "Grok models via the xAI API.", { iconKey: "x", keysUrl: "https://console.x.ai", modelPlaceholder: "e.g. grok-4" }),
|
|
269
|
+
oc("mistral", "Mistral", "https://api.mistral.ai/v1", "Mistral and Codestral models.", { iconKey: "mistral", keysUrl: "https://console.mistral.ai/api-keys", modelPlaceholder: "e.g. mistral-large-latest" }),
|
|
270
|
+
oc("deepseek", "DeepSeek", "https://api.deepseek.com/v1", "DeepSeek chat and reasoner models.", { iconKey: "deepseek", keysUrl: "https://platform.deepseek.com/api_keys", modelPlaceholder: "e.g. deepseek-chat" }),
|
|
271
|
+
oc("groq", "Groq", "https://api.groq.com/openai/v1", "Fast inference for open models on LPUs.", { keysUrl: "https://console.groq.com/keys", modelPlaceholder: "e.g. llama-3.3-70b-versatile" }),
|
|
272
|
+
oc("cerebras", "Cerebras", "https://api.cerebras.ai/v1", "Very fast inference for open models.", { keysUrl: "https://cloud.cerebras.ai", modelPlaceholder: "e.g. llama-3.3-70b" }),
|
|
273
|
+
oc("together", "Together AI", "https://api.together.xyz/v1", "Open models, fine-tunes, and dedicated endpoints.", { keysUrl: "https://api.together.ai/settings/api-keys", modelPlaceholder: "e.g. meta-llama/Llama-3.3-70B-Instruct-Turbo" }),
|
|
274
|
+
oc("fireworks", "Fireworks AI", "https://api.fireworks.ai/inference/v1", "Fast serverless inference for open models.", { keysUrl: "https://fireworks.ai/account/api-keys", modelPlaceholder: "e.g. accounts/fireworks/models/llama-v3p3-70b-instruct" }),
|
|
275
|
+
oc("perplexity", "Perplexity", "https://api.perplexity.ai", "Sonar models with built-in web search.", { iconKey: "perplexity", keysUrl: "https://www.perplexity.ai/settings/api", modelPlaceholder: "e.g. sonar-pro" }),
|
|
276
|
+
oc("cohere", "Cohere", "https://api.cohere.ai/compatibility/v1", "Command models through the compatibility API.", { keysUrl: "https://dashboard.cohere.com/api-keys", modelPlaceholder: "e.g. command-a-03-2025" }),
|
|
277
|
+
oc("huggingface", "Hugging Face", "https://router.huggingface.co/v1", "Inference Providers router. Uses your HF token.", { iconKey: "huggingface", keysUrl: "https://huggingface.co/settings/tokens", keyPlaceholder: "hf_...", modelPlaceholder: "e.g. meta-llama/Llama-3.3-70B-Instruct" }),
|
|
278
|
+
oc("nvidia", "NVIDIA NIM", "https://integrate.api.nvidia.com/v1", "Hosted NIM endpoints on build.nvidia.com.", { iconKey: "nvidia", keysUrl: "https://build.nvidia.com", keyPlaceholder: "nvapi-...", modelPlaceholder: "e.g. meta/llama-3.3-70b-instruct" }),
|
|
279
|
+
oc("vercel-ai-gateway", "Vercel AI Gateway", "https://ai-gateway.vercel.sh/v1", "Route to many providers through one Vercel key.", { iconKey: "vercel", keysUrl: "https://vercel.com/dashboard/ai-gateway", modelPlaceholder: "e.g. anthropic/claude-sonnet-4" }),
|
|
280
|
+
oc("cloudflare", "Cloudflare Workers AI", "https://api.cloudflare.com/client/v4/accounts/YOUR_ACCOUNT_ID/ai/v1", "Open models at the edge. Replace YOUR_ACCOUNT_ID in the base URL.", { iconKey: "cloudflare", keysUrl: "https://dash.cloudflare.com/profile/api-tokens", modelPlaceholder: "e.g. @cf/meta/llama-3.3-70b-instruct-fp8-fast" }),
|
|
281
|
+
oc("azure-openai", "Azure OpenAI", "https://YOUR_RESOURCE.openai.azure.com/openai/v1", "Azure-hosted OpenAI models. Replace YOUR_RESOURCE in the base URL.", { keysUrl: "https://portal.azure.com", modelPlaceholder: "your deployment name" }),
|
|
282
|
+
oc("deepinfra", "DeepInfra", "https://api.deepinfra.com/v1/openai", "Low-cost hosting for open models.", { keysUrl: "https://deepinfra.com/dash/api_keys", modelPlaceholder: "e.g. meta-llama/Llama-3.3-70B-Instruct" }),
|
|
283
|
+
oc("sambanova", "SambaNova", "https://api.sambanova.ai/v1", "Fast inference on SambaNova RDUs.", { keysUrl: "https://cloud.sambanova.ai/apis", modelPlaceholder: "e.g. Meta-Llama-3.3-70B-Instruct" }),
|
|
284
|
+
oc("nebius", "Nebius", "https://api.studio.nebius.com/v1", "Nebius AI Studio open-model endpoints.", { keysUrl: "https://studio.nebius.com/settings/api-keys", modelPlaceholder: "e.g. meta-llama/Llama-3.3-70B-Instruct" }),
|
|
285
|
+
oc("hyperbolic", "Hyperbolic", "https://api.hyperbolic.xyz/v1", "Open models on decentralized GPU capacity.", { keysUrl: "https://app.hyperbolic.xyz/settings", modelPlaceholder: "e.g. meta-llama/Llama-3.3-70B-Instruct" }),
|
|
286
|
+
oc("novita", "Novita AI", "https://api.novita.ai/v3/openai", "Serverless open-model inference.", { keysUrl: "https://novita.ai/settings/key-management", modelPlaceholder: "e.g. meta-llama/llama-3.3-70b-instruct" }),
|
|
287
|
+
oc("baseten", "Baseten", "https://inference.baseten.co/v1", "Model APIs and dedicated deployments.", { keysUrl: "https://app.baseten.co/settings/api_keys", modelPlaceholder: "e.g. deepseek-ai/DeepSeek-V3-0324" }),
|
|
288
|
+
oc("scaleway", "Scaleway", "https://api.scaleway.ai/v1", "EU-hosted generative APIs.", { iconKey: "scaleway", keysUrl: "https://console.scaleway.com/iam/api-keys", modelPlaceholder: "e.g. llama-3.3-70b-instruct" }),
|
|
289
|
+
oc("venice", "Venice", "https://api.venice.ai/api/v1", "Private, uncensored open-model inference.", { keysUrl: "https://venice.ai/settings/api", modelPlaceholder: "e.g. llama-3.3-70b" }),
|
|
290
|
+
oc("kluster", "kluster.ai", "https://api.kluster.ai/v1", "Open-model inference with batch pricing.", { keysUrl: "https://platform.kluster.ai/apikeys", modelPlaceholder: "e.g. deepseek-ai/DeepSeek-V3-0324" }),
|
|
291
|
+
oc("moonshot", "Moonshot (Kimi)", "https://api.moonshot.ai/v1", "Kimi models from Moonshot AI.", { iconKey: "kimi", keysUrl: "https://platform.moonshot.ai/console/api-keys", modelPlaceholder: "e.g. kimi-k2-0711-preview" }),
|
|
292
|
+
oc("zai", "Z.ai (GLM)", "https://api.z.ai/api/paas/v4", "GLM models from Zhipu / Z.ai.", { keysUrl: "https://z.ai/manage-apikey/apikey-list", modelPlaceholder: "e.g. glm-4.5" }),
|
|
293
|
+
oc("qwen", "Qwen (Alibaba)", "https://dashscope-intl.aliyuncs.com/compatible-mode/v1", "Qwen models via Model Studio (international).", { iconKey: "qwen", keysUrl: "https://modelstudio.console.alibabacloud.com/?tab=playground#/api-key", modelPlaceholder: "e.g. qwen-plus" }),
|
|
294
|
+
oc("minimax", "MiniMax", "https://api.minimax.io/v1", "MiniMax text models.", { iconKey: "minimax", keysUrl: "https://platform.minimax.io/user-center/basic-information/interface-key", modelPlaceholder: "e.g. MiniMax-M1" }),
|
|
295
|
+
oc("inception", "Inception", "https://api.inceptionlabs.ai/v1", "Mercury diffusion language models.", { keysUrl: "https://platform.inceptionlabs.ai", modelPlaceholder: "e.g. mercury-coder" }),
|
|
296
|
+
// ---- Local servers ---------------------------------------------------------
|
|
297
|
+
local("lmstudio", "LM Studio", "http://localhost:1234/v1", "Local server from the LM Studio app.", { iconKey: "lmstudio" }),
|
|
298
|
+
local("ollama", "Ollama", "http://localhost:11434/v1", "Local models served by Ollama.", { iconKey: "ollama", modelPlaceholder: "e.g. llama3.3" }),
|
|
299
|
+
local("vllm", "vLLM", "http://localhost:8000/v1", "vLLM OpenAI-compatible server.", { iconKey: "vllm" }),
|
|
300
|
+
local("llamacpp", "llama.cpp", "http://localhost:8080/v1", "llama-server from llama.cpp."),
|
|
301
|
+
local("litellm", "LiteLLM", "http://localhost:4000/v1", "LiteLLM proxy in front of any provider.", { keyOptional: !1, keyPlaceholder: "Proxy key, if set" }),
|
|
302
|
+
local("jan", "Jan", "http://localhost:1337/v1", "Local server from the Jan app."),
|
|
303
|
+
local("localai", "LocalAI", "http://localhost:8080/v1", "LocalAI drop-in OpenAI server."),
|
|
304
|
+
local("tgwui", "text-generation-webui", "http://localhost:5000/v1", "oobabooga OpenAI extension."),
|
|
305
|
+
// ---- Other -----------------------------------------------------------------
|
|
306
|
+
{
|
|
307
|
+
key: "openai-compatible",
|
|
308
|
+
label: "OpenAI-compatible",
|
|
309
|
+
type: "openai-compatible",
|
|
310
|
+
group: "other",
|
|
311
|
+
description: "Any endpoint that speaks the OpenAI chat API. Enter the base URL.",
|
|
312
|
+
keyPlaceholder: "Optional",
|
|
313
|
+
modelPlaceholder: "model id"
|
|
314
|
+
}
|
|
315
|
+
], BY_KEY = new Map(PROVIDER_CATALOG.map((e) => [e.key, e]));
|
|
316
|
+
function findCatalogEntry(key) {
|
|
317
|
+
return key ? BY_KEY.get(key) : void 0;
|
|
318
|
+
}
|
|
319
|
+
function catalogEntryForProvider(p) {
|
|
320
|
+
return findCatalogEntry(p.preset) ?? findCatalogEntry(p.type);
|
|
321
|
+
}
|
|
322
|
+
function nextProviderName(label, existing) {
|
|
323
|
+
let taken = new Set(existing.map((p) => p.name.trim().toLowerCase()));
|
|
324
|
+
if (!taken.has(label.toLowerCase())) return label;
|
|
325
|
+
for (let n = 2; n < 1e3; n++) {
|
|
326
|
+
let candidate = `${label} ${n}`;
|
|
327
|
+
if (!taken.has(candidate.toLowerCase())) return candidate;
|
|
328
|
+
}
|
|
329
|
+
return `${label} ${Date.now()}`;
|
|
330
|
+
}
|
|
331
|
+
function providerTypeHint(type) {
|
|
332
|
+
switch (type) {
|
|
333
|
+
case "anthropic":
|
|
334
|
+
return "Anthropic API";
|
|
335
|
+
case "openai":
|
|
336
|
+
return "OpenAI API";
|
|
337
|
+
case "openrouter":
|
|
338
|
+
return "OpenRouter API";
|
|
339
|
+
case "openai-compatible":
|
|
340
|
+
return "OpenAI-compatible API";
|
|
341
|
+
case "chatgpt-subscription":
|
|
342
|
+
return "ChatGPT subscription (OAuth)";
|
|
343
|
+
case "grok-subscription":
|
|
344
|
+
return "Grok subscription (OAuth)";
|
|
345
|
+
case "claude-subscription":
|
|
346
|
+
return "Claude subscription (via Claude Code)";
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function isSubscriptionType(type) {
|
|
350
|
+
return type === "chatgpt-subscription" || type === "grok-subscription" || type === "claude-subscription";
|
|
351
|
+
}
|
|
352
|
+
|
|
166
353
|
// src/shared/constants/mcp-registry.ts
|
|
167
354
|
var mcp_registry_exports = {};
|
|
168
355
|
__export(mcp_registry_exports, {
|
|
@@ -1793,6 +1980,8 @@ export {
|
|
|
1793
1980
|
isRegistrationAgentVisible,
|
|
1794
1981
|
deriveRegistrationTestPlan,
|
|
1795
1982
|
mcp_config_exports,
|
|
1983
|
+
isSubscriptionType,
|
|
1984
|
+
provider_catalog_exports,
|
|
1796
1985
|
parseMcpRegistryDocument,
|
|
1797
1986
|
MCP_REGISTRY,
|
|
1798
1987
|
BUNDLED_REGISTRY_UPDATED_AT,
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createRequire as __adfCreateRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __adfFileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __adfDirname } from 'node:path';
|
|
4
|
+
const require = __adfCreateRequire(import.meta.url);
|
|
5
|
+
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __adfDirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
__export
|
|
9
|
+
} from "./chunk-M2RX3S2T.mjs";
|
|
10
|
+
|
|
11
|
+
// src/shared/utils/agent-commands.ts
|
|
12
|
+
var agent_commands_exports = {};
|
|
13
|
+
__export(agent_commands_exports, {
|
|
14
|
+
COMMAND_NAME_PATTERN: () => COMMAND_NAME_PATTERN,
|
|
15
|
+
RESERVED_COMMAND_NAMES: () => RESERVED_COMMAND_NAMES,
|
|
16
|
+
parseAuthorizeToken: () => parseAuthorizeToken,
|
|
17
|
+
parseLambdaRef: () => parseLambdaRef,
|
|
18
|
+
splitArgv: () => splitArgv,
|
|
19
|
+
validateAgentCommands: () => validateAgentCommands
|
|
20
|
+
});
|
|
21
|
+
var COMMAND_NAME_PATTERN = /^[a-z](?:[a-z0-9-]{0,30}[a-z0-9])?$/, RESERVED_COMMAND_NAMES = ["compact", "clear", "skills", "idle", "hibernate", "stop", "off"];
|
|
22
|
+
function parseLambdaRef(ref) {
|
|
23
|
+
let colon = typeof ref == "string" ? ref.lastIndexOf(":") : -1, file = colon > 0 ? ref.slice(0, colon) : "", fn = colon > 0 ? ref.slice(colon + 1) : "";
|
|
24
|
+
return !/\.(ts|js|mjs)$/.test(file) || !/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(fn) ? { error: `Lambda must be "path/file.ts:functionName" (got "${ref}").` } : { file, fn };
|
|
25
|
+
}
|
|
26
|
+
function validateAgentCommands(commands) {
|
|
27
|
+
if (!Array.isArray(commands)) return [{ index: -1, field: "commands", message: "Commands must be an array. Replace the malformed value with a list of commands." }];
|
|
28
|
+
let issues = [], seen = /* @__PURE__ */ new Set();
|
|
29
|
+
return commands.forEach((command, index) => {
|
|
30
|
+
let add = (field, message) => {
|
|
31
|
+
issues.push({ index, field, message });
|
|
32
|
+
};
|
|
33
|
+
if (!command || typeof command != "object") {
|
|
34
|
+
add("name", "Provide a command with a name, description and lambda.");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
let name = command.name;
|
|
38
|
+
if ((typeof name != "string" || !COMMAND_NAME_PATTERN.test(name)) && add("name", `Command "${name}" is not a valid name: use 1\u201332 lowercase letters, digits and hyphens, starting with a letter and ending with a letter or digit.`), RESERVED_COMMAND_NAMES.includes(name) && add("name", `"/${name}" is a built-in command. Pick another name.`), typeof name == "string") {
|
|
39
|
+
let key = name.toLowerCase();
|
|
40
|
+
seen.has(key) && add("name", `Command "${name}" is duplicated. Pick a unique name.`), seen.add(key);
|
|
41
|
+
}
|
|
42
|
+
(typeof command.description != "string" || command.description.length < 1 || command.description.length > 200) && add("description", "Description must contain 1\u2013200 characters."), command.usage !== void 0 && (typeof command.usage != "string" || command.usage.length > 100) && add("usage", "Usage must contain at most 100 characters.");
|
|
43
|
+
let ref = parseLambdaRef(command.lambda);
|
|
44
|
+
"error" in ref && add("lambda", ref.error);
|
|
45
|
+
}), commands.length > 64 && issues.push({ index: 64, field: "name", message: "Register at most 64 commands." }), issues;
|
|
46
|
+
}
|
|
47
|
+
function splitArgv(args) {
|
|
48
|
+
return args.split(/\s+/).filter(Boolean);
|
|
49
|
+
}
|
|
50
|
+
function parseAuthorizeToken(args) {
|
|
51
|
+
let authorize = !1;
|
|
52
|
+
return { args: splitArgv(args).filter((token) => token !== "!authorize" ? !0 : (authorize = !0, !1)).map((token) => token === "\\!authorize" ? "!authorize" : token).join(" "), authorize };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
COMMAND_NAME_PATTERN,
|
|
57
|
+
RESERVED_COMMAND_NAMES,
|
|
58
|
+
parseLambdaRef,
|
|
59
|
+
validateAgentCommands,
|
|
60
|
+
splitArgv,
|
|
61
|
+
agent_commands_exports
|
|
62
|
+
};
|
|
@@ -4,13 +4,19 @@ import { dirname as __adfDirname } from 'node:path';
|
|
|
4
4
|
const require = __adfCreateRequire(import.meta.url);
|
|
5
5
|
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __adfDirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
COMMAND_NAME_PATTERN,
|
|
9
|
+
RESERVED_COMMAND_NAMES,
|
|
10
|
+
validateAgentCommands
|
|
11
|
+
} from "./chunk-VENQBMOA.mjs";
|
|
7
12
|
import {
|
|
8
13
|
AGENT_STATES,
|
|
9
14
|
LOOP_PROHIBITED_TOOLS,
|
|
10
15
|
MESSAGING_MODES,
|
|
11
16
|
RESERVED_AGENT_PATH_SEGMENTS,
|
|
12
|
-
START_IN_STATES
|
|
13
|
-
|
|
17
|
+
START_IN_STATES,
|
|
18
|
+
hasLoopGoal
|
|
19
|
+
} from "./chunk-BR3AD5QZ.mjs";
|
|
14
20
|
import {
|
|
15
21
|
external_exports
|
|
16
22
|
} from "./chunk-ZJKXHM4Q.mjs";
|
|
@@ -398,13 +404,18 @@ var StreamBindEndpointSchema = external_exports.union([
|
|
|
398
404
|
}).optional(),
|
|
399
405
|
params: external_exports.array(external_exports.object({ key: external_exports.string(), value: external_exports.string() })).optional(),
|
|
400
406
|
provider_params: external_exports.record(external_exports.unknown()).optional()
|
|
401
|
-
}), PROHIBITED_LOOP_TOOL_NAMES = LOOP_PROHIBITED_TOOLS, LOOP_NAME_PATTERN = /^[a-z0-9][a-z0-9_-]{0,31}$/, LOOP_NAME_RULE = 'loop name must be 1-32 characters of lowercase letters, digits, "_" or "-", starting with a letter or digit', LOOP_GOAL_MAX_CHARS = 4e3, LOOP_TOOLS_MAX = 64
|
|
407
|
+
}), PROHIBITED_LOOP_TOOL_NAMES = LOOP_PROHIBITED_TOOLS, LOOP_NAME_PATTERN = /^[a-z0-9][a-z0-9_-]{0,31}$/, LOOP_NAME_RULE = 'loop name must be 1-32 characters of lowercase letters, digits, "_" or "-", starting with a letter or digit', LOOP_GOAL_MAX_CHARS = 4e3, LOOP_TOOLS_MAX = 64;
|
|
408
|
+
var LoopConfigSchema = external_exports.object({
|
|
402
409
|
name: external_exports.string().regex(LOOP_NAME_PATTERN, { message: LOOP_NAME_RULE }).refine((n) => n !== "main", {
|
|
403
410
|
message: "'main' is the implicit host loop and cannot be declared as an inner loop"
|
|
404
411
|
}),
|
|
405
|
-
|
|
412
|
+
// Optional and may be empty: the derived preamble alone is a usable
|
|
413
|
+
// instruction set, and a blank loop takes its work from whoever addresses it.
|
|
414
|
+
goal: external_exports.string().max(LOOP_GOAL_MAX_CHARS).optional().describe("Appended to the loop's instructions. Optional; required (non-empty) when autostart is true."),
|
|
406
415
|
enabled: external_exports.boolean(),
|
|
407
|
-
|
|
416
|
+
// The goal rule is restated here because zodToJsonSchema drops the
|
|
417
|
+
// superRefine below that enforces it.
|
|
418
|
+
autostart: external_exports.boolean().optional().describe("Run a first turn on the goal at create and whenever the agent starts, instead of waiting to be addressed. Requires a non-empty goal."),
|
|
408
419
|
autonomous: external_exports.boolean().optional().describe("Keep turning after text-only responses until the loop calls sys_set_state. Per-loop; not inherited from the host. Default false."),
|
|
409
420
|
model: ModelConfigSchema.optional().describe(
|
|
410
421
|
"Overrides the parent's model for this loop only. Absent = inherit. `provider` may name a different configured provider than the parent's (e.g. a grok-subscription loop under a chatgpt-subscription host); credentials are resolved by that provider id. A loop whose provider cannot be built does not start."
|
|
@@ -417,6 +428,11 @@ var StreamBindEndpointSchema = external_exports.union([
|
|
|
417
428
|
),
|
|
418
429
|
tools: external_exports.array(external_exports.string().min(1)).max(LOOP_TOOLS_MAX).optional().describe("Absolute allow-list, intersected with host-enabled tools at derive time. Nothing is implicit \u2014 loop_send/loop_list must be listed to be granted.")
|
|
419
430
|
}).superRefine((loop, ctx) => {
|
|
431
|
+
loop.autostart === !0 && !hasLoopGoal(loop) && ctx.addIssue({
|
|
432
|
+
code: external_exports.ZodIssueCode.custom,
|
|
433
|
+
message: `loop "${loop.name}" has autostart on but no goal; add a goal or turn autostart off`,
|
|
434
|
+
path: ["autostart"]
|
|
435
|
+
});
|
|
420
436
|
for (let tool of loop.tools ?? [])
|
|
421
437
|
PROHIBITED_LOOP_TOOL_NAMES.includes(tool) && ctx.addIssue({
|
|
422
438
|
code: external_exports.ZodIssueCode.custom,
|
|
@@ -451,6 +467,15 @@ var StreamBindEndpointSchema = external_exports.union([
|
|
|
451
467
|
});
|
|
452
468
|
} else hook.loops !== void 0 && ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: 'loops is only allowed when pre_llm_hook.scope is "loops"', path: ["loops"] });
|
|
453
469
|
hook.scope !== "loops" && hook.include_main !== void 0 && ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: 'include_main is only allowed when pre_llm_hook.scope is "loops"', path: ["include_main"] });
|
|
470
|
+
}), AgentCommandSchema = external_exports.object({
|
|
471
|
+
name: external_exports.string().regex(COMMAND_NAME_PATTERN).describe(`Typed after the slash. 1\u201332 lowercase letters, digits, hyphens; starts with a letter. Not one of: ${RESERVED_COMMAND_NAMES.join(", ")}. Unique in commands.`),
|
|
472
|
+
description: external_exports.string().min(1).max(200),
|
|
473
|
+
usage: external_exports.string().max(100).optional(),
|
|
474
|
+
lambda: external_exports.string().min(1).describe('"path/file.ts:functionName". The function receives one object: { command, args, argv, invoker, loop, authorized, id }.'),
|
|
475
|
+
locked: external_exports.boolean().optional()
|
|
476
|
+
}), AgentCommandsSchema = external_exports.array(AgentCommandSchema).max(64).superRefine((commands, ctx) => {
|
|
477
|
+
for (let issue of validateAgentCommands(commands))
|
|
478
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: [issue.index, issue.field], message: issue.message });
|
|
454
479
|
}), AgentConfigSchema = external_exports.object({
|
|
455
480
|
adf_version: external_exports.literal("0.2"),
|
|
456
481
|
id: external_exports.string().min(1),
|
|
@@ -589,6 +614,7 @@ var StreamBindEndpointSchema = external_exports.union([
|
|
|
589
614
|
logging: LoggingConfigSchema.optional(),
|
|
590
615
|
adapters: external_exports.record(AdapterInstanceConfigSchema).optional(),
|
|
591
616
|
serving: ServingConfigSchema.optional(),
|
|
617
|
+
commands: AgentCommandsSchema.optional(),
|
|
592
618
|
ws_connections: external_exports.array(WsConnectionConfigSchema).optional(),
|
|
593
619
|
stream_bind: StreamBindConfigSchema.optional(),
|
|
594
620
|
stream_bindings: external_exports.array(StreamBindingDeclarationSchema).optional(),
|
|
@@ -726,10 +752,11 @@ export {
|
|
|
726
752
|
LOOP_NAME_RULE,
|
|
727
753
|
LOOP_GOAL_MAX_CHARS,
|
|
728
754
|
LOOP_TOOLS_MAX,
|
|
729
|
-
MAX_SIDE_LOOPS,
|
|
730
755
|
LoopConfigSchema,
|
|
731
756
|
LoopsConfigSchema,
|
|
732
757
|
PreLlmHookConfigSchema,
|
|
758
|
+
AgentCommandSchema,
|
|
759
|
+
AgentCommandsSchema,
|
|
733
760
|
AgentConfigSchema,
|
|
734
761
|
TimerScheduleSchema
|
|
735
762
|
};
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
CLAUDE_SUBSCRIPTION_MODELS,
|
|
9
9
|
createClaudeSubscriptionProvider,
|
|
10
10
|
listClaudeSubscriptionModels
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-KCIRFUZH.mjs";
|
|
12
|
+
import "./chunk-E7LC6SHP.mjs";
|
|
13
13
|
import "./chunk-NZ7JTHEO.mjs";
|
|
14
14
|
import "./chunk-JZFONJSL.mjs";
|
|
15
15
|
import "./chunk-TKXIH27X.mjs";
|
|
@@ -17,7 +17,7 @@ import "./chunk-LKFHERRV.mjs";
|
|
|
17
17
|
import {
|
|
18
18
|
getClaudeAuthManager
|
|
19
19
|
} from "./chunk-MZRXFWPQ.mjs";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-BR3AD5QZ.mjs";
|
|
21
21
|
import "./chunk-ZJKXHM4Q.mjs";
|
|
22
22
|
import "./chunk-RIX34QHC.mjs";
|
|
23
23
|
import "./chunk-M2RX3S2T.mjs";
|
|
@@ -33,8 +33,8 @@ import {
|
|
|
33
33
|
} from "./chunk-M2F7C2UJ.mjs";
|
|
34
34
|
import {
|
|
35
35
|
daemonPaths
|
|
36
|
-
} from "./chunk-
|
|
37
|
-
import "./chunk-
|
|
36
|
+
} from "./chunk-RHBGCOS3.mjs";
|
|
37
|
+
import "./chunk-D7A77SNL.mjs";
|
|
38
38
|
import {
|
|
39
39
|
DEFAULT_DAEMON_PORT,
|
|
40
40
|
DEFAULT_DAEMON_URL,
|
|
@@ -58,8 +58,8 @@ import {
|
|
|
58
58
|
storeRemoteToken,
|
|
59
59
|
tunnelTokenHint,
|
|
60
60
|
updateRemotes
|
|
61
|
-
} from "./chunk-
|
|
62
|
-
import "./chunk-
|
|
61
|
+
} from "./chunk-AEAJDCVK.mjs";
|
|
62
|
+
import "./chunk-BS3USVEA.mjs";
|
|
63
63
|
import "./chunk-WJGPNHGX.mjs";
|
|
64
64
|
import "./chunk-PAK5JCO2.mjs";
|
|
65
65
|
import "./chunk-ZPB3HYM7.mjs";
|
|
@@ -531,7 +531,7 @@ function tuiInvocation(argv) {
|
|
|
531
531
|
return argv.filter((a) => a !== "--json");
|
|
532
532
|
}
|
|
533
533
|
async function defaultLaunchTui(argv) {
|
|
534
|
-
let { runTui } = await import("./tui-
|
|
534
|
+
let { runTui } = await import("./tui-RAUVFOYY.mjs");
|
|
535
535
|
return await runTui(argv);
|
|
536
536
|
}
|
|
537
537
|
function urlFromArgv(argv, env) {
|