motebit 1.11.1 → 1.11.3
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/index.js +784 -369
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -361,17 +361,17 @@ function optimalPathTrace(graph, source, target) {
|
|
|
361
361
|
const value = dist.get(target) ?? sr.zero;
|
|
362
362
|
if (value === sr.zero && source !== target)
|
|
363
363
|
return null;
|
|
364
|
-
const
|
|
364
|
+
const path20 = [];
|
|
365
365
|
let current2 = target;
|
|
366
366
|
const visited = /* @__PURE__ */ new Set();
|
|
367
367
|
while (current2 != null && !visited.has(current2)) {
|
|
368
368
|
visited.add(current2);
|
|
369
|
-
|
|
369
|
+
path20.unshift(current2);
|
|
370
370
|
current2 = pred.get(current2) ?? null;
|
|
371
371
|
}
|
|
372
|
-
if (
|
|
372
|
+
if (path20[0] !== source)
|
|
373
373
|
return null;
|
|
374
|
-
return { value, path:
|
|
374
|
+
return { value, path: path20 };
|
|
375
375
|
}
|
|
376
376
|
var init_traversal = __esm({
|
|
377
377
|
"../../packages/protocol/dist/traversal.js"() {
|
|
@@ -1718,9 +1718,17 @@ var init_models = __esm({
|
|
|
1718
1718
|
"use strict";
|
|
1719
1719
|
init_esm_shims();
|
|
1720
1720
|
ANTHROPIC_MODELS = [
|
|
1721
|
+
"claude-fable-5",
|
|
1722
|
+
"claude-opus-5",
|
|
1723
|
+
"claude-opus-4-8",
|
|
1721
1724
|
"claude-opus-4-7",
|
|
1725
|
+
"claude-opus-4-6",
|
|
1726
|
+
"claude-sonnet-5",
|
|
1722
1727
|
"claude-sonnet-4-6",
|
|
1723
|
-
"claude-haiku-4-5-20251001"
|
|
1728
|
+
"claude-haiku-4-5-20251001",
|
|
1729
|
+
"claude-opus-4-5-20251101",
|
|
1730
|
+
"claude-sonnet-4-5-20250929",
|
|
1731
|
+
"claude-opus-4-1-20250805"
|
|
1724
1732
|
];
|
|
1725
1733
|
OPENAI_MODELS = ["gpt-5.4", "gpt-5.4-mini", "gpt-5.4-nano"];
|
|
1726
1734
|
GOOGLE_MODELS = [
|
|
@@ -5696,7 +5704,6 @@ var init_core = __esm({
|
|
|
5696
5704
|
init_esm_shims();
|
|
5697
5705
|
init_dist2();
|
|
5698
5706
|
init_prompt();
|
|
5699
|
-
init_prompt();
|
|
5700
5707
|
init_context_window();
|
|
5701
5708
|
init_config();
|
|
5702
5709
|
init_summarizer();
|
|
@@ -6547,6 +6554,81 @@ var init_openai_provider = __esm({
|
|
|
6547
6554
|
}
|
|
6548
6555
|
});
|
|
6549
6556
|
|
|
6557
|
+
// ../../packages/ai-core/dist/model-catalog.js
|
|
6558
|
+
function fallbackFor(provider, reason) {
|
|
6559
|
+
const table = provider === "anthropic" ? ANTHROPIC_MODELS : provider === "openai" ? OPENAI_MODELS : provider === "local-server" || provider === "ollama" ? LOCAL_SERVER_SUGGESTED_MODELS : [];
|
|
6560
|
+
return {
|
|
6561
|
+
provider,
|
|
6562
|
+
source: "fallback",
|
|
6563
|
+
models: table.map((id) => ({ id })),
|
|
6564
|
+
fallbackReason: reason
|
|
6565
|
+
};
|
|
6566
|
+
}
|
|
6567
|
+
async function fetchJson(url, headers, timeoutMs, fetchFn) {
|
|
6568
|
+
const controller = new AbortController();
|
|
6569
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
6570
|
+
try {
|
|
6571
|
+
const resp = await fetchFn(url, { headers, signal: controller.signal });
|
|
6572
|
+
if (!resp.ok)
|
|
6573
|
+
throw new Error(`${resp.status} from ${url}`);
|
|
6574
|
+
return await resp.json();
|
|
6575
|
+
} finally {
|
|
6576
|
+
clearTimeout(timer);
|
|
6577
|
+
}
|
|
6578
|
+
}
|
|
6579
|
+
async function discoverModels(params) {
|
|
6580
|
+
const { provider } = params;
|
|
6581
|
+
const timeoutMs = params.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
6582
|
+
const fetchFn = params.fetchFn ?? fetch;
|
|
6583
|
+
try {
|
|
6584
|
+
if (provider === "anthropic") {
|
|
6585
|
+
if (!params.apiKey)
|
|
6586
|
+
return fallbackFor(provider, "no API key for live catalog");
|
|
6587
|
+
const body = await fetchJson("https://api.anthropic.com/v1/models?limit=100", { "x-api-key": params.apiKey, "anthropic-version": "2023-06-01" }, timeoutMs, fetchFn);
|
|
6588
|
+
const models = (body.data ?? []).filter((m4) => typeof m4.id === "string").map((m4) => ({ id: m4.id, ...m4.display_name ? { displayName: m4.display_name } : {} }));
|
|
6589
|
+
if (models.length === 0)
|
|
6590
|
+
return fallbackFor(provider, "live catalog came back empty");
|
|
6591
|
+
return { provider, source: "live", models };
|
|
6592
|
+
}
|
|
6593
|
+
if (provider === "openai") {
|
|
6594
|
+
if (!params.apiKey)
|
|
6595
|
+
return fallbackFor(provider, "no API key for live catalog");
|
|
6596
|
+
const body = await fetchJson("https://api.openai.com/v1/models", { Authorization: `Bearer ${params.apiKey}` }, timeoutMs, fetchFn);
|
|
6597
|
+
const models = (body.data ?? []).filter((m4) => typeof m4.id === "string").filter((m4) => /^(gpt-|o[0-9]|chatgpt)/.test(m4.id)).map((m4) => ({ id: m4.id }));
|
|
6598
|
+
if (models.length === 0)
|
|
6599
|
+
return fallbackFor(provider, "live catalog came back empty");
|
|
6600
|
+
return { provider, source: "live", models };
|
|
6601
|
+
}
|
|
6602
|
+
if (provider === "local-server" || provider === "ollama") {
|
|
6603
|
+
const base = (params.baseUrl ?? "http://localhost:11434").replace(/\/$/, "");
|
|
6604
|
+
try {
|
|
6605
|
+
const body2 = await fetchJson(`${base}/api/tags`, {}, timeoutMs, fetchFn);
|
|
6606
|
+
const models2 = (body2.models ?? []).filter((m4) => typeof m4.name === "string").map((m4) => ({ id: m4.name }));
|
|
6607
|
+
if (models2.length > 0)
|
|
6608
|
+
return { provider, source: "live", models: models2 };
|
|
6609
|
+
} catch {
|
|
6610
|
+
}
|
|
6611
|
+
const body = await fetchJson(`${base}/v1/models`, {}, timeoutMs, fetchFn);
|
|
6612
|
+
const models = (body.data ?? []).filter((m4) => typeof m4.id === "string").map((m4) => ({ id: m4.id }));
|
|
6613
|
+
if (models.length === 0)
|
|
6614
|
+
return fallbackFor(provider, "local server lists no models");
|
|
6615
|
+
return { provider, source: "live", models };
|
|
6616
|
+
}
|
|
6617
|
+
return fallbackFor(provider, `no live catalog adapter for ${provider}`);
|
|
6618
|
+
} catch (err2) {
|
|
6619
|
+
return fallbackFor(provider, err2 instanceof Error ? err2.message : String(err2));
|
|
6620
|
+
}
|
|
6621
|
+
}
|
|
6622
|
+
var DEFAULT_TIMEOUT_MS;
|
|
6623
|
+
var init_model_catalog = __esm({
|
|
6624
|
+
"../../packages/ai-core/dist/model-catalog.js"() {
|
|
6625
|
+
"use strict";
|
|
6626
|
+
init_esm_shims();
|
|
6627
|
+
init_dist2();
|
|
6628
|
+
DEFAULT_TIMEOUT_MS = 4e3;
|
|
6629
|
+
}
|
|
6630
|
+
});
|
|
6631
|
+
|
|
6550
6632
|
// ../../packages/memory-graph/dist/consolidation.js
|
|
6551
6633
|
function buildConsolidationPrompt(newContent, existing) {
|
|
6552
6634
|
const memoryList = existing.map((m4, i) => ` ${i + 1}. [id=${m4.node_id}] (confidence=${m4.confidence.toFixed(2)}) "${m4.content}"`).join("\n");
|
|
@@ -9299,6 +9381,7 @@ var init_dist4 = __esm({
|
|
|
9299
9381
|
init_esm_shims();
|
|
9300
9382
|
init_core();
|
|
9301
9383
|
init_openai_provider();
|
|
9384
|
+
init_model_catalog();
|
|
9302
9385
|
init_loop();
|
|
9303
9386
|
}
|
|
9304
9387
|
});
|
|
@@ -25504,7 +25587,7 @@ var init_config2 = __esm({
|
|
|
25504
25587
|
"src/config.ts"() {
|
|
25505
25588
|
"use strict";
|
|
25506
25589
|
init_esm_shims();
|
|
25507
|
-
VERSION = true ? "1.11.
|
|
25590
|
+
VERSION = true ? "1.11.3" : "0.0.0-dev";
|
|
25508
25591
|
CONFIG_DIR = process.env["MOTEBIT_CONFIG_DIR"] ?? path2.join(os.homedir(), ".motebit");
|
|
25509
25592
|
CONFIG_PATH = path2.join(CONFIG_DIR, "config.json");
|
|
25510
25593
|
RELAY_DIR = path2.join(CONFIG_DIR, "relay");
|
|
@@ -26374,13 +26457,13 @@ var init_intelligence = __esm({
|
|
|
26374
26457
|
});
|
|
26375
26458
|
|
|
26376
26459
|
// ../../packages/runtime/dist/commands/types.js
|
|
26377
|
-
async function relayFetch(relay,
|
|
26460
|
+
async function relayFetch(relay, path20, options) {
|
|
26378
26461
|
const headers = {
|
|
26379
26462
|
"Content-Type": "application/json",
|
|
26380
26463
|
Authorization: `Bearer ${relay.authToken}`,
|
|
26381
26464
|
...options?.headers
|
|
26382
26465
|
};
|
|
26383
|
-
const res = await fetch(`${relay.relayUrl}${
|
|
26466
|
+
const res = await fetch(`${relay.relayUrl}${path20}`, { ...options, headers });
|
|
26384
26467
|
if (!res.ok) {
|
|
26385
26468
|
const text = await res.text().catch(() => "");
|
|
26386
26469
|
throw new Error(`${res.status}: ${text}`);
|
|
@@ -29840,8 +29923,8 @@ function urlAuditDetail(url) {
|
|
|
29840
29923
|
}
|
|
29841
29924
|
try {
|
|
29842
29925
|
const parsed = new URL(url);
|
|
29843
|
-
const
|
|
29844
|
-
const hasPath =
|
|
29926
|
+
const path20 = parsed.pathname;
|
|
29927
|
+
const hasPath = path20.length > 0 && path20 !== "/";
|
|
29845
29928
|
return {
|
|
29846
29929
|
// Drop the trailing colon ("https:" → "https"). Lowercased
|
|
29847
29930
|
// for canonical-form audit comparisons across replays.
|
|
@@ -30577,7 +30660,7 @@ var init_cloud_browser_dispatcher = __esm({
|
|
|
30577
30660
|
};
|
|
30578
30661
|
}
|
|
30579
30662
|
// ── Internal: signed HTTP roundtrip ────────────────────────────────
|
|
30580
|
-
async request(method,
|
|
30663
|
+
async request(method, path20, body) {
|
|
30581
30664
|
let token;
|
|
30582
30665
|
try {
|
|
30583
30666
|
token = await this.getAuthToken();
|
|
@@ -30592,7 +30675,7 @@ var init_cloud_browser_dispatcher = __esm({
|
|
|
30592
30675
|
headers["Content-Type"] = "application/json";
|
|
30593
30676
|
let response;
|
|
30594
30677
|
try {
|
|
30595
|
-
response = await this.fetchImpl(`${this.baseUrl}${
|
|
30678
|
+
response = await this.fetchImpl(`${this.baseUrl}${path20}`, {
|
|
30596
30679
|
method,
|
|
30597
30680
|
headers,
|
|
30598
30681
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
@@ -41577,8 +41660,8 @@ var init_three_core = __esm({
|
|
|
41577
41660
|
* @param {string} path - The base path.
|
|
41578
41661
|
* @return {Loader} A reference to this instance.
|
|
41579
41662
|
*/
|
|
41580
|
-
setPath(
|
|
41581
|
-
this.path =
|
|
41663
|
+
setPath(path20) {
|
|
41664
|
+
this.path = path20;
|
|
41582
41665
|
return this;
|
|
41583
41666
|
}
|
|
41584
41667
|
/**
|
|
@@ -41626,10 +41709,10 @@ var init_three_core = __esm({
|
|
|
41626
41709
|
);
|
|
41627
41710
|
_supportedObjectNames = ["material", "materials", "bones", "map"];
|
|
41628
41711
|
Composite = class {
|
|
41629
|
-
constructor(targetGroup,
|
|
41630
|
-
const parsedPath = optionalParsedPath || PropertyBinding.parseTrackName(
|
|
41712
|
+
constructor(targetGroup, path20, optionalParsedPath) {
|
|
41713
|
+
const parsedPath = optionalParsedPath || PropertyBinding.parseTrackName(path20);
|
|
41631
41714
|
this._targetGroup = targetGroup;
|
|
41632
|
-
this._bindings = targetGroup.subscribe_(
|
|
41715
|
+
this._bindings = targetGroup.subscribe_(path20, parsedPath);
|
|
41633
41716
|
}
|
|
41634
41717
|
getValue(array, offset) {
|
|
41635
41718
|
this.bind();
|
|
@@ -41663,9 +41746,9 @@ var init_three_core = __esm({
|
|
|
41663
41746
|
* @param {string} path - The path.
|
|
41664
41747
|
* @param {?Object} [parsedPath] - The parsed path.
|
|
41665
41748
|
*/
|
|
41666
|
-
constructor(rootNode,
|
|
41667
|
-
this.path =
|
|
41668
|
-
this.parsedPath = parsedPath || _PropertyBinding.parseTrackName(
|
|
41749
|
+
constructor(rootNode, path20, parsedPath) {
|
|
41750
|
+
this.path = path20;
|
|
41751
|
+
this.parsedPath = parsedPath || _PropertyBinding.parseTrackName(path20);
|
|
41669
41752
|
this.node = _PropertyBinding.findNode(rootNode, this.parsedPath.nodeName);
|
|
41670
41753
|
this.rootNode = rootNode;
|
|
41671
41754
|
this.getValue = this._getValue_unbound;
|
|
@@ -41680,11 +41763,11 @@ var init_three_core = __esm({
|
|
|
41680
41763
|
* @param {?Object} [parsedPath] - The parsed path.
|
|
41681
41764
|
* @return {PropertyBinding|Composite} The created property binding or composite.
|
|
41682
41765
|
*/
|
|
41683
|
-
static create(root,
|
|
41766
|
+
static create(root, path20, parsedPath) {
|
|
41684
41767
|
if (!(root && root.isAnimationObjectGroup)) {
|
|
41685
|
-
return new _PropertyBinding(root,
|
|
41768
|
+
return new _PropertyBinding(root, path20, parsedPath);
|
|
41686
41769
|
} else {
|
|
41687
|
-
return new _PropertyBinding.Composite(root,
|
|
41770
|
+
return new _PropertyBinding.Composite(root, path20, parsedPath);
|
|
41688
41771
|
}
|
|
41689
41772
|
}
|
|
41690
41773
|
/**
|
|
@@ -45374,7 +45457,7 @@ function classifyRelayError(status, body, retryAfterHeader) {
|
|
|
45374
45457
|
return { code: "unknown", message: message2, status };
|
|
45375
45458
|
}
|
|
45376
45459
|
async function submitAndPollDelegation(params) {
|
|
45377
|
-
const timeoutMs = params.timeoutMs ??
|
|
45460
|
+
const timeoutMs = params.timeoutMs ?? DEFAULT_TIMEOUT_MS2;
|
|
45378
45461
|
const startedAt = Date.now();
|
|
45379
45462
|
let submitHeader;
|
|
45380
45463
|
try {
|
|
@@ -45512,7 +45595,7 @@ async function pollForReceipt(args) {
|
|
|
45512
45595
|
};
|
|
45513
45596
|
}
|
|
45514
45597
|
async function submitP2pDelegation(params) {
|
|
45515
|
-
const timeoutMs = params.timeoutMs ??
|
|
45598
|
+
const timeoutMs = params.timeoutMs ?? DEFAULT_TIMEOUT_MS2;
|
|
45516
45599
|
const startedAt = Date.now();
|
|
45517
45600
|
let submitHeader;
|
|
45518
45601
|
try {
|
|
@@ -45968,14 +46051,14 @@ async function selectAndRunDelegation(params) {
|
|
|
45968
46051
|
...params.signal ? { signal: params.signal } : {}
|
|
45969
46052
|
});
|
|
45970
46053
|
}
|
|
45971
|
-
var
|
|
46054
|
+
var DEFAULT_TIMEOUT_MS2, POLL_INTERVAL_MS, fail;
|
|
45972
46055
|
var init_relay_delegation = __esm({
|
|
45973
46056
|
"../../packages/runtime/dist/relay-delegation.js"() {
|
|
45974
46057
|
"use strict";
|
|
45975
46058
|
init_esm_shims();
|
|
45976
46059
|
init_dist();
|
|
45977
46060
|
init_dist5();
|
|
45978
|
-
|
|
46061
|
+
DEFAULT_TIMEOUT_MS2 = 12e4;
|
|
45979
46062
|
POLL_INTERVAL_MS = 2e3;
|
|
45980
46063
|
fail = (code2, message2, status) => ({
|
|
45981
46064
|
ok: false,
|
|
@@ -57034,6 +57117,21 @@ ${footnotes}`
|
|
|
57034
57117
|
pushReceipt(receipt) {
|
|
57035
57118
|
this.receipts.push(receipt);
|
|
57036
57119
|
}
|
|
57120
|
+
/**
|
|
57121
|
+
* Non-draining view of the stash for the streaming layer's
|
|
57122
|
+
* `delegation_complete` emission (#493): mark the count before a
|
|
57123
|
+
* `delegate_to_agent` call, peek what arrived after it. MUST NOT drain —
|
|
57124
|
+
* `getAndResetReceipts` composes the same bucket into the parent
|
|
57125
|
+
* receipt's `delegation_receipts` chain, and a draining reader here
|
|
57126
|
+
* would silently sever that chain (composition-preserves-enforcement).
|
|
57127
|
+
*/
|
|
57128
|
+
get stashedReceiptCount() {
|
|
57129
|
+
return this.receipts.length;
|
|
57130
|
+
}
|
|
57131
|
+
/** See {@link stashedReceiptCount} — the peek half of the pair. */
|
|
57132
|
+
peekReceiptsSince(count2) {
|
|
57133
|
+
return this.receipts.slice(count2);
|
|
57134
|
+
}
|
|
57037
57135
|
};
|
|
57038
57136
|
}
|
|
57039
57137
|
});
|
|
@@ -57281,6 +57379,7 @@ var init_streaming = __esm({
|
|
|
57281
57379
|
let pendingStateUpdates = {};
|
|
57282
57380
|
const motebitToolServers = this.deps.getMotebitToolServers();
|
|
57283
57381
|
const pendingToolCalls = /* @__PURE__ */ new Map();
|
|
57382
|
+
let delegateStashMark = null;
|
|
57284
57383
|
for await (let chunk of stream) {
|
|
57285
57384
|
if (chunk.type === "memory_formation_deferred")
|
|
57286
57385
|
continue;
|
|
@@ -57306,6 +57405,9 @@ var init_streaming = __esm({
|
|
|
57306
57405
|
this.deps.setDelegating(true);
|
|
57307
57406
|
yield { type: "delegation_start", server: motebitServer, tool: chunk.name };
|
|
57308
57407
|
}
|
|
57408
|
+
if (chunk.name === "delegate_to_agent") {
|
|
57409
|
+
delegateStashMark = this.deps.delegationReceiptStash?.count() ?? null;
|
|
57410
|
+
}
|
|
57309
57411
|
} else if (chunk.status === "done") {
|
|
57310
57412
|
if (chunk.result != null && typeof chunk.result === "string") {
|
|
57311
57413
|
const redacted = this.deps.redactText(chunk.result);
|
|
@@ -57365,6 +57467,26 @@ var init_streaming = __esm({
|
|
|
57365
57467
|
full_receipt: fullReceipt
|
|
57366
57468
|
};
|
|
57367
57469
|
}
|
|
57470
|
+
if (chunk.name === "delegate_to_agent" && delegateStashMark != null) {
|
|
57471
|
+
const mark = delegateStashMark;
|
|
57472
|
+
delegateStashMark = null;
|
|
57473
|
+
const stashed = this.deps.delegationReceiptStash?.peekSince(mark) ?? [];
|
|
57474
|
+
for (const receipt of stashed) {
|
|
57475
|
+
yield {
|
|
57476
|
+
type: "delegation_complete",
|
|
57477
|
+
server: "relay",
|
|
57478
|
+
tool: receipt.tools_used?.[0] ?? "delegate_to_agent",
|
|
57479
|
+
...typeof receipt.task_id === "string" && typeof receipt.status === "string" ? {
|
|
57480
|
+
receipt: {
|
|
57481
|
+
task_id: receipt.task_id,
|
|
57482
|
+
status: receipt.status,
|
|
57483
|
+
tools_used: receipt.tools_used ?? []
|
|
57484
|
+
}
|
|
57485
|
+
} : {},
|
|
57486
|
+
full_receipt: receipt
|
|
57487
|
+
};
|
|
57488
|
+
}
|
|
57489
|
+
}
|
|
57368
57490
|
}
|
|
57369
57491
|
}
|
|
57370
57492
|
if (chunk.type === "approval_request" && this.deniedIntents.has(deniedIntentKey(chunk.name, chunk.args))) {
|
|
@@ -57478,6 +57600,7 @@ var init_streaming = __esm({
|
|
|
57478
57600
|
await this.signAndEmitApprovalDecision(pending, approved);
|
|
57479
57601
|
if (approved) {
|
|
57480
57602
|
yield { type: "tool_status", name: pending.toolName, status: "calling" };
|
|
57603
|
+
const approvedStashMark = pending.toolName === "delegate_to_agent" ? this.deps.delegationReceiptStash?.count() ?? null : null;
|
|
57481
57604
|
const toolRegistry = this.deps.getToolRegistry();
|
|
57482
57605
|
const result = await toolRegistry.execute(pending.toolName, pending.args);
|
|
57483
57606
|
const check = this.deps.sanitizeToolResult(result, pending.toolName);
|
|
@@ -57489,6 +57612,24 @@ var init_streaming = __esm({
|
|
|
57489
57612
|
patterns: check.injectionPatterns
|
|
57490
57613
|
};
|
|
57491
57614
|
}
|
|
57615
|
+
if (approvedStashMark != null) {
|
|
57616
|
+
const stashed = this.deps.delegationReceiptStash?.peekSince(approvedStashMark) ?? [];
|
|
57617
|
+
for (const receipt of stashed) {
|
|
57618
|
+
yield {
|
|
57619
|
+
type: "delegation_complete",
|
|
57620
|
+
server: "relay",
|
|
57621
|
+
tool: receipt.tools_used?.[0] ?? "delegate_to_agent",
|
|
57622
|
+
...typeof receipt.task_id === "string" && typeof receipt.status === "string" ? {
|
|
57623
|
+
receipt: {
|
|
57624
|
+
task_id: receipt.task_id,
|
|
57625
|
+
status: receipt.status,
|
|
57626
|
+
tools_used: receipt.tools_used ?? []
|
|
57627
|
+
}
|
|
57628
|
+
} : {},
|
|
57629
|
+
full_receipt: receipt
|
|
57630
|
+
};
|
|
57631
|
+
}
|
|
57632
|
+
}
|
|
57492
57633
|
yield {
|
|
57493
57634
|
type: "tool_status",
|
|
57494
57635
|
name: pending.toolName,
|
|
@@ -60023,6 +60164,14 @@ var init_motebit_runtime = __esm({
|
|
|
60023
60164
|
assertSensitivityPermitsAiCall: (entry, toolName) => this.assertSensitivityPermitsAiCall(entry, toolName),
|
|
60024
60165
|
getLatestCues: () => this.latestCues,
|
|
60025
60166
|
getApprovalStore: () => this.approvalStore,
|
|
60167
|
+
// #493: non-draining stash view for the delegate_to_agent receipt
|
|
60168
|
+
// beat. Lazy closures — interactiveDelegation is constructed before
|
|
60169
|
+
// the StreamingManager, but the indirection keeps that ordering a
|
|
60170
|
+
// non-constraint.
|
|
60171
|
+
delegationReceiptStash: {
|
|
60172
|
+
count: () => this.interactiveDelegation.stashedReceiptCount,
|
|
60173
|
+
peekSince: (n2) => this.interactiveDelegation.peekReceiptsSince(n2)
|
|
60174
|
+
},
|
|
60026
60175
|
redactText: (text) => {
|
|
60027
60176
|
if (typeof this.policy.redact === "function") {
|
|
60028
60177
|
return this.policy.redact(text);
|
|
@@ -73765,14 +73914,14 @@ var init_dependency_container = __esm({
|
|
|
73765
73914
|
provider = providerOrConstructor;
|
|
73766
73915
|
}
|
|
73767
73916
|
if (isTokenProvider(provider)) {
|
|
73768
|
-
var
|
|
73917
|
+
var path20 = [token];
|
|
73769
73918
|
var tokenProvider = provider;
|
|
73770
73919
|
while (tokenProvider != null) {
|
|
73771
73920
|
var currentToken = tokenProvider.useToken;
|
|
73772
|
-
if (
|
|
73773
|
-
throw new Error("Token registration cycle detected! " + __spread(
|
|
73921
|
+
if (path20.includes(currentToken)) {
|
|
73922
|
+
throw new Error("Token registration cycle detected! " + __spread(path20, [currentToken]).join(" -> "));
|
|
73774
73923
|
}
|
|
73775
|
-
|
|
73924
|
+
path20.push(currentToken);
|
|
73776
73925
|
var registration = this._registry.get(currentToken);
|
|
73777
73926
|
if (registration && isTokenProvider(registration.provider)) {
|
|
73778
73927
|
tokenProvider = registration.provider;
|
|
@@ -83849,8 +83998,8 @@ ${FRONTMATTER_DELIM}`);
|
|
|
83849
83998
|
const validation = SkillManifestSchema.safeParse(frontmatter);
|
|
83850
83999
|
if (!validation.success) {
|
|
83851
84000
|
const first = validation.error.issues[0];
|
|
83852
|
-
const
|
|
83853
|
-
throw new SkillParseError(`Frontmatter failed schema validation at \`${
|
|
84001
|
+
const path20 = first?.path.join(".") ?? "(root)";
|
|
84002
|
+
throw new SkillParseError(`Frontmatter failed schema validation at \`${path20}\`: ${first?.message ?? "unknown"}`);
|
|
83854
84003
|
}
|
|
83855
84004
|
return {
|
|
83856
84005
|
manifest: validation.data,
|
|
@@ -84230,16 +84379,16 @@ var init_dist32 = __esm({
|
|
|
84230
84379
|
// ../../packages/skills/dist/fs-adapter.js
|
|
84231
84380
|
import { closeSync, fsyncSync, mkdirSync as mkdirSync2, openSync, readdirSync, readFileSync as readFileSync3, renameSync, rmSync, statSync, writeFileSync as writeFileSync3 } from "fs";
|
|
84232
84381
|
import { dirname, join as join2, relative, sep } from "path";
|
|
84233
|
-
function existsFile(
|
|
84382
|
+
function existsFile(path20) {
|
|
84234
84383
|
try {
|
|
84235
|
-
statSync(
|
|
84384
|
+
statSync(path20);
|
|
84236
84385
|
return true;
|
|
84237
84386
|
} catch {
|
|
84238
84387
|
return false;
|
|
84239
84388
|
}
|
|
84240
84389
|
}
|
|
84241
|
-
function atomicWriteFile(
|
|
84242
|
-
const tempPath = `${
|
|
84390
|
+
function atomicWriteFile(path20, content) {
|
|
84391
|
+
const tempPath = `${path20}.tmp.${process.pid}`;
|
|
84243
84392
|
const fd = openSync(tempPath, "w");
|
|
84244
84393
|
try {
|
|
84245
84394
|
writeFileSync3(fd, content);
|
|
@@ -84247,7 +84396,7 @@ function atomicWriteFile(path19, content) {
|
|
|
84247
84396
|
} finally {
|
|
84248
84397
|
closeSync(fd);
|
|
84249
84398
|
}
|
|
84250
|
-
renameSync(tempPath,
|
|
84399
|
+
renameSync(tempPath, path20);
|
|
84251
84400
|
}
|
|
84252
84401
|
function collectAuxFiles(dir) {
|
|
84253
84402
|
const out = {};
|
|
@@ -84283,9 +84432,9 @@ function ensureSafeRelativePath(relPath) {
|
|
|
84283
84432
|
}
|
|
84284
84433
|
return segments.join("/");
|
|
84285
84434
|
}
|
|
84286
|
-
function resolveDirectorySkillSource(
|
|
84287
|
-
const skillMdPath = join2(
|
|
84288
|
-
const envPath = join2(
|
|
84435
|
+
function resolveDirectorySkillSource(path20) {
|
|
84436
|
+
const skillMdPath = join2(path20, SKILL_MD);
|
|
84437
|
+
const envPath = join2(path20, SKILL_ENVELOPE_JSON);
|
|
84289
84438
|
if (!existsFile(skillMdPath)) {
|
|
84290
84439
|
throw new SkillParseError(`No SKILL.md at ${skillMdPath}`);
|
|
84291
84440
|
}
|
|
@@ -84294,7 +84443,7 @@ function resolveDirectorySkillSource(path19) {
|
|
|
84294
84443
|
}
|
|
84295
84444
|
const parsed = parseSkillFile(readFileSync3(skillMdPath, "utf-8"));
|
|
84296
84445
|
const envelope = JSON.parse(readFileSync3(envPath, "utf-8"));
|
|
84297
|
-
const files = collectAuxFiles(
|
|
84446
|
+
const files = collectAuxFiles(path20);
|
|
84298
84447
|
return {
|
|
84299
84448
|
kind: "in_memory",
|
|
84300
84449
|
manifest: parsed.manifest,
|
|
@@ -84418,10 +84567,10 @@ var init_fs_adapter = __esm({
|
|
|
84418
84567
|
return join2(this.root, name);
|
|
84419
84568
|
}
|
|
84420
84569
|
readIndex() {
|
|
84421
|
-
const
|
|
84422
|
-
if (!existsFile(
|
|
84570
|
+
const path20 = join2(this.root, INSTALLED_JSON);
|
|
84571
|
+
if (!existsFile(path20))
|
|
84423
84572
|
return [];
|
|
84424
|
-
const raw = readFileSync3(
|
|
84573
|
+
const raw = readFileSync3(path20, "utf-8");
|
|
84425
84574
|
if (raw.trim() === "")
|
|
84426
84575
|
return [];
|
|
84427
84576
|
try {
|
|
@@ -84430,7 +84579,7 @@ var init_fs_adapter = __esm({
|
|
|
84430
84579
|
return [];
|
|
84431
84580
|
return parsed;
|
|
84432
84581
|
} catch (err2) {
|
|
84433
|
-
throw new Error(`Failed to parse skills index at ${
|
|
84582
|
+
throw new Error(`Failed to parse skills index at ${path20}: ${err2 instanceof Error ? err2.message : String(err2)}`, { cause: err2 instanceof Error ? err2 : void 0 });
|
|
84434
84583
|
}
|
|
84435
84584
|
}
|
|
84436
84585
|
writeIndex(index) {
|
|
@@ -86045,26 +86194,13 @@ function createTerminalRenderer(io) {
|
|
|
86045
86194
|
let inputRejecter = null;
|
|
86046
86195
|
let tail2 = "";
|
|
86047
86196
|
let statusRow = null;
|
|
86197
|
+
let modeRow = null;
|
|
86048
86198
|
let painted = { widths: [], cursorCol: 0 };
|
|
86049
|
-
function buildInputRow(
|
|
86050
|
-
const avail = Math.max(1, cols - 1 - inputState.promptWidth);
|
|
86051
|
-
if (inputState.line.length <= avail) {
|
|
86052
|
-
return {
|
|
86053
|
-
row: inputState.prompt + inputState.line,
|
|
86054
|
-
width: inputState.promptWidth + inputState.line.length,
|
|
86055
|
-
cursorCol: inputState.promptWidth + inputState.cursor
|
|
86056
|
-
};
|
|
86057
|
-
}
|
|
86058
|
-
const start = Math.max(
|
|
86059
|
-
0,
|
|
86060
|
-
Math.min(inputState.cursor - Math.floor(avail / 2), inputState.line.length - avail)
|
|
86061
|
-
);
|
|
86062
|
-
const windowText = inputState.line.slice(start, start + avail);
|
|
86063
|
-
const shown = start > 0 ? "\u2026" + windowText.slice(1) : windowText;
|
|
86199
|
+
function buildInputRow() {
|
|
86064
86200
|
return {
|
|
86065
|
-
row: inputState.prompt +
|
|
86066
|
-
width: inputState.promptWidth +
|
|
86067
|
-
cursorCol: inputState.promptWidth +
|
|
86201
|
+
row: inputState.prompt + inputState.line,
|
|
86202
|
+
width: inputState.promptWidth + inputState.line.length,
|
|
86203
|
+
cursorCol: inputState.promptWidth + inputState.cursor
|
|
86068
86204
|
};
|
|
86069
86205
|
}
|
|
86070
86206
|
function commit(scrollback) {
|
|
@@ -86090,9 +86226,14 @@ function createTerminalRenderer(io) {
|
|
|
86090
86226
|
rows.push(truncated + (io.isTTY ? RESET : ""));
|
|
86091
86227
|
widths.push(visibleLength(truncated));
|
|
86092
86228
|
}
|
|
86229
|
+
if (modeRow !== null) {
|
|
86230
|
+
const truncated = sliceVisible(modeRow, 0, cols - 1);
|
|
86231
|
+
rows.push(truncated + (io.isTTY ? RESET : ""));
|
|
86232
|
+
widths.push(visibleLength(truncated));
|
|
86233
|
+
}
|
|
86093
86234
|
let cursorCol = 0;
|
|
86094
86235
|
if (inputActive) {
|
|
86095
|
-
const built = buildInputRow(
|
|
86236
|
+
const built = buildInputRow();
|
|
86096
86237
|
rows.push(built.row);
|
|
86097
86238
|
widths.push(built.width);
|
|
86098
86239
|
cursorCol = built.cursorCol;
|
|
@@ -86101,8 +86242,12 @@ function createTerminalRenderer(io) {
|
|
|
86101
86242
|
}
|
|
86102
86243
|
if (rows.length > 0) {
|
|
86103
86244
|
out += rows.join("\n");
|
|
86245
|
+
const lastWidth = widths[widths.length - 1];
|
|
86246
|
+
const upWithin = cursorVisRow(lastWidth, cols) - cursorVisRow(cursorCol, cols);
|
|
86247
|
+
if (upWithin > 0) out += `\x1B[${upWithin}A`;
|
|
86104
86248
|
out += "\r";
|
|
86105
|
-
|
|
86249
|
+
const colInRow = cursorCol - cursorVisRow(cursorCol, cols) * cols;
|
|
86250
|
+
if (colInRow > 0) out += `\x1B[${colInRow}C`;
|
|
86106
86251
|
}
|
|
86107
86252
|
const hadOrHasRegion = painted.widths.length > 0 || rows.length > 0;
|
|
86108
86253
|
painted = { widths, cursorCol };
|
|
@@ -86110,9 +86255,21 @@ function createTerminalRenderer(io) {
|
|
|
86110
86255
|
io.write(io.isTTY && hadOrHasRegion ? SYNC_START + out + SYNC_END : out);
|
|
86111
86256
|
}
|
|
86112
86257
|
let atLineStart = true;
|
|
86258
|
+
let trailing = 2;
|
|
86259
|
+
function noteScrollback(flushed, tailAfter) {
|
|
86260
|
+
if (tailAfter !== "") {
|
|
86261
|
+
trailing = 0;
|
|
86262
|
+
return;
|
|
86263
|
+
}
|
|
86264
|
+
if (flushed === "") return;
|
|
86265
|
+
let n2 = 0;
|
|
86266
|
+
for (let i = flushed.length - 1; i >= 0 && flushed[i] === "\n" && n2 < 2; i--) n2++;
|
|
86267
|
+
trailing = n2 === flushed.length ? Math.min(2, trailing + n2) : n2;
|
|
86268
|
+
}
|
|
86113
86269
|
function writeOutput2(text) {
|
|
86114
86270
|
if (!io.isTTY && statusRow === null && !inputActive && tail2 === "") {
|
|
86115
86271
|
if (text.length > 0) atLineStart = text.endsWith("\n");
|
|
86272
|
+
noteScrollback(text, "");
|
|
86116
86273
|
io.write(text);
|
|
86117
86274
|
return;
|
|
86118
86275
|
}
|
|
@@ -86130,21 +86287,33 @@ function createTerminalRenderer(io) {
|
|
|
86130
86287
|
buffer = sliceVisible(buffer, cols, Number.MAX_SAFE_INTEGER);
|
|
86131
86288
|
}
|
|
86132
86289
|
tail2 = buffer;
|
|
86290
|
+
noteScrollback(scrollback, tail2);
|
|
86133
86291
|
commit(scrollback);
|
|
86134
86292
|
}
|
|
86135
86293
|
function writeLine2(text) {
|
|
86136
86294
|
const midLine = io.isTTY ? tail2 !== "" : !atLineStart;
|
|
86137
86295
|
writeOutput2((midLine ? "\n" : "") + text + "\n");
|
|
86138
86296
|
}
|
|
86297
|
+
function writeGap2() {
|
|
86298
|
+
const need = tail2 !== "" ? 2 : Math.max(0, 2 - trailing);
|
|
86299
|
+
if (need > 0) writeOutput2("\n".repeat(need));
|
|
86300
|
+
}
|
|
86139
86301
|
function setStatusRow2(row) {
|
|
86140
86302
|
if (!io.isTTY) return;
|
|
86141
86303
|
if (row === statusRow) return;
|
|
86142
86304
|
statusRow = row;
|
|
86143
86305
|
commit("");
|
|
86144
86306
|
}
|
|
86307
|
+
function setModeRow2(row) {
|
|
86308
|
+
if (!io.isTTY) return;
|
|
86309
|
+
if (row === modeRow) return;
|
|
86310
|
+
modeRow = row;
|
|
86311
|
+
commit("");
|
|
86312
|
+
}
|
|
86145
86313
|
function submit() {
|
|
86146
86314
|
const line = inputState.line;
|
|
86147
86315
|
inputActive = false;
|
|
86316
|
+
trailing = 1;
|
|
86148
86317
|
commit(inputState.prompt + line + "\n");
|
|
86149
86318
|
if (inputResolver) {
|
|
86150
86319
|
const resolve14 = inputResolver;
|
|
@@ -86202,8 +86371,10 @@ function createTerminalRenderer(io) {
|
|
|
86202
86371
|
return {
|
|
86203
86372
|
writeOutput: writeOutput2,
|
|
86204
86373
|
writeLine: writeLine2,
|
|
86374
|
+
writeGap: writeGap2,
|
|
86205
86375
|
readInput: readInput2,
|
|
86206
86376
|
setStatusRow: setStatusRow2,
|
|
86377
|
+
setModeRow: setModeRow2,
|
|
86207
86378
|
handleEvent,
|
|
86208
86379
|
repaint: () => commit(""),
|
|
86209
86380
|
detach
|
|
@@ -86443,9 +86614,15 @@ function readInput(promptText) {
|
|
|
86443
86614
|
function askQuestion(promptText) {
|
|
86444
86615
|
return readInput(promptText);
|
|
86445
86616
|
}
|
|
86617
|
+
function writeGap() {
|
|
86618
|
+
renderer.writeGap();
|
|
86619
|
+
}
|
|
86446
86620
|
function setStatusRow(row) {
|
|
86447
86621
|
renderer.setStatusRow(row);
|
|
86448
86622
|
}
|
|
86623
|
+
function setModeRow(row) {
|
|
86624
|
+
renderer.setModeRow(row);
|
|
86625
|
+
}
|
|
86449
86626
|
var ANSI_RE, RESET, SYNC_START, SYNC_END, PASTE_OPEN, PASTE_CLOSE, lastEscTime, pendingEscTimer, pasteBuffer, pasteSplitCarry, stdoutIO, renderer, initialized, resizeTimer;
|
|
86450
86627
|
var init_terminal = __esm({
|
|
86451
86628
|
"src/terminal.ts"() {
|
|
@@ -86478,6 +86655,7 @@ function spinnerFrame(frame) {
|
|
|
86478
86655
|
}
|
|
86479
86656
|
function formatElapsed(startedAt, nowMs) {
|
|
86480
86657
|
const totalSec = Math.max(0, Math.floor((nowMs - startedAt) / 1e3));
|
|
86658
|
+
if (totalSec === 0) return "<1s";
|
|
86481
86659
|
if (totalSec < 60) return `${totalSec}s`;
|
|
86482
86660
|
const min = Math.floor(totalSec / 60);
|
|
86483
86661
|
const sec = totalSec % 60;
|
|
@@ -86589,11 +86767,17 @@ function createCliLogger() {
|
|
|
86589
86767
|
}
|
|
86590
86768
|
return;
|
|
86591
86769
|
}
|
|
86592
|
-
|
|
86770
|
+
const indent2 = activeStatus() ? " " : " ";
|
|
86771
|
+
const designed = DESIGNED_SENTENCES[message2]?.(context);
|
|
86772
|
+
if (designed != null) {
|
|
86773
|
+
writeLine(`${indent2}${warn2("\xB7")} ${meta(designed)}`);
|
|
86774
|
+
return;
|
|
86775
|
+
}
|
|
86776
|
+
writeLine(`${indent2}${warn2("\xB7")} ${meta(message2 + formatContext(context))}`);
|
|
86593
86777
|
}
|
|
86594
86778
|
};
|
|
86595
86779
|
}
|
|
86596
|
-
var POLL_TROUBLE;
|
|
86780
|
+
var POLL_TROUBLE, DESIGNED_SENTENCES;
|
|
86597
86781
|
var init_cli_logger = __esm({
|
|
86598
86782
|
"src/cli-logger.ts"() {
|
|
86599
86783
|
"use strict";
|
|
@@ -86602,6 +86786,19 @@ var init_cli_logger = __esm({
|
|
|
86602
86786
|
init_statusline();
|
|
86603
86787
|
init_colors();
|
|
86604
86788
|
POLL_TROUBLE = /* @__PURE__ */ new Set(["delegation poll failed", "delegation poll token mint failed"]);
|
|
86789
|
+
DESIGNED_SENTENCES = {
|
|
86790
|
+
"delegation.route_degraded": (ctx) => {
|
|
86791
|
+
if (ctx?.from !== "p2p" || ctx?.to !== "relay") return null;
|
|
86792
|
+
const code2 = typeof ctx.code === "string" ? ` (${ctx.code})` : "";
|
|
86793
|
+
return `direct payment route unavailable${code2} \u2014 this task goes through the relay; no onchain payment leaves the wallet`;
|
|
86794
|
+
},
|
|
86795
|
+
"money_meter.volatile_spend_store": () => "grant spending is metered in memory this session \u2014 the lifetime ceiling re-arms on restart",
|
|
86796
|
+
"relay_key_pin.rotated": (ctx) => {
|
|
86797
|
+
const to = typeof ctx?.toKeyPrefix === "string" ? ` (now ${ctx.toKeyPrefix}\u2026)` : "";
|
|
86798
|
+
return `the relay's signing key rotated${to} \u2014 the new key is pinned`;
|
|
86799
|
+
},
|
|
86800
|
+
"relay_key_pin.mismatch": () => "the relay's signing key does not match the pinned key \u2014 refusing to trust it"
|
|
86801
|
+
};
|
|
86605
86802
|
}
|
|
86606
86803
|
});
|
|
86607
86804
|
|
|
@@ -90483,10 +90680,12 @@ function createTaskRouter(deps) {
|
|
|
90483
90680
|
const candidates = settled.filter((r2) => r2.status === "fulfilled").flatMap((r2) => r2.value).slice(0, MAX_TOTAL_FEDERATED);
|
|
90484
90681
|
return { candidates, federationEdges: allFederationEdges, peerRelayNodes };
|
|
90485
90682
|
}
|
|
90486
|
-
function queryLocalAgents(capability, motebitId, limit = 20, federatedOnly = false) {
|
|
90683
|
+
function queryLocalAgents(capability, motebitId, limit = 20, federatedOnly = false, includeDelisted = false) {
|
|
90487
90684
|
const now = Date.now();
|
|
90488
90685
|
const revokedFilter = " AND (revoked IS NULL OR revoked = 0)";
|
|
90489
90686
|
const fedFilter = federatedOnly ? " AND (federation_visible IS NULL OR federation_visible != 0)" : "";
|
|
90687
|
+
const delistCutoff = Math.floor(now - FRESHNESS_DELISTED_MS);
|
|
90688
|
+
const staleFilter = includeDelisted ? "" : ` AND COALESCE(NULLIF(last_heartbeat, 0), registered_at, 0) >= ${delistCutoff}`;
|
|
90490
90689
|
let rows;
|
|
90491
90690
|
if (capability && motebitId) {
|
|
90492
90691
|
rows = db.prepare(`
|
|
@@ -90498,7 +90697,7 @@ function createTaskRouter(deps) {
|
|
|
90498
90697
|
} else if (capability) {
|
|
90499
90698
|
rows = db.prepare(`
|
|
90500
90699
|
SELECT * FROM agent_registry
|
|
90501
|
-
WHERE EXISTS (SELECT 1 FROM json_each(capabilities) WHERE value = ?)${revokedFilter}${fedFilter}
|
|
90700
|
+
WHERE EXISTS (SELECT 1 FROM json_each(capabilities) WHERE value = ?)${revokedFilter}${fedFilter}${staleFilter}
|
|
90502
90701
|
LIMIT ?
|
|
90503
90702
|
`).all(capability, limit);
|
|
90504
90703
|
} else if (motebitId) {
|
|
@@ -90507,7 +90706,7 @@ function createTaskRouter(deps) {
|
|
|
90507
90706
|
`).all(motebitId, limit);
|
|
90508
90707
|
} else {
|
|
90509
90708
|
rows = db.prepare(`
|
|
90510
|
-
SELECT * FROM agent_registry WHERE 1=1${revokedFilter}${fedFilter} LIMIT ?
|
|
90709
|
+
SELECT * FROM agent_registry WHERE 1=1${revokedFilter}${fedFilter}${staleFilter} LIMIT ?
|
|
90511
90710
|
`).all(limit);
|
|
90512
90711
|
}
|
|
90513
90712
|
const ids = rows.map((r2) => r2.motebit_id);
|
|
@@ -90888,7 +91087,7 @@ async function evaluateSettlementEligibility(db, delegatorId, workerId, delegato
|
|
|
90888
91087
|
reason: trustRow ? `Trust ${score} / ${interactions} interactions below established-pair threshold (${P2P_MIN_TRUST_SCORE} / ${P2P_MIN_INTERACTIONS}); delegator did not acknowledge cold-start risk` : "No trust history between agents; delegator did not acknowledge cold-start risk"
|
|
90889
91088
|
};
|
|
90890
91089
|
}
|
|
90891
|
-
var logger13, circuitBreakerLogger, FRESHNESS_AWAKE_MS, FRESHNESS_RECENT_MS, FRESHNESS_DORMANT_MS, P2P_MIN_TRUST_SCORE, P2P_MIN_INTERACTIONS, P2P_SOVEREIGN_MIN_TRUST_SCORE, P2P_SOVEREIGN_MIN_INTERACTIONS, P2P_BONDED_MIN_TRUST_SCORE, P2P_BONDED_MIN_INTERACTIONS, REFERENCE_BOND_COVERAGE_MULTIPLE;
|
|
91090
|
+
var logger13, circuitBreakerLogger, FRESHNESS_AWAKE_MS, FRESHNESS_RECENT_MS, FRESHNESS_DORMANT_MS, FRESHNESS_DELISTED_MS, P2P_MIN_TRUST_SCORE, P2P_MIN_INTERACTIONS, P2P_SOVEREIGN_MIN_TRUST_SCORE, P2P_SOVEREIGN_MIN_INTERACTIONS, P2P_BONDED_MIN_TRUST_SCORE, P2P_BONDED_MIN_INTERACTIONS, REFERENCE_BOND_COVERAGE_MULTIPLE;
|
|
90892
91091
|
var init_task_routing = __esm({
|
|
90893
91092
|
"../../services/relay/dist/task-routing.js"() {
|
|
90894
91093
|
"use strict";
|
|
@@ -90907,6 +91106,7 @@ var init_task_routing = __esm({
|
|
|
90907
91106
|
FRESHNESS_AWAKE_MS = 6 * 60 * 1e3;
|
|
90908
91107
|
FRESHNESS_RECENT_MS = 30 * 60 * 1e3;
|
|
90909
91108
|
FRESHNESS_DORMANT_MS = 24 * 60 * 60 * 1e3;
|
|
91109
|
+
FRESHNESS_DELISTED_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
90910
91110
|
P2P_MIN_TRUST_SCORE = 0.6;
|
|
90911
91111
|
P2P_MIN_INTERACTIONS = 5;
|
|
90912
91112
|
P2P_SOVEREIGN_MIN_TRUST_SCORE = 0.3;
|
|
@@ -93828,8 +94028,8 @@ var init_x402_facilitator = __esm({
|
|
|
93828
94028
|
|
|
93829
94029
|
// ../../services/relay/dist/tasks.js
|
|
93830
94030
|
import { HTTPException as HTTPException7 } from "hono/http-exception";
|
|
93831
|
-
function extractMotebitIdFromPath(
|
|
93832
|
-
const match =
|
|
94031
|
+
function extractMotebitIdFromPath(path20) {
|
|
94032
|
+
const match = path20.match(/\/agent\/([^/]+)\/task/);
|
|
93833
94033
|
return match ? match[1] : null;
|
|
93834
94034
|
}
|
|
93835
94035
|
function getListingUnitCost(moteDb, agentId, capability) {
|
|
@@ -95716,9 +95916,9 @@ function enrichWithBondStatus(agents, db, nowMs = Date.now()) {
|
|
|
95716
95916
|
function registerAgentAuthMiddleware(deps) {
|
|
95717
95917
|
const { app, apiToken, identityManager, parseTokenPayloadUnsafe: parseTokenPayloadUnsafe2, verifySignedTokenForDevice: verifySignedTokenForDevice2, isTokenBlacklisted, isAgentRevoked } = deps;
|
|
95718
95918
|
app.use("/api/v1/agents/*", async (c5, next) => {
|
|
95719
|
-
const
|
|
95919
|
+
const path20 = c5.req.path;
|
|
95720
95920
|
const method = c5.req.method;
|
|
95721
|
-
if (PUBLIC_AGENT_ROUTES.some((r2) => r2.match(
|
|
95921
|
+
if (PUBLIC_AGENT_ROUTES.some((r2) => r2.match(path20, method))) {
|
|
95722
95922
|
await next();
|
|
95723
95923
|
return;
|
|
95724
95924
|
}
|
|
@@ -95736,25 +95936,25 @@ function registerAgentAuthMiddleware(deps) {
|
|
|
95736
95936
|
throw new HTTPException8(401, { message: "Invalid token" });
|
|
95737
95937
|
}
|
|
95738
95938
|
let agentAudience;
|
|
95739
|
-
if (
|
|
95939
|
+
if (path20.includes("/p2p-eligibility")) {
|
|
95740
95940
|
agentAudience = "market:listing";
|
|
95741
|
-
} else if (
|
|
95941
|
+
} else if (path20.includes("/listing")) {
|
|
95742
95942
|
agentAudience = "market:listing";
|
|
95743
|
-
} else if (
|
|
95943
|
+
} else if (path20.includes("/credentials")) {
|
|
95744
95944
|
agentAudience = "credentials";
|
|
95745
|
-
} else if (
|
|
95945
|
+
} else if (path20.includes("/presentation")) {
|
|
95746
95946
|
agentAudience = "credentials:present";
|
|
95747
|
-
} else if (
|
|
95947
|
+
} else if (path20.includes("/proxy-token")) {
|
|
95748
95948
|
agentAudience = "proxy:token";
|
|
95749
|
-
} else if (
|
|
95949
|
+
} else if (path20.includes("/receipts")) {
|
|
95750
95950
|
agentAudience = "receipts:read";
|
|
95751
|
-
} else if (
|
|
95951
|
+
} else if (path20.endsWith("/balance") || path20.endsWith("/settlements")) {
|
|
95752
95952
|
agentAudience = "account:balance";
|
|
95753
|
-
} else if (
|
|
95953
|
+
} else if (path20.endsWith("/withdrawals")) {
|
|
95754
95954
|
agentAudience = "account:withdrawals";
|
|
95755
|
-
} else if (
|
|
95955
|
+
} else if (path20.endsWith("/withdraw")) {
|
|
95756
95956
|
agentAudience = "account:withdraw";
|
|
95757
|
-
} else if (
|
|
95957
|
+
} else if (path20.endsWith("/checkout")) {
|
|
95758
95958
|
agentAudience = "account:checkout";
|
|
95759
95959
|
} else {
|
|
95760
95960
|
agentAudience = "admin:query";
|
|
@@ -95774,7 +95974,7 @@ function registerAgentAuthMiddleware(deps) {
|
|
|
95774
95974
|
reason,
|
|
95775
95975
|
expectedAudience: agentAudience,
|
|
95776
95976
|
mid: claims.mid,
|
|
95777
|
-
path:
|
|
95977
|
+
path: path20
|
|
95778
95978
|
})
|
|
95779
95979
|
);
|
|
95780
95980
|
if (!valid) {
|
|
@@ -96315,9 +96515,13 @@ function registerAgentRoutes(deps) {
|
|
|
96315
96515
|
const motebitId = c5.req.query("motebit_id");
|
|
96316
96516
|
const limitParam = Number(c5.req.query("limit") ?? "20");
|
|
96317
96517
|
const limit = Math.min(Math.max(1, limitParam), 100);
|
|
96318
|
-
const
|
|
96518
|
+
const includeAll = c5.req.query("include") === "all";
|
|
96519
|
+
const localAgents = taskRouter.queryLocalAgents(capability ?? void 0, motebitId ?? void 0, limit, false, includeAll).filter((a4) => includeAll || a4.motebit_id !== relayIdentity.relayMotebitId);
|
|
96319
96520
|
const localResults = localAgents.map((a4) => ({
|
|
96320
96521
|
...a4,
|
|
96522
|
+
// The relay's own registration reads as a zero-capability ghost in the
|
|
96523
|
+
// agent listing — mark its role when the full view includes it.
|
|
96524
|
+
...a4.motebit_id === relayIdentity.relayMotebitId ? { role: "relay" } : {},
|
|
96321
96525
|
source_relay: relayIdentity.relayMotebitId,
|
|
96322
96526
|
relay_name: federationConfig?.displayName ?? null,
|
|
96323
96527
|
hop_distance: 0
|
|
@@ -101533,8 +101737,36 @@ init_esm_shims();
|
|
|
101533
101737
|
init_dist4();
|
|
101534
101738
|
init_dist6();
|
|
101535
101739
|
init_dist7();
|
|
101536
|
-
|
|
101740
|
+
|
|
101741
|
+
// src/model-admission.ts
|
|
101742
|
+
init_esm_shims();
|
|
101537
101743
|
init_dist2();
|
|
101744
|
+
var HOSTED_VENDORS = /* @__PURE__ */ new Set(["anthropic", "openai", "google", "deepseek"]);
|
|
101745
|
+
var VENDOR_PROVIDER_FLAG = {
|
|
101746
|
+
anthropic: "anthropic",
|
|
101747
|
+
openai: "openai",
|
|
101748
|
+
google: "google"
|
|
101749
|
+
};
|
|
101750
|
+
function admitModelForProvider(provider, model) {
|
|
101751
|
+
const hint = modelVendorHint(model);
|
|
101752
|
+
if ((provider === "local-server" || provider === "ollama") && HOSTED_VENDORS.has(hint)) {
|
|
101753
|
+
const flag = VENDOR_PROVIDER_FLAG[hint];
|
|
101754
|
+
return {
|
|
101755
|
+
admissible: false,
|
|
101756
|
+
teach: `${model} is a hosted ${hint} model \u2014 a local server can't serve it. ` + (flag != null ? `Restart with --provider ${flag}, or pick a local model (e.g. /model llama3.2).` : `Pick a local model instead (e.g. /model llama3.2).`)
|
|
101757
|
+
};
|
|
101758
|
+
}
|
|
101759
|
+
if (!providerAcceptsModel(provider, model)) {
|
|
101760
|
+
const flag = VENDOR_PROVIDER_FLAG[hint];
|
|
101761
|
+
return {
|
|
101762
|
+
admissible: false,
|
|
101763
|
+
teach: `${model} belongs to ${hint === "unknown" ? "another provider" : hint} \u2014 the active provider is ${provider}. ` + (flag != null ? `Restart with --provider ${flag} to use it.` : `Pick a ${provider} model instead.`)
|
|
101764
|
+
};
|
|
101765
|
+
}
|
|
101766
|
+
return { admissible: true };
|
|
101767
|
+
}
|
|
101768
|
+
|
|
101769
|
+
// src/index.ts
|
|
101538
101770
|
init_dist8();
|
|
101539
101771
|
|
|
101540
101772
|
// src/grant-preflight.ts
|
|
@@ -101572,10 +101804,10 @@ function generateUUIDv72() {
|
|
|
101572
101804
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
101573
101805
|
}
|
|
101574
101806
|
function loadStoredGrant(grantId) {
|
|
101575
|
-
const
|
|
101576
|
-
if (!existsSync(
|
|
101807
|
+
const path20 = join7(grantsDir(), `${grantId}.json`);
|
|
101808
|
+
if (!existsSync(path20)) return null;
|
|
101577
101809
|
try {
|
|
101578
|
-
return JSON.parse(readFileSync4(
|
|
101810
|
+
return JSON.parse(readFileSync4(path20, "utf8"));
|
|
101579
101811
|
} catch {
|
|
101580
101812
|
return null;
|
|
101581
101813
|
}
|
|
@@ -102120,11 +102352,12 @@ function parseCliArgs(args = process.argv.slice(2)) {
|
|
|
102120
102352
|
);
|
|
102121
102353
|
}
|
|
102122
102354
|
const cliProvider = rawProvider;
|
|
102123
|
-
const defaultModel = cliProvider
|
|
102355
|
+
const defaultModel = defaultModelForProvider(cliProvider);
|
|
102124
102356
|
const allowedPaths = values["allowed-paths"] != null && values["allowed-paths"] !== "" ? values["allowed-paths"].split(",").map((p5) => p5.trim()) : [process.cwd()];
|
|
102125
102357
|
return {
|
|
102126
102358
|
provider: cliProvider,
|
|
102127
102359
|
model: values.model ?? defaultModel,
|
|
102360
|
+
modelExplicit: values.model != null,
|
|
102128
102361
|
dbPath: values["db-path"],
|
|
102129
102362
|
noStream: values["no-stream"],
|
|
102130
102363
|
syncUrl: values["sync-url"],
|
|
@@ -102428,6 +102661,9 @@ Slash commands (in REPL):`
|
|
|
102428
102661
|
function printVersion() {
|
|
102429
102662
|
console.log(VERSION);
|
|
102430
102663
|
}
|
|
102664
|
+
function defaultModelForProvider(provider) {
|
|
102665
|
+
return provider === "local-server" ? "llama3.2" : provider === "openai" ? "gpt-5.4-mini" : provider === "google" ? "gemini-2.5-flash" : provider === "groq" ? "llama-3.3-70b-versatile" : provider === "deepseek" ? "deepseek-chat" : "claude-sonnet-4-6";
|
|
102666
|
+
}
|
|
102431
102667
|
function printBanner(opts) {
|
|
102432
102668
|
const W2 = 56;
|
|
102433
102669
|
const pad = (s3, visibleLen) => s3 + " ".repeat(Math.max(0, W2 - visibleLen));
|
|
@@ -102474,12 +102710,85 @@ function trimHistory(history) {
|
|
|
102474
102710
|
|
|
102475
102711
|
// src/index.ts
|
|
102476
102712
|
init_config2();
|
|
102713
|
+
|
|
102714
|
+
// src/update-nudge.ts
|
|
102715
|
+
init_esm_shims();
|
|
102716
|
+
init_config2();
|
|
102717
|
+
import * as fs7 from "fs";
|
|
102718
|
+
import * as path9 from "path";
|
|
102719
|
+
var UPDATE_CHECK_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
102720
|
+
var FETCH_TIMEOUT_MS = 3e3;
|
|
102721
|
+
function updateCheckPath() {
|
|
102722
|
+
return path9.join(CONFIG_DIR, "update-check.json");
|
|
102723
|
+
}
|
|
102724
|
+
function isNewerVersion(latest, current2) {
|
|
102725
|
+
const parse3 = (v3) => {
|
|
102726
|
+
const parts = v3.trim().split(".");
|
|
102727
|
+
if (parts.length !== 3) return null;
|
|
102728
|
+
const nums = parts.map((p5) => /^\d+$/.test(p5) ? Number(p5) : NaN);
|
|
102729
|
+
return nums.some((n2) => Number.isNaN(n2)) ? null : nums;
|
|
102730
|
+
};
|
|
102731
|
+
const l6 = parse3(latest);
|
|
102732
|
+
const c5 = parse3(current2);
|
|
102733
|
+
if (l6 == null || c5 == null) return false;
|
|
102734
|
+
for (let i = 0; i < 3; i++) {
|
|
102735
|
+
if (l6[i] > c5[i]) return true;
|
|
102736
|
+
if (l6[i] < c5[i]) return false;
|
|
102737
|
+
}
|
|
102738
|
+
return false;
|
|
102739
|
+
}
|
|
102740
|
+
function readUpdateState(statePath = updateCheckPath()) {
|
|
102741
|
+
try {
|
|
102742
|
+
const raw = JSON.parse(fs7.readFileSync(statePath, "utf-8"));
|
|
102743
|
+
if (typeof raw.last_checked_at !== "number") return null;
|
|
102744
|
+
return {
|
|
102745
|
+
last_checked_at: raw.last_checked_at,
|
|
102746
|
+
...typeof raw.latest === "string" ? { latest: raw.latest } : {}
|
|
102747
|
+
};
|
|
102748
|
+
} catch {
|
|
102749
|
+
return null;
|
|
102750
|
+
}
|
|
102751
|
+
}
|
|
102752
|
+
function renderUpdateNudge(params) {
|
|
102753
|
+
const latest = params.state?.latest;
|
|
102754
|
+
if (latest == null || !isNewerVersion(latest, params.currentVersion)) return null;
|
|
102755
|
+
return `motebit ${latest} available \u2014 npm i -g motebit`;
|
|
102756
|
+
}
|
|
102757
|
+
function refreshUpdateCheckInBackground(params) {
|
|
102758
|
+
const statePath = params?.statePath ?? updateCheckPath();
|
|
102759
|
+
const now = params?.nowMs ?? Date.now();
|
|
102760
|
+
const ttl = params?.ttlMs ?? UPDATE_CHECK_TTL_MS;
|
|
102761
|
+
const fetchFn = params?.fetchFn ?? fetch;
|
|
102762
|
+
const state = readUpdateState(statePath);
|
|
102763
|
+
if (state != null && now - state.last_checked_at < ttl) return;
|
|
102764
|
+
void (async () => {
|
|
102765
|
+
const controller = new AbortController();
|
|
102766
|
+
const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
|
|
102767
|
+
try {
|
|
102768
|
+
const resp = await fetchFn("https://registry.npmjs.org/motebit/latest", {
|
|
102769
|
+
signal: controller.signal
|
|
102770
|
+
});
|
|
102771
|
+
if (!resp.ok) return;
|
|
102772
|
+
const body = await resp.json();
|
|
102773
|
+
if (typeof body.version !== "string") return;
|
|
102774
|
+
fs7.mkdirSync(path9.dirname(statePath), { recursive: true });
|
|
102775
|
+
fs7.writeFileSync(
|
|
102776
|
+
statePath,
|
|
102777
|
+
JSON.stringify({ last_checked_at: now, latest: body.version })
|
|
102778
|
+
);
|
|
102779
|
+
} catch {
|
|
102780
|
+
} finally {
|
|
102781
|
+
clearTimeout(timer);
|
|
102782
|
+
}
|
|
102783
|
+
})();
|
|
102784
|
+
}
|
|
102785
|
+
|
|
102786
|
+
// src/index.ts
|
|
102477
102787
|
init_identity();
|
|
102478
102788
|
init_runtime_factory();
|
|
102479
102789
|
|
|
102480
102790
|
// src/stream.ts
|
|
102481
102791
|
init_esm_shims();
|
|
102482
|
-
init_dist4();
|
|
102483
102792
|
init_colors();
|
|
102484
102793
|
init_terminal();
|
|
102485
102794
|
init_statusline();
|
|
@@ -102563,7 +102872,6 @@ function renderReceiptLine(receipt, depth, last) {
|
|
|
102563
102872
|
async function renderReceipt(receipt, out = (s3) => console.log(s3), trustedAnchor) {
|
|
102564
102873
|
const lines = renderReceiptLine(receipt, 0, true);
|
|
102565
102874
|
const header = `${dim("\u2500 receipt ")}${dim("\xB7")} ${cyan(shortHash2(receipt.task_id))}`;
|
|
102566
|
-
out("");
|
|
102567
102875
|
out(header);
|
|
102568
102876
|
for (const line of lines) out(line);
|
|
102569
102877
|
let verifiedFlag = false;
|
|
@@ -102594,7 +102902,6 @@ async function renderReceipt(receipt, out = (s3) => console.log(s3), trustedAnch
|
|
|
102594
102902
|
)}${errorMsg ? dim(" \xB7 " + errorMsg) : ""}`
|
|
102595
102903
|
);
|
|
102596
102904
|
}
|
|
102597
|
-
out("");
|
|
102598
102905
|
const ret = { verified: verifiedFlag };
|
|
102599
102906
|
if (errorMsg !== void 0) ret.error = errorMsg;
|
|
102600
102907
|
return ret;
|
|
@@ -102732,11 +103039,18 @@ function toolDoneLine(name, elapsedMs) {
|
|
|
102732
103039
|
async function consumeStream(stream, runtime, opts) {
|
|
102733
103040
|
let pendingApproval = null;
|
|
102734
103041
|
let status = null;
|
|
103042
|
+
let thinking = null;
|
|
103043
|
+
const stopThinking = () => {
|
|
103044
|
+
thinking?.stop();
|
|
103045
|
+
thinking = null;
|
|
103046
|
+
};
|
|
102735
103047
|
const stopStatus = () => {
|
|
103048
|
+
stopThinking();
|
|
102736
103049
|
const elapsed = status?.stop() ?? 0;
|
|
102737
103050
|
status = null;
|
|
102738
103051
|
return elapsed;
|
|
102739
103052
|
};
|
|
103053
|
+
thinking = startStatus("thinking");
|
|
102740
103054
|
let lastCompletedReceiptResult = null;
|
|
102741
103055
|
let sawAnyChunk = false;
|
|
102742
103056
|
try {
|
|
@@ -102744,6 +103058,7 @@ async function consumeStream(stream, runtime, opts) {
|
|
|
102744
103058
|
sawAnyChunk = true;
|
|
102745
103059
|
switch (chunk.type) {
|
|
102746
103060
|
case "text":
|
|
103061
|
+
stopThinking();
|
|
102747
103062
|
writeOutput(chunk.text);
|
|
102748
103063
|
break;
|
|
102749
103064
|
case "tool_status":
|
|
@@ -102752,15 +103067,18 @@ async function consumeStream(stream, runtime, opts) {
|
|
|
102752
103067
|
for (const line of renderAuthorityDelta(chunk.name, chunk.missing_authority)) {
|
|
102753
103068
|
writeLine(meta(line));
|
|
102754
103069
|
}
|
|
103070
|
+
thinking = startStatus("thinking");
|
|
102755
103071
|
break;
|
|
102756
103072
|
}
|
|
102757
103073
|
if (chunk.name === "delegate_to_agent" && chunk.status === "calling" && status) {
|
|
102758
103074
|
break;
|
|
102759
103075
|
}
|
|
102760
103076
|
if (chunk.status === "calling") {
|
|
103077
|
+
stopThinking();
|
|
102761
103078
|
status = chunk.name === "delegate_to_agent" ? startStatus("delegating") : startStatus("running", chunk.name);
|
|
102762
103079
|
} else if (status) {
|
|
102763
103080
|
writeLine(toolDoneLine(chunk.name, stopStatus()));
|
|
103081
|
+
thinking = startStatus("thinking");
|
|
102764
103082
|
}
|
|
102765
103083
|
break;
|
|
102766
103084
|
case "approval_request":
|
|
@@ -102776,6 +103094,7 @@ async function consumeStream(stream, runtime, opts) {
|
|
|
102776
103094
|
break;
|
|
102777
103095
|
case "delegation_start":
|
|
102778
103096
|
if (status) break;
|
|
103097
|
+
stopThinking();
|
|
102779
103098
|
status = startStatus("delegating", chunk.tool);
|
|
102780
103099
|
break;
|
|
102781
103100
|
case "task_step_narration":
|
|
@@ -102783,10 +103102,15 @@ async function consumeStream(stream, runtime, opts) {
|
|
|
102783
103102
|
writeLine(` ${meta("\xB7 " + chunk.text.trim())}`);
|
|
102784
103103
|
break;
|
|
102785
103104
|
case "delegation_complete":
|
|
102786
|
-
if (status)
|
|
103105
|
+
if (status) {
|
|
103106
|
+
writeLine(toolDoneLine(chunk.tool, stopStatus()));
|
|
103107
|
+
thinking = startStatus("thinking");
|
|
103108
|
+
}
|
|
102787
103109
|
if (chunk.full_receipt) {
|
|
102788
103110
|
archiveReceipt(chunk.full_receipt);
|
|
103111
|
+
writeGap();
|
|
102789
103112
|
await renderReceipt(chunk.full_receipt, (line) => writeOutput(line + "\n"));
|
|
103113
|
+
writeGap();
|
|
102790
103114
|
if (chunk.full_receipt.status === "completed" && chunk.full_receipt.result) {
|
|
102791
103115
|
lastCompletedReceiptResult = chunk.full_receipt.result;
|
|
102792
103116
|
}
|
|
@@ -102817,23 +103141,15 @@ async function consumeStream(stream, runtime, opts) {
|
|
|
102817
103141
|
case "result": {
|
|
102818
103142
|
const result = chunk.result;
|
|
102819
103143
|
stopStatus();
|
|
102820
|
-
|
|
103144
|
+
writeGap();
|
|
102821
103145
|
if (result.memoriesFormed.length > 0) {
|
|
102822
|
-
|
|
103146
|
+
writeLine(
|
|
102823
103147
|
meta(
|
|
102824
103148
|
` [memories: ${result.memoriesFormed.map((m4) => m4.content).join(", ")}]`
|
|
102825
|
-
)
|
|
103149
|
+
)
|
|
102826
103150
|
);
|
|
103151
|
+
writeGap();
|
|
102827
103152
|
}
|
|
102828
|
-
const s3 = result.stateAfter;
|
|
102829
|
-
writeOutput(
|
|
102830
|
-
meta(
|
|
102831
|
-
` [state: attention=${s3.attention.toFixed(2)} confidence=${s3.confidence.toFixed(2)} valence=${s3.affect_valence.toFixed(2)} curiosity=${s3.curiosity.toFixed(2)}]`
|
|
102832
|
-
) + "\n"
|
|
102833
|
-
);
|
|
102834
|
-
const bodyLine = formatBodyAwareness(result.cues);
|
|
102835
|
-
if (bodyLine) writeOutput(meta(` ${bodyLine}`) + "\n");
|
|
102836
|
-
writeOutput("\n");
|
|
102837
103153
|
break;
|
|
102838
103154
|
}
|
|
102839
103155
|
}
|
|
@@ -102875,6 +103191,17 @@ async function consumeStream(stream, runtime, opts) {
|
|
|
102875
103191
|
// src/index.ts
|
|
102876
103192
|
init_terminal();
|
|
102877
103193
|
|
|
103194
|
+
// src/mode-render.ts
|
|
103195
|
+
init_esm_shims();
|
|
103196
|
+
init_colors();
|
|
103197
|
+
function renderModeRow(state) {
|
|
103198
|
+
const parts = [];
|
|
103199
|
+
if (state.attachedPid != null) parts.push(`attached \xB7 coordinator pid ${state.attachedPid}`);
|
|
103200
|
+
if (state.model) parts.push(state.model);
|
|
103201
|
+
if (state.provider) parts.push(state.provider);
|
|
103202
|
+
return meta(` \u2500\u2500 ${parts.join(" \xB7 ")}`);
|
|
103203
|
+
}
|
|
103204
|
+
|
|
102878
103205
|
// src/runtime-host.ts
|
|
102879
103206
|
init_esm_shims();
|
|
102880
103207
|
|
|
@@ -102927,14 +103254,14 @@ var JsonLineDecoder = class {
|
|
|
102927
103254
|
|
|
102928
103255
|
// ../../packages/runtime-host/dist/paths-shared.js
|
|
102929
103256
|
init_esm_shims();
|
|
102930
|
-
function isWindowsPipePath(
|
|
102931
|
-
return
|
|
103257
|
+
function isWindowsPipePath(path20) {
|
|
103258
|
+
return path20.startsWith("\\\\.\\pipe\\");
|
|
102932
103259
|
}
|
|
102933
103260
|
|
|
102934
103261
|
// ../../packages/runtime-host/dist/lockfile.js
|
|
102935
103262
|
init_esm_shims();
|
|
102936
|
-
async function readLockfile(platform,
|
|
102937
|
-
const raw = await platform.readFile(
|
|
103263
|
+
async function readLockfile(platform, path20) {
|
|
103264
|
+
const raw = await platform.readFile(path20);
|
|
102938
103265
|
if (raw === null)
|
|
102939
103266
|
return null;
|
|
102940
103267
|
try {
|
|
@@ -102954,16 +103281,16 @@ async function readLockfile(platform, path19) {
|
|
|
102954
103281
|
return null;
|
|
102955
103282
|
}
|
|
102956
103283
|
}
|
|
102957
|
-
async function writeLockfile(platform,
|
|
102958
|
-
await platform.writeFile(
|
|
103284
|
+
async function writeLockfile(platform, path20, record) {
|
|
103285
|
+
await platform.writeFile(path20, `${JSON.stringify(record)}
|
|
102959
103286
|
`);
|
|
102960
103287
|
}
|
|
102961
|
-
async function removeLockfile(platform,
|
|
102962
|
-
const current2 = await readLockfile(platform,
|
|
103288
|
+
async function removeLockfile(platform, path20, pid) {
|
|
103289
|
+
const current2 = await readLockfile(platform, path20);
|
|
102963
103290
|
if (current2 !== null && current2.pid !== pid)
|
|
102964
103291
|
return;
|
|
102965
103292
|
try {
|
|
102966
|
-
await platform.removeFile(
|
|
103293
|
+
await platform.removeFile(path20);
|
|
102967
103294
|
} catch {
|
|
102968
103295
|
}
|
|
102969
103296
|
}
|
|
@@ -103954,11 +104281,11 @@ init_esm_shims();
|
|
|
103954
104281
|
|
|
103955
104282
|
// ../../packages/runtime-host/dist/node-platform.js
|
|
103956
104283
|
init_esm_shims();
|
|
103957
|
-
import { chmodSync, mkdirSync as
|
|
104284
|
+
import { chmodSync, mkdirSync as mkdirSync6, readFileSync as readFileSync6, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "fs";
|
|
103958
104285
|
import { connect, createServer } from "net";
|
|
103959
|
-
import { dirname as
|
|
103960
|
-
function isWindowsPipe(
|
|
103961
|
-
return
|
|
104286
|
+
import { dirname as dirname5 } from "path";
|
|
104287
|
+
function isWindowsPipe(path20) {
|
|
104288
|
+
return path20.startsWith("\\\\.\\pipe\\");
|
|
103962
104289
|
}
|
|
103963
104290
|
function wrapSocket(socket) {
|
|
103964
104291
|
return {
|
|
@@ -104052,36 +104379,36 @@ function nodePlatform(overrides = {}) {
|
|
|
104052
104379
|
}
|
|
104053
104380
|
},
|
|
104054
104381
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
104055
|
-
async readFile(
|
|
104382
|
+
async readFile(path20) {
|
|
104056
104383
|
try {
|
|
104057
|
-
return
|
|
104384
|
+
return readFileSync6(path20, "utf8");
|
|
104058
104385
|
} catch {
|
|
104059
104386
|
return null;
|
|
104060
104387
|
}
|
|
104061
104388
|
},
|
|
104062
104389
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
104063
|
-
async writeFile(
|
|
104064
|
-
|
|
104065
|
-
|
|
104390
|
+
async writeFile(path20, content) {
|
|
104391
|
+
mkdirSync6(dirname5(path20), { recursive: true, mode: 448 });
|
|
104392
|
+
writeFileSync6(path20, content, { mode: 384 });
|
|
104066
104393
|
},
|
|
104067
104394
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
104068
|
-
async removeFile(
|
|
104069
|
-
rmSync2(
|
|
104395
|
+
async removeFile(path20) {
|
|
104396
|
+
rmSync2(path20, { force: true });
|
|
104070
104397
|
},
|
|
104071
104398
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
104072
|
-
async mkdirExclusive(
|
|
104073
|
-
|
|
104399
|
+
async mkdirExclusive(path20) {
|
|
104400
|
+
mkdirSync6(dirname5(path20), { recursive: true, mode: 448 });
|
|
104074
104401
|
try {
|
|
104075
|
-
|
|
104402
|
+
mkdirSync6(path20);
|
|
104076
104403
|
return "created";
|
|
104077
104404
|
} catch {
|
|
104078
104405
|
return "exists";
|
|
104079
104406
|
}
|
|
104080
104407
|
},
|
|
104081
104408
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
104082
|
-
async removeDir(
|
|
104409
|
+
async removeDir(path20) {
|
|
104083
104410
|
try {
|
|
104084
|
-
rmSync2(
|
|
104411
|
+
rmSync2(path20, { recursive: true, force: true });
|
|
104085
104412
|
} catch {
|
|
104086
104413
|
}
|
|
104087
104414
|
},
|
|
@@ -104103,19 +104430,19 @@ function nodePlatform(overrides = {}) {
|
|
|
104103
104430
|
init_esm_shims();
|
|
104104
104431
|
import { createHash } from "crypto";
|
|
104105
104432
|
import { homedir as homedir3 } from "os";
|
|
104106
|
-
import { join as
|
|
104433
|
+
import { join as join9 } from "path";
|
|
104107
104434
|
function defaultRuntimeHostPaths(home = homedir3(), platform = process.platform) {
|
|
104108
|
-
const dir =
|
|
104435
|
+
const dir = join9(home, ".motebit");
|
|
104109
104436
|
if (platform === "win32") {
|
|
104110
104437
|
const tag2 = createHash("sha256").update(dir).digest("hex").slice(0, 16);
|
|
104111
104438
|
return {
|
|
104112
104439
|
socketPath: `\\\\.\\pipe\\motebit-runtime-${tag2}`,
|
|
104113
|
-
lockfilePath:
|
|
104440
|
+
lockfilePath: join9(dir, "runtime.lock")
|
|
104114
104441
|
};
|
|
104115
104442
|
}
|
|
104116
104443
|
return {
|
|
104117
|
-
socketPath:
|
|
104118
|
-
lockfilePath:
|
|
104444
|
+
socketPath: join9(dir, "runtime.sock"),
|
|
104445
|
+
lockfilePath: join9(dir, "runtime.lock")
|
|
104119
104446
|
};
|
|
104120
104447
|
}
|
|
104121
104448
|
|
|
@@ -104242,27 +104569,37 @@ init_status_render();
|
|
|
104242
104569
|
async function renderStream(stream) {
|
|
104243
104570
|
let pendingApproval = null;
|
|
104244
104571
|
let status = null;
|
|
104572
|
+
let thinking = null;
|
|
104573
|
+
const stopThinking = () => {
|
|
104574
|
+
thinking?.stop();
|
|
104575
|
+
thinking = null;
|
|
104576
|
+
};
|
|
104245
104577
|
const stopStatus = () => {
|
|
104578
|
+
stopThinking();
|
|
104246
104579
|
const elapsed = status?.stop() ?? 0;
|
|
104247
104580
|
status = null;
|
|
104248
104581
|
return elapsed;
|
|
104249
104582
|
};
|
|
104583
|
+
thinking = startStatus("thinking");
|
|
104250
104584
|
try {
|
|
104251
104585
|
for await (const raw of stream) {
|
|
104252
104586
|
const chunk = raw;
|
|
104253
104587
|
switch (chunk.type) {
|
|
104254
104588
|
case "text":
|
|
104589
|
+
stopThinking();
|
|
104255
104590
|
if (typeof chunk.text === "string") writeOutput(chunk.text);
|
|
104256
104591
|
break;
|
|
104257
104592
|
case "tool_status": {
|
|
104258
104593
|
const name = chunk.name ?? "tool";
|
|
104259
104594
|
if (chunk.status === "calling") {
|
|
104260
104595
|
if (name === "delegate_to_agent" && status) break;
|
|
104596
|
+
stopThinking();
|
|
104261
104597
|
status = name === "delegate_to_agent" ? startStatus("delegating") : startStatus("running", name);
|
|
104262
104598
|
} else if (status) {
|
|
104263
104599
|
writeLine(
|
|
104264
104600
|
` ${action("\u25CF")} ${action(name)} ${meta(`\xB7 done \xB7 ${formatElapsed(0, stopStatus())}`)}`
|
|
104265
104601
|
);
|
|
104602
|
+
thinking = startStatus("thinking");
|
|
104266
104603
|
}
|
|
104267
104604
|
break;
|
|
104268
104605
|
}
|
|
@@ -104275,6 +104612,7 @@ async function renderStream(stream) {
|
|
|
104275
104612
|
break;
|
|
104276
104613
|
case "delegation_start":
|
|
104277
104614
|
if (status) break;
|
|
104615
|
+
stopThinking();
|
|
104278
104616
|
status = startStatus("delegating", chunk.tool ?? "task");
|
|
104279
104617
|
break;
|
|
104280
104618
|
case "delegation_complete":
|
|
@@ -104284,6 +104622,7 @@ async function renderStream(stream) {
|
|
|
104284
104622
|
dim(`[receipt ${chunk.receipt.task_id.slice(0, 8)} \xB7 ${chunk.receipt.status ?? ""}]`)
|
|
104285
104623
|
);
|
|
104286
104624
|
}
|
|
104625
|
+
thinking = startStatus("thinking");
|
|
104287
104626
|
break;
|
|
104288
104627
|
case "injection_warning":
|
|
104289
104628
|
writeLine(`${warn2("\u26A0")} suspicious content in ${chunk.tool_name ?? "tool"} output`);
|
|
@@ -104358,6 +104697,7 @@ async function runAttachedRepl(client, motebitId) {
|
|
|
104358
104697
|
|
|
104359
104698
|
`
|
|
104360
104699
|
);
|
|
104700
|
+
setModeRow(renderModeRow({ attachedPid: client.coordinatorPid }));
|
|
104361
104701
|
let closed = false;
|
|
104362
104702
|
client.onClose(() => {
|
|
104363
104703
|
closed = true;
|
|
@@ -104424,6 +104764,7 @@ init_colors();
|
|
|
104424
104764
|
// src/slash-commands.ts
|
|
104425
104765
|
init_esm_shims();
|
|
104426
104766
|
init_dist2();
|
|
104767
|
+
init_dist4();
|
|
104427
104768
|
init_dist8();
|
|
104428
104769
|
|
|
104429
104770
|
// src/subcommands/id.ts
|
|
@@ -104744,21 +105085,21 @@ var RelayClientError = class extends Error {
|
|
|
104744
105085
|
path;
|
|
104745
105086
|
/** Relay-provided error body text when available (non-2xx responses). */
|
|
104746
105087
|
body;
|
|
104747
|
-
constructor(kind,
|
|
105088
|
+
constructor(kind, path20, message2, options) {
|
|
104748
105089
|
super(message2, options?.cause !== void 0 ? { cause: options.cause } : void 0);
|
|
104749
105090
|
this.name = "RelayClientError";
|
|
104750
105091
|
this.kind = kind;
|
|
104751
|
-
this.path =
|
|
105092
|
+
this.path = path20;
|
|
104752
105093
|
this.status = options?.status;
|
|
104753
105094
|
this.body = options?.body;
|
|
104754
105095
|
}
|
|
104755
105096
|
};
|
|
104756
105097
|
|
|
104757
105098
|
// ../../packages/relay-client/dist/client.js
|
|
104758
|
-
function validate(schema, body,
|
|
105099
|
+
function validate(schema, body, path20, label) {
|
|
104759
105100
|
const parsed = schema.safeParse(body);
|
|
104760
105101
|
if (!parsed.success) {
|
|
104761
|
-
throw new RelayClientError("schema",
|
|
105102
|
+
throw new RelayClientError("schema", path20, `${label} response failed wire-schema validation: ${parsed.error.message}`);
|
|
104762
105103
|
}
|
|
104763
105104
|
return parsed.data;
|
|
104764
105105
|
}
|
|
@@ -104797,11 +105138,11 @@ var RelayClient = class {
|
|
|
104797
105138
|
* never sends credentials, regardless of configured auth.
|
|
104798
105139
|
*/
|
|
104799
105140
|
async discover(motebitId) {
|
|
104800
|
-
const
|
|
104801
|
-
const body = await this.requestJson("GET",
|
|
105141
|
+
const path20 = `/api/v1/discover/${encodeURIComponent(motebitId)}`;
|
|
105142
|
+
const body = await this.requestJson("GET", path20, {
|
|
104802
105143
|
retry: true
|
|
104803
105144
|
});
|
|
104804
|
-
return validate(AgentResolutionResultSchema, body,
|
|
105145
|
+
return validate(AgentResolutionResultSchema, body, path20, "discover");
|
|
104805
105146
|
}
|
|
104806
105147
|
/**
|
|
104807
105148
|
* `GET /api/v1/agents/:motebitId/balance`. Contract tier: VALIDATED
|
|
@@ -104810,12 +105151,12 @@ var RelayClient = class {
|
|
|
104810
105151
|
* converts from micro-units at its boundary; never convert again.
|
|
104811
105152
|
*/
|
|
104812
105153
|
async getBalance(motebitId) {
|
|
104813
|
-
const
|
|
104814
|
-
const body = await this.requestJson("GET",
|
|
105154
|
+
const path20 = `/api/v1/agents/${encodeURIComponent(motebitId)}/balance`;
|
|
105155
|
+
const body = await this.requestJson("GET", path20, {
|
|
104815
105156
|
audience: ACCOUNT_BALANCE_AUDIENCE,
|
|
104816
105157
|
retry: true
|
|
104817
105158
|
});
|
|
104818
|
-
return validate(AccountBalanceResultSchema, body,
|
|
105159
|
+
return validate(AccountBalanceResultSchema, body, path20, "balance");
|
|
104819
105160
|
}
|
|
104820
105161
|
/**
|
|
104821
105162
|
* `POST /agent/:targetMotebitId/task` — submit a delegation task.
|
|
@@ -104824,8 +105165,8 @@ var RelayClient = class {
|
|
|
104824
105165
|
* caller supplies it so a retry by the CALLER replays, never double-spends.
|
|
104825
105166
|
*/
|
|
104826
105167
|
async submitTask(targetMotebitId, request, options) {
|
|
104827
|
-
const
|
|
104828
|
-
const body = await this.requestJson("POST",
|
|
105168
|
+
const path20 = `/agent/${encodeURIComponent(targetMotebitId)}/task`;
|
|
105169
|
+
const body = await this.requestJson("POST", path20, {
|
|
104829
105170
|
audience: TASK_SUBMIT_AUDIENCE,
|
|
104830
105171
|
retry: false,
|
|
104831
105172
|
jsonBody: request,
|
|
@@ -104839,8 +105180,8 @@ var RelayClient = class {
|
|
|
104839
105180
|
* token; the relay authorizes submitter-or-target).
|
|
104840
105181
|
*/
|
|
104841
105182
|
async getTask(targetMotebitId, taskId) {
|
|
104842
|
-
const
|
|
104843
|
-
const body = await this.requestJson("GET",
|
|
105183
|
+
const path20 = `/agent/${encodeURIComponent(targetMotebitId)}/task/${encodeURIComponent(taskId)}`;
|
|
105184
|
+
const body = await this.requestJson("GET", path20, {
|
|
104844
105185
|
audience: TASK_QUERY_AUDIENCE,
|
|
104845
105186
|
retry: true
|
|
104846
105187
|
});
|
|
@@ -104858,24 +105199,24 @@ var RelayClient = class {
|
|
|
104858
105199
|
* `kind: "http"`, `status: 402`.
|
|
104859
105200
|
*/
|
|
104860
105201
|
async withdraw(motebitId, request, options) {
|
|
104861
|
-
const
|
|
104862
|
-
const body = await this.requestJson("POST",
|
|
105202
|
+
const path20 = `/api/v1/agents/${encodeURIComponent(motebitId)}/withdraw`;
|
|
105203
|
+
const body = await this.requestJson("POST", path20, {
|
|
104863
105204
|
audience: ACCOUNT_WITHDRAW_AUDIENCE,
|
|
104864
105205
|
retry: false,
|
|
104865
105206
|
jsonBody: request,
|
|
104866
105207
|
headers: { "Idempotency-Key": options.idempotencyKey }
|
|
104867
105208
|
});
|
|
104868
|
-
return validate(AccountWithdrawResultSchema, body,
|
|
105209
|
+
return validate(AccountWithdrawResultSchema, body, path20, "withdraw");
|
|
104869
105210
|
}
|
|
104870
105211
|
// ── Transport kernel ─────────────────────────────────────────────────
|
|
104871
|
-
async requestJson(method,
|
|
105212
|
+
async requestJson(method, path20, opts) {
|
|
104872
105213
|
const headers = { ...opts.headers };
|
|
104873
105214
|
if (opts.jsonBody !== void 0)
|
|
104874
105215
|
headers["Content-Type"] = "application/json";
|
|
104875
105216
|
if (opts.audience !== void 0) {
|
|
104876
105217
|
const token = await this.resolveToken(opts.audience);
|
|
104877
105218
|
if (token == null) {
|
|
104878
|
-
throw new RelayClientError("auth",
|
|
105219
|
+
throw new RelayClientError("auth", path20, `no credential available for ${path20} (audience ${opts.audience}) \u2014 provide credentialSource, deviceKey, or staticToken`);
|
|
104879
105220
|
}
|
|
104880
105221
|
headers["Authorization"] = `Bearer ${token}`;
|
|
104881
105222
|
}
|
|
@@ -104884,7 +105225,7 @@ var RelayClient = class {
|
|
|
104884
105225
|
headers,
|
|
104885
105226
|
...opts.jsonBody !== void 0 ? { body: JSON.stringify(opts.jsonBody) } : {}
|
|
104886
105227
|
};
|
|
104887
|
-
const res = await this.fetchWithRetry(
|
|
105228
|
+
const res = await this.fetchWithRetry(path20, init, opts.retry);
|
|
104888
105229
|
if (!res.ok) {
|
|
104889
105230
|
let bodyText;
|
|
104890
105231
|
try {
|
|
@@ -104892,7 +105233,7 @@ var RelayClient = class {
|
|
|
104892
105233
|
} catch {
|
|
104893
105234
|
bodyText = void 0;
|
|
104894
105235
|
}
|
|
104895
|
-
throw new RelayClientError("http",
|
|
105236
|
+
throw new RelayClientError("http", path20, `${method} ${path20} \u2192 ${res.status}`, {
|
|
104896
105237
|
status: res.status,
|
|
104897
105238
|
body: bodyText
|
|
104898
105239
|
});
|
|
@@ -104900,13 +105241,13 @@ var RelayClient = class {
|
|
|
104900
105241
|
try {
|
|
104901
105242
|
return await res.json();
|
|
104902
105243
|
} catch (err2) {
|
|
104903
|
-
throw new RelayClientError("parse",
|
|
105244
|
+
throw new RelayClientError("parse", path20, `${method} ${path20} returned non-JSON body`, {
|
|
104904
105245
|
cause: err2
|
|
104905
105246
|
});
|
|
104906
105247
|
}
|
|
104907
105248
|
}
|
|
104908
|
-
async fetchWithRetry(
|
|
104909
|
-
const url = `${this.baseUrl}${
|
|
105249
|
+
async fetchWithRetry(path20, init, retry) {
|
|
105250
|
+
const url = `${this.baseUrl}${path20}`;
|
|
104910
105251
|
const attempts = retry ? this.maxRetries + 1 : 1;
|
|
104911
105252
|
let lastNetworkError;
|
|
104912
105253
|
for (let attempt = 0; attempt < attempts; attempt++) {
|
|
@@ -104923,7 +105264,7 @@ var RelayClient = class {
|
|
|
104923
105264
|
}
|
|
104924
105265
|
await this.backoff(attempt);
|
|
104925
105266
|
}
|
|
104926
|
-
throw new RelayClientError("network",
|
|
105267
|
+
throw new RelayClientError("network", path20, `request to ${path20} failed after ${attempts} attempt(s)`, {
|
|
104927
105268
|
cause: lastNetworkError
|
|
104928
105269
|
});
|
|
104929
105270
|
}
|
|
@@ -105208,7 +105549,7 @@ init_dist6();
|
|
|
105208
105549
|
|
|
105209
105550
|
// ../../packages/mcp-server/dist/bootstrap-service.js
|
|
105210
105551
|
init_esm_shims();
|
|
105211
|
-
import { writeFileSync as
|
|
105552
|
+
import { writeFileSync as writeFileSync8 } from "fs";
|
|
105212
105553
|
import { resolve as resolve6 } from "path";
|
|
105213
105554
|
|
|
105214
105555
|
// ../../packages/core-identity/dist/node.js
|
|
@@ -105216,12 +105557,12 @@ init_esm_shims();
|
|
|
105216
105557
|
|
|
105217
105558
|
// ../../packages/core-identity/dist/file-stores.js
|
|
105218
105559
|
init_esm_shims();
|
|
105219
|
-
import { existsSync as existsSync2, readFileSync as
|
|
105560
|
+
import { existsSync as existsSync2, readFileSync as readFileSync7, writeFileSync as writeFileSync7, renameSync as renameSync2, chmodSync as chmodSync2 } from "fs";
|
|
105220
105561
|
|
|
105221
105562
|
// ../../packages/core-identity/dist/bootstrap-service.js
|
|
105222
105563
|
init_esm_shims();
|
|
105223
|
-
import { mkdirSync as
|
|
105224
|
-
import { join as
|
|
105564
|
+
import { mkdirSync as mkdirSync7, existsSync as existsSync3 } from "fs";
|
|
105565
|
+
import { join as join10 } from "path";
|
|
105225
105566
|
init_dist17();
|
|
105226
105567
|
init_dist16();
|
|
105227
105568
|
|
|
@@ -106011,7 +106352,7 @@ var McpServerAdapter = class _McpServerAdapter {
|
|
|
106011
106352
|
init_config2();
|
|
106012
106353
|
init_dist32();
|
|
106013
106354
|
init_node_fs();
|
|
106014
|
-
import { join as
|
|
106355
|
+
import { join as join11 } from "path";
|
|
106015
106356
|
|
|
106016
106357
|
// src/utils.ts
|
|
106017
106358
|
init_esm_shims();
|
|
@@ -106089,7 +106430,9 @@ async function handleReceiptCommand(args, deps) {
|
|
|
106089
106430
|
out(warn2(`No archived receipt for task_id=${taskId}`));
|
|
106090
106431
|
return;
|
|
106091
106432
|
}
|
|
106433
|
+
out("");
|
|
106092
106434
|
await renderReceipt(receipt, out);
|
|
106435
|
+
out("");
|
|
106093
106436
|
}
|
|
106094
106437
|
async function drainInvokeStream(stream, out, voice) {
|
|
106095
106438
|
let textBuf = "";
|
|
@@ -106105,7 +106448,9 @@ async function drainInvokeStream(stream, out, voice) {
|
|
|
106105
106448
|
if (textBuf.trim()) out(textBuf.trim());
|
|
106106
106449
|
if (chunk.full_receipt) {
|
|
106107
106450
|
archiveReceipt(chunk.full_receipt);
|
|
106451
|
+
out("");
|
|
106108
106452
|
await renderReceipt(chunk.full_receipt, out);
|
|
106453
|
+
out("");
|
|
106109
106454
|
if (voice && chunk.full_receipt.status === "completed") {
|
|
106110
106455
|
const spoken = chunk.full_receipt.result ?? "Task complete.";
|
|
106111
106456
|
void voice.speakIfEnabled(spoken);
|
|
@@ -106208,8 +106553,8 @@ function parseSub(args) {
|
|
|
106208
106553
|
const m4 = args.match(/^(\S+)\s*([\s\S]*)$/);
|
|
106209
106554
|
return m4 ? { sub: m4[1], rest: (m4[2] ?? "").trim() } : { sub: "", rest: "" };
|
|
106210
106555
|
}
|
|
106211
|
-
async function relayFetch2(baseUrl,
|
|
106212
|
-
const url = `${baseUrl.replace(/\/+$/, "")}${
|
|
106556
|
+
async function relayFetch2(baseUrl, path20, opts) {
|
|
106557
|
+
const url = `${baseUrl.replace(/\/+$/, "")}${path20}`;
|
|
106213
106558
|
const init = { headers: opts?.headers };
|
|
106214
106559
|
if (opts?.method) init.method = opts.method;
|
|
106215
106560
|
if (opts?.body != null) init.body = JSON.stringify(opts.body);
|
|
@@ -106484,14 +106829,52 @@ ${summary}`);
|
|
|
106484
106829
|
"llama3.2": "llama3.2",
|
|
106485
106830
|
mistral: "mistral"
|
|
106486
106831
|
};
|
|
106832
|
+
const envKey = config.provider === "openai" ? process.env["OPENAI_API_KEY"] : process.env["ANTHROPIC_API_KEY"];
|
|
106833
|
+
const catalog = await discoverModels({
|
|
106834
|
+
provider: config.provider,
|
|
106835
|
+
...envKey != null && envKey !== "" ? { apiKey: envKey } : {},
|
|
106836
|
+
...config.provider === "local-server" ? { baseUrl: "http://127.0.0.1:11434" } : {}
|
|
106837
|
+
});
|
|
106838
|
+
const liveIds = catalog.source === "live" ? new Set(catalog.models.map((m4) => m4.id)) : null;
|
|
106839
|
+
const providerLabel = (modelId2) => {
|
|
106840
|
+
const hint = modelVendorHint(modelId2);
|
|
106841
|
+
return hint === "local" ? "local-server" : hint;
|
|
106842
|
+
};
|
|
106487
106843
|
const showModelList = (current2) => {
|
|
106844
|
+
if (catalog.source === "live") {
|
|
106845
|
+
const col2 = Math.max(...catalog.models.map((m4) => m4.id.length)) + 2;
|
|
106846
|
+
for (const m4 of catalog.models) {
|
|
106847
|
+
const active = m4.id === current2;
|
|
106848
|
+
const marker = active ? green(" \u25CF") : " ";
|
|
106849
|
+
const gap = " ".repeat(Math.max(1, col2 - m4.id.length));
|
|
106850
|
+
console.log(`${marker} ${cyan(m4.id)}${gap}${dim(m4.displayName ?? "")}`);
|
|
106851
|
+
}
|
|
106852
|
+
console.log(dim(`
|
|
106853
|
+
live from ${config.provider}`));
|
|
106854
|
+
return;
|
|
106855
|
+
}
|
|
106488
106856
|
const col = Math.max(...Object.keys(MODEL_ALIASES).map((k4) => k4.length)) + 2;
|
|
106489
106857
|
for (const [alias, modelId2] of Object.entries(MODEL_ALIASES)) {
|
|
106490
106858
|
const active = modelId2 === current2 || alias === current2;
|
|
106859
|
+
const servable = admitModelForProvider(config.provider, modelId2).admissible;
|
|
106491
106860
|
const marker = active ? green(" \u25CF") : " ";
|
|
106492
106861
|
const gap = " ".repeat(Math.max(1, col - alias.length));
|
|
106493
|
-
|
|
106862
|
+
if (servable) {
|
|
106863
|
+
console.log(
|
|
106864
|
+
`${marker} ${cyan(alias)}${gap}${dim(modelId2 + " \xB7 " + providerLabel(modelId2))}`
|
|
106865
|
+
);
|
|
106866
|
+
} else {
|
|
106867
|
+
console.log(
|
|
106868
|
+
dim(
|
|
106869
|
+
`${marker} ${alias}${gap}${modelId2} \xB7 needs --provider ${providerLabel(modelId2)}`
|
|
106870
|
+
)
|
|
106871
|
+
);
|
|
106872
|
+
}
|
|
106494
106873
|
}
|
|
106874
|
+
console.log(
|
|
106875
|
+
dim(`
|
|
106876
|
+
offline list \u2014 live catalog unavailable (${catalog.fallbackReason ?? "?"})`)
|
|
106877
|
+
);
|
|
106495
106878
|
};
|
|
106496
106879
|
if (!args) {
|
|
106497
106880
|
const current2 = runtime.currentModel ?? "unknown";
|
|
@@ -106506,7 +106889,7 @@ Current model: ${cyan(current2)}
|
|
|
106506
106889
|
}
|
|
106507
106890
|
const input = args.toLowerCase();
|
|
106508
106891
|
const resolved = MODEL_ALIASES[input];
|
|
106509
|
-
const isFullId = Object.values(MODEL_ALIASES).includes(args);
|
|
106892
|
+
const isFullId = Object.values(MODEL_ALIASES).includes(args) || (liveIds?.has(args) ?? false);
|
|
106510
106893
|
if (!resolved && !isFullId) {
|
|
106511
106894
|
console.log(`
|
|
106512
106895
|
Unknown model: ${cyan(args)}
|
|
@@ -106518,9 +106901,28 @@ Unknown model: ${cyan(args)}
|
|
|
106518
106901
|
break;
|
|
106519
106902
|
}
|
|
106520
106903
|
const modelId = resolved ?? args;
|
|
106904
|
+
if (liveIds != null && !liveIds.has(modelId)) {
|
|
106905
|
+
console.log(
|
|
106906
|
+
`
|
|
106907
|
+
${warn2(`${modelId} is not served by ${config.provider} right now \u2014 /model lists what is`)}
|
|
106908
|
+
`
|
|
106909
|
+
);
|
|
106910
|
+
break;
|
|
106911
|
+
}
|
|
106912
|
+
const admission = admitModelForProvider(config.provider, modelId);
|
|
106913
|
+
if (!admission.admissible) {
|
|
106914
|
+
console.log(`
|
|
106915
|
+
${warn2(admission.teach ?? "model not servable on this provider")}
|
|
106916
|
+
`);
|
|
106917
|
+
break;
|
|
106918
|
+
}
|
|
106521
106919
|
runtime.setModel(modelId);
|
|
106522
106920
|
if (fullConfig) {
|
|
106523
106921
|
fullConfig.default_model = modelId;
|
|
106922
|
+
const persistable = ["anthropic", "openai", "google", "local-server", "proxy"];
|
|
106923
|
+
if (persistable.includes(config.provider)) {
|
|
106924
|
+
fullConfig.default_provider = config.provider;
|
|
106925
|
+
}
|
|
106524
106926
|
saveFullConfig(fullConfig);
|
|
106525
106927
|
}
|
|
106526
106928
|
console.log();
|
|
@@ -106733,9 +107135,9 @@ Unknown model: ${cyan(args)}
|
|
|
106733
107135
|
let guardianAttest;
|
|
106734
107136
|
try {
|
|
106735
107137
|
const { parse: parse3 } = await Promise.resolve().then(() => (init_dist34(), dist_exports10));
|
|
106736
|
-
const
|
|
107138
|
+
const fs20 = await import("fs");
|
|
106737
107139
|
const idPath = config.identity ?? "motebit.md";
|
|
106738
|
-
const content =
|
|
107140
|
+
const content = fs20.readFileSync(idPath, "utf-8");
|
|
106739
107141
|
const guardian = parse3(content).frontmatter.guardian;
|
|
106740
107142
|
guardianPubKey = guardian?.public_key;
|
|
106741
107143
|
guardianAttest = guardian?.attestation;
|
|
@@ -108082,7 +108484,7 @@ Curiosity targets (${targets.length}):
|
|
|
108082
108484
|
}
|
|
108083
108485
|
case "skills": {
|
|
108084
108486
|
const registry = new SkillRegistry(
|
|
108085
|
-
new NodeFsSkillStorageAdapter({ root:
|
|
108487
|
+
new NodeFsSkillStorageAdapter({ root: join11(CONFIG_DIR, "skills") })
|
|
108086
108488
|
);
|
|
108087
108489
|
const records = await registry.list();
|
|
108088
108490
|
if (records.length === 0) {
|
|
@@ -108113,7 +108515,7 @@ Curiosity targets (${targets.length}):
|
|
|
108113
108515
|
break;
|
|
108114
108516
|
}
|
|
108115
108517
|
const registry = new SkillRegistry(
|
|
108116
|
-
new NodeFsSkillStorageAdapter({ root:
|
|
108518
|
+
new NodeFsSkillStorageAdapter({ root: join11(CONFIG_DIR, "skills") })
|
|
108117
108519
|
);
|
|
108118
108520
|
const record = await registry.get(name);
|
|
108119
108521
|
if (!record) {
|
|
@@ -108323,8 +108725,8 @@ init_dist11();
|
|
|
108323
108725
|
init_config2();
|
|
108324
108726
|
init_identity();
|
|
108325
108727
|
init_runtime_factory();
|
|
108326
|
-
import * as
|
|
108327
|
-
import * as
|
|
108728
|
+
import * as fs8 from "fs";
|
|
108729
|
+
import * as path10 from "path";
|
|
108328
108730
|
import * as readline2 from "readline";
|
|
108329
108731
|
async function buildAttestationCredential(input) {
|
|
108330
108732
|
return composeHardwareAttestationCredential({
|
|
@@ -108407,8 +108809,8 @@ async function handleAttest(config) {
|
|
|
108407
108809
|
rl.close();
|
|
108408
108810
|
const json = JSON.stringify(signed, null, 2);
|
|
108409
108811
|
if (config.output != null && config.output !== "") {
|
|
108410
|
-
const outPath =
|
|
108411
|
-
|
|
108812
|
+
const outPath = path10.resolve(config.output);
|
|
108813
|
+
fs8.writeFileSync(outPath, `${json}
|
|
108412
108814
|
`, "utf-8");
|
|
108413
108815
|
process.stderr.write(
|
|
108414
108816
|
`Wrote attestation credential for ${motebitId.slice(0, 8)}\u2026 to ${outPath}
|
|
@@ -109062,8 +109464,8 @@ Agent ${data.motebit_id}: found`);
|
|
|
109062
109464
|
init_esm_shims();
|
|
109063
109465
|
init_dist11();
|
|
109064
109466
|
init_config2();
|
|
109065
|
-
import * as
|
|
109066
|
-
import * as
|
|
109467
|
+
import * as fs9 from "fs";
|
|
109468
|
+
import * as path11 from "path";
|
|
109067
109469
|
|
|
109068
109470
|
// src/subcommands/seed.ts
|
|
109069
109471
|
init_esm_shims();
|
|
@@ -109168,26 +109570,26 @@ async function handleDoctor() {
|
|
|
109168
109570
|
detail: major >= 20 ? `v${nodeVer}` : `v${nodeVer} (requires >=20)`
|
|
109169
109571
|
});
|
|
109170
109572
|
try {
|
|
109171
|
-
|
|
109172
|
-
const testFile =
|
|
109173
|
-
|
|
109174
|
-
|
|
109573
|
+
fs9.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
109574
|
+
const testFile = path11.join(CONFIG_DIR, ".doctor-test");
|
|
109575
|
+
fs9.writeFileSync(testFile, "ok", "utf-8");
|
|
109576
|
+
fs9.unlinkSync(testFile);
|
|
109175
109577
|
checks.push({ name: "Config dir", ok: true, detail: CONFIG_DIR });
|
|
109176
109578
|
} catch {
|
|
109177
109579
|
checks.push({ name: "Config dir", ok: false, detail: `Cannot write to ${CONFIG_DIR}` });
|
|
109178
109580
|
}
|
|
109179
109581
|
try {
|
|
109180
|
-
const tmpDbPath =
|
|
109582
|
+
const tmpDbPath = path11.join(CONFIG_DIR, ".doctor-test.db");
|
|
109181
109583
|
const db = await openMotebitDatabase(tmpDbPath);
|
|
109182
109584
|
const driverName = db.db.driverName;
|
|
109183
109585
|
db.close();
|
|
109184
|
-
|
|
109586
|
+
fs9.unlinkSync(tmpDbPath);
|
|
109185
109587
|
try {
|
|
109186
|
-
|
|
109588
|
+
fs9.unlinkSync(tmpDbPath + "-wal");
|
|
109187
109589
|
} catch {
|
|
109188
109590
|
}
|
|
109189
109591
|
try {
|
|
109190
|
-
|
|
109592
|
+
fs9.unlinkSync(tmpDbPath + "-shm");
|
|
109191
109593
|
} catch {
|
|
109192
109594
|
}
|
|
109193
109595
|
checks.push({ name: "SQLite", ok: true, detail: `${driverName} loaded and functional` });
|
|
@@ -109216,10 +109618,10 @@ async function handleDoctor() {
|
|
|
109216
109618
|
checks.push({ name: "Identity", ok: true, detail: "not created yet (run motebit to create)" });
|
|
109217
109619
|
}
|
|
109218
109620
|
{
|
|
109219
|
-
const mdPath =
|
|
109220
|
-
if (
|
|
109621
|
+
const mdPath = path11.join(CONFIG_DIR, "motebit.md");
|
|
109622
|
+
if (fs9.existsSync(mdPath) && fullCfg.device_public_key) {
|
|
109221
109623
|
try {
|
|
109222
|
-
const md =
|
|
109624
|
+
const md = fs9.readFileSync(mdPath, "utf-8");
|
|
109223
109625
|
const keyMatch = /public_key:\s*"?([0-9a-fA-F]{64})"?/.exec(md);
|
|
109224
109626
|
const fileKey = keyMatch?.[1]?.toLowerCase();
|
|
109225
109627
|
const stale = fileKey != null && fileKey !== fullCfg.device_public_key.toLowerCase();
|
|
@@ -109265,7 +109667,7 @@ async function handleDoctor() {
|
|
|
109265
109667
|
detail: "cli_private_key (plaintext, deprecated \u2014 re-encrypt at next run)"
|
|
109266
109668
|
});
|
|
109267
109669
|
} else {
|
|
109268
|
-
const clobberedBackups =
|
|
109670
|
+
const clobberedBackups = fs9.readdirSync(CONFIG_DIR).filter((f7) => f7.startsWith("config.json.clobbered-"));
|
|
109269
109671
|
const restoreHint = clobberedBackups.length > 0 ? `restore from ~/.motebit/${clobberedBackups[0]} (a clobbered backup is present)` : "run `motebit init` to create or import an identity key";
|
|
109270
109672
|
checks.push({
|
|
109271
109673
|
name: "Identity key",
|
|
@@ -109549,8 +109951,8 @@ init_config2();
|
|
|
109549
109951
|
init_identity();
|
|
109550
109952
|
init_runtime_factory();
|
|
109551
109953
|
import * as readline4 from "readline";
|
|
109552
|
-
import * as
|
|
109553
|
-
import * as
|
|
109954
|
+
import * as fs10 from "fs";
|
|
109955
|
+
import * as path12 from "path";
|
|
109554
109956
|
async function handleExport(config) {
|
|
109555
109957
|
const fullConfig = loadFullConfig();
|
|
109556
109958
|
const rl = readline4.createInterface({
|
|
@@ -109624,22 +110026,22 @@ async function handleExport(config) {
|
|
|
109624
110026
|
},
|
|
109625
110027
|
privateKey
|
|
109626
110028
|
);
|
|
109627
|
-
const outputDir = config.output != null && config.output !== "" ?
|
|
109628
|
-
|
|
110029
|
+
const outputDir = config.output != null && config.output !== "" ? path12.resolve(config.output) : path12.resolve("motebit-export");
|
|
110030
|
+
fs10.mkdirSync(outputDir, { recursive: true });
|
|
109629
110031
|
const exported = [];
|
|
109630
110032
|
const skipped = [];
|
|
109631
|
-
const identityPath =
|
|
109632
|
-
|
|
110033
|
+
const identityPath = path12.join(outputDir, "motebit.md");
|
|
110034
|
+
fs10.writeFileSync(identityPath, identityContent, "utf-8");
|
|
109633
110035
|
exported.push("identity");
|
|
109634
110036
|
try {
|
|
109635
|
-
|
|
110037
|
+
fs10.writeFileSync(path12.join(CONFIG_DIR, "motebit.md"), identityContent, "utf-8");
|
|
109636
110038
|
} catch {
|
|
109637
110039
|
}
|
|
109638
110040
|
try {
|
|
109639
110041
|
const latestGradient = moteDb.gradientStore.latest(motebitId);
|
|
109640
110042
|
if (latestGradient) {
|
|
109641
|
-
const gradientPath =
|
|
109642
|
-
|
|
110043
|
+
const gradientPath = path12.join(outputDir, "gradient.json");
|
|
110044
|
+
fs10.writeFileSync(gradientPath, JSON.stringify(latestGradient, null, 2), "utf-8");
|
|
109643
110045
|
exported.push("gradient snapshot");
|
|
109644
110046
|
} else {
|
|
109645
110047
|
skipped.push("gradient (no snapshots recorded)");
|
|
@@ -109666,8 +110068,8 @@ async function handleExport(config) {
|
|
|
109666
110068
|
if (credResult.ok) {
|
|
109667
110069
|
const credBody = credResult.data;
|
|
109668
110070
|
const creds = credBody.credentials ?? [];
|
|
109669
|
-
const credPath =
|
|
109670
|
-
|
|
110071
|
+
const credPath = path12.join(outputDir, "credentials.json");
|
|
110072
|
+
fs10.writeFileSync(credPath, JSON.stringify(creds, null, 2), "utf-8");
|
|
109671
110073
|
exported.push(`${creds.length} credential${creds.length !== 1 ? "s" : ""}`);
|
|
109672
110074
|
} else {
|
|
109673
110075
|
skipped.push(`credentials (${credResult.error})`);
|
|
@@ -109679,8 +110081,8 @@ async function handleExport(config) {
|
|
|
109679
110081
|
);
|
|
109680
110082
|
if (vpResult.ok) {
|
|
109681
110083
|
const vpBody = vpResult.data;
|
|
109682
|
-
const vpPath =
|
|
109683
|
-
|
|
110084
|
+
const vpPath = path12.join(outputDir, "presentation.json");
|
|
110085
|
+
fs10.writeFileSync(vpPath, JSON.stringify(vpBody.presentation ?? vpBody, null, 2), "utf-8");
|
|
109684
110086
|
const credCount = vpBody.credential_count ?? 0;
|
|
109685
110087
|
exported.push(`presentation (${credCount} credential${credCount !== 1 ? "s" : ""})`);
|
|
109686
110088
|
} else {
|
|
@@ -109688,16 +110090,16 @@ async function handleExport(config) {
|
|
|
109688
110090
|
}
|
|
109689
110091
|
try {
|
|
109690
110092
|
const ossaManifest = generateOssaManifest(motebitId, publicKeyHex);
|
|
109691
|
-
const ossaPath =
|
|
109692
|
-
|
|
110093
|
+
const ossaPath = path12.join(outputDir, "ossa-manifest.yaml");
|
|
110094
|
+
fs10.writeFileSync(ossaPath, ossaManifest, "utf-8");
|
|
109693
110095
|
exported.push("OSSA manifest");
|
|
109694
110096
|
} catch {
|
|
109695
110097
|
skipped.push("OSSA manifest (generation failed)");
|
|
109696
110098
|
}
|
|
109697
110099
|
const budgetResult = await fetchRelayJson(`${baseUrl}/agent/${motebitId}/budget`, headers);
|
|
109698
110100
|
if (budgetResult.ok) {
|
|
109699
|
-
const budgetPath =
|
|
109700
|
-
|
|
110101
|
+
const budgetPath = path12.join(outputDir, "budget.json");
|
|
110102
|
+
fs10.writeFileSync(budgetPath, JSON.stringify(budgetResult.data, null, 2), "utf-8");
|
|
109701
110103
|
const budgetData = budgetResult.data;
|
|
109702
110104
|
const allocCount = budgetData.allocations?.length ?? 0;
|
|
109703
110105
|
exported.push(`budget (${allocCount} allocation${allocCount !== 1 ? "s" : ""})`);
|
|
@@ -110161,8 +110563,8 @@ async function handleGoalSetEnabled(config, enabled2) {
|
|
|
110161
110563
|
|
|
110162
110564
|
// src/subcommands/init.ts
|
|
110163
110565
|
init_esm_shims();
|
|
110164
|
-
import * as
|
|
110165
|
-
import * as
|
|
110566
|
+
import * as fs11 from "fs";
|
|
110567
|
+
import * as path13 from "path";
|
|
110166
110568
|
var DEFAULT_PATH = "motebit.yaml";
|
|
110167
110569
|
var SCAFFOLD = `# motebit.yaml \u2014 declarative config for a motebit.
|
|
110168
110570
|
#
|
|
@@ -110214,14 +110616,14 @@ routines: []
|
|
|
110214
110616
|
`;
|
|
110215
110617
|
function handleInit(config) {
|
|
110216
110618
|
const targetRelative = config.file ?? DEFAULT_PATH;
|
|
110217
|
-
const target =
|
|
110218
|
-
if (
|
|
110619
|
+
const target = path13.isAbsolute(targetRelative) ? targetRelative : path13.join(process.cwd(), targetRelative);
|
|
110620
|
+
if (fs11.existsSync(target) && !config.force) {
|
|
110219
110621
|
console.error(
|
|
110220
110622
|
`Error: ${target} already exists. Edit it directly, or pass --force to overwrite.`
|
|
110221
110623
|
);
|
|
110222
110624
|
process.exit(1);
|
|
110223
110625
|
}
|
|
110224
|
-
|
|
110626
|
+
fs11.writeFileSync(target, SCAFFOLD, "utf-8");
|
|
110225
110627
|
console.log(`Wrote ${target}`);
|
|
110226
110628
|
console.log("Next: edit the file to declare routines, then run `motebit up`.");
|
|
110227
110629
|
}
|
|
@@ -110443,9 +110845,9 @@ function formatDiagnostic(d6) {
|
|
|
110443
110845
|
const pathStr = d6.path.length === 0 ? "" : `${formatPath(d6.path)}: `;
|
|
110444
110846
|
return `${loc}: ${pathStr}${d6.message}`;
|
|
110445
110847
|
}
|
|
110446
|
-
function formatPath(
|
|
110848
|
+
function formatPath(path20) {
|
|
110447
110849
|
const parts = [];
|
|
110448
|
-
for (const seg of
|
|
110850
|
+
for (const seg of path20) {
|
|
110449
110851
|
if (typeof seg === "number") {
|
|
110450
110852
|
parts.push(`[${seg}]`);
|
|
110451
110853
|
} else if (parts.length === 0) {
|
|
@@ -110561,7 +110963,7 @@ import { isMap, isSeq, isScalar } from "yaml";
|
|
|
110561
110963
|
function findPathAtOffset(doc, offset) {
|
|
110562
110964
|
return walk(doc.contents, offset, []);
|
|
110563
110965
|
}
|
|
110564
|
-
function walk(node, offset,
|
|
110966
|
+
function walk(node, offset, path20) {
|
|
110565
110967
|
if (node == null) return null;
|
|
110566
110968
|
if (isMap(node)) {
|
|
110567
110969
|
for (const pair of node.items) {
|
|
@@ -110570,30 +110972,30 @@ function walk(node, offset, path19) {
|
|
|
110570
110972
|
const keyName = key != null && isScalar(key) ? String(key.value) : null;
|
|
110571
110973
|
const keyRange = key?.range;
|
|
110572
110974
|
if (keyRange && offset >= keyRange[0] && offset <= keyRange[1]) {
|
|
110573
|
-
return { path: keyName != null ? [...
|
|
110975
|
+
return { path: keyName != null ? [...path20, keyName] : path20, onKey: true };
|
|
110574
110976
|
}
|
|
110575
110977
|
const valueRange = value?.range;
|
|
110576
110978
|
if (value && keyName != null && valueRange) {
|
|
110577
110979
|
if (offset >= valueRange[0] && offset <= valueRange[2]) {
|
|
110578
|
-
const inner = walk(value, offset, [...
|
|
110980
|
+
const inner = walk(value, offset, [...path20, keyName]);
|
|
110579
110981
|
if (inner) return inner;
|
|
110580
|
-
return { path: [...
|
|
110982
|
+
return { path: [...path20, keyName], onKey: false };
|
|
110581
110983
|
}
|
|
110582
110984
|
}
|
|
110583
110985
|
}
|
|
110584
|
-
return
|
|
110986
|
+
return path20.length > 0 ? { path: path20, onKey: false } : null;
|
|
110585
110987
|
}
|
|
110586
110988
|
if (isSeq(node)) {
|
|
110587
110989
|
for (let i = 0; i < node.items.length; i++) {
|
|
110588
110990
|
const item = node.items[i];
|
|
110589
110991
|
const range = item?.range;
|
|
110590
110992
|
if (range && offset >= range[0] && offset <= range[2]) {
|
|
110591
|
-
const inner = walk(item, offset, [...
|
|
110993
|
+
const inner = walk(item, offset, [...path20, i]);
|
|
110592
110994
|
if (inner) return inner;
|
|
110593
|
-
return { path: [...
|
|
110995
|
+
return { path: [...path20, i], onKey: false };
|
|
110594
110996
|
}
|
|
110595
110997
|
}
|
|
110596
|
-
return
|
|
110998
|
+
return path20.length > 0 ? { path: path20, onKey: false } : null;
|
|
110597
110999
|
}
|
|
110598
111000
|
return null;
|
|
110599
111001
|
}
|
|
@@ -110626,9 +111028,9 @@ function findDescription(schema) {
|
|
|
110626
111028
|
cur = next;
|
|
110627
111029
|
}
|
|
110628
111030
|
}
|
|
110629
|
-
function resolvePath(schema,
|
|
111031
|
+
function resolvePath(schema, path20) {
|
|
110630
111032
|
let cur = schema;
|
|
110631
|
-
for (const seg of
|
|
111033
|
+
for (const seg of path20) {
|
|
110632
111034
|
const inner = unwrapAll(cur);
|
|
110633
111035
|
if (inner instanceof z44.ZodObject) {
|
|
110634
111036
|
const shape = inner.shape;
|
|
@@ -110645,8 +111047,8 @@ function resolvePath(schema, path19) {
|
|
|
110645
111047
|
}
|
|
110646
111048
|
return cur;
|
|
110647
111049
|
}
|
|
110648
|
-
function objectKeys(schema,
|
|
110649
|
-
const target = resolvePath(schema,
|
|
111050
|
+
function objectKeys(schema, path20) {
|
|
111051
|
+
const target = resolvePath(schema, path20);
|
|
110650
111052
|
if (target == null) return [];
|
|
110651
111053
|
const inner = unwrapAll(target);
|
|
110652
111054
|
if (inner instanceof z44.ZodObject) {
|
|
@@ -110660,8 +111062,8 @@ function objectKeys(schema, path19) {
|
|
|
110660
111062
|
}
|
|
110661
111063
|
return [];
|
|
110662
111064
|
}
|
|
110663
|
-
function enumValues(schema,
|
|
110664
|
-
const target = resolvePath(schema,
|
|
111065
|
+
function enumValues(schema, path20) {
|
|
111066
|
+
const target = resolvePath(schema, path20);
|
|
110665
111067
|
if (target == null) return null;
|
|
110666
111068
|
const inner = unwrapAll(target);
|
|
110667
111069
|
if (inner instanceof z44.ZodEnum) {
|
|
@@ -110726,9 +111128,9 @@ async function computeDiagnostics(doc) {
|
|
|
110726
111128
|
}
|
|
110727
111129
|
return diagnostics;
|
|
110728
111130
|
}
|
|
110729
|
-
function formatPath2(
|
|
111131
|
+
function formatPath2(path20) {
|
|
110730
111132
|
const parts = [];
|
|
110731
|
-
for (const seg of
|
|
111133
|
+
for (const seg of path20) {
|
|
110732
111134
|
if (typeof seg === "number") {
|
|
110733
111135
|
parts.push(`[${seg}]`);
|
|
110734
111136
|
} else if (parts.length === 0) {
|
|
@@ -110821,14 +111223,14 @@ function inferParentPath(lines, currentLine, currentIndent) {
|
|
|
110821
111223
|
stack.unshift({ indent: effectiveIndent, key, isArray: arrayBullet });
|
|
110822
111224
|
if (effectiveIndent === 0) break;
|
|
110823
111225
|
}
|
|
110824
|
-
const
|
|
111226
|
+
const path20 = [];
|
|
110825
111227
|
for (let i = 0; i < stack.length; i++) {
|
|
110826
111228
|
const cur = stack[i];
|
|
110827
|
-
|
|
111229
|
+
path20.push(cur.key);
|
|
110828
111230
|
const next = stack[i + 1];
|
|
110829
|
-
if (next && next.isArray)
|
|
111231
|
+
if (next && next.isArray) path20.push(0);
|
|
110830
111232
|
}
|
|
110831
|
-
return
|
|
111233
|
+
return path20;
|
|
110832
111234
|
}
|
|
110833
111235
|
|
|
110834
111236
|
// src/subcommands/lsp.ts
|
|
@@ -110886,8 +111288,8 @@ init_dist25();
|
|
|
110886
111288
|
init_dist11();
|
|
110887
111289
|
init_config2();
|
|
110888
111290
|
init_runtime_factory();
|
|
110889
|
-
import * as
|
|
110890
|
-
import * as
|
|
111291
|
+
import * as fs12 from "fs";
|
|
111292
|
+
import * as path14 from "path";
|
|
110891
111293
|
async function handleUp(config) {
|
|
110892
111294
|
const yamlPath = resolveYamlPath(config.file);
|
|
110893
111295
|
if (yamlPath == null) {
|
|
@@ -110922,7 +111324,7 @@ async function handleUp(config) {
|
|
|
110922
111324
|
console.log("\nApplied.");
|
|
110923
111325
|
}
|
|
110924
111326
|
async function applyMotebitYaml(opts) {
|
|
110925
|
-
const raw =
|
|
111327
|
+
const raw = fs12.readFileSync(opts.yamlPath, "utf-8");
|
|
110926
111328
|
const parsed = await parseMotebitYaml(raw, opts.yamlPath);
|
|
110927
111329
|
if (!parsed.ok) {
|
|
110928
111330
|
return { kind: "parse_error", diagnostics: parsed.diagnostics };
|
|
@@ -111083,14 +111485,14 @@ function printPlan(plan, opts) {
|
|
|
111083
111485
|
}
|
|
111084
111486
|
function resolveYamlPath(explicit) {
|
|
111085
111487
|
if (explicit != null && explicit !== "") {
|
|
111086
|
-
const abs =
|
|
111087
|
-
return
|
|
111488
|
+
const abs = path14.isAbsolute(explicit) ? explicit : path14.resolve(explicit);
|
|
111489
|
+
return fs12.existsSync(abs) ? abs : null;
|
|
111088
111490
|
}
|
|
111089
111491
|
let dir = process.cwd();
|
|
111090
111492
|
for (; ; ) {
|
|
111091
|
-
const candidate =
|
|
111092
|
-
if (
|
|
111093
|
-
const parent =
|
|
111493
|
+
const candidate = path14.join(dir, "motebit.yaml");
|
|
111494
|
+
if (fs12.existsSync(candidate)) return candidate;
|
|
111495
|
+
const parent = path14.dirname(dir);
|
|
111094
111496
|
if (parent === dir) return null;
|
|
111095
111497
|
dir = parent;
|
|
111096
111498
|
}
|
|
@@ -111351,8 +111753,8 @@ init_esm_shims();
|
|
|
111351
111753
|
init_dist6();
|
|
111352
111754
|
init_config2();
|
|
111353
111755
|
init_identity();
|
|
111354
|
-
import * as
|
|
111355
|
-
import * as
|
|
111756
|
+
import * as fs13 from "fs";
|
|
111757
|
+
import * as path15 from "path";
|
|
111356
111758
|
async function handleMigrateKeyring(config) {
|
|
111357
111759
|
const force = config.force === true;
|
|
111358
111760
|
const fullConfig = loadFullConfig();
|
|
@@ -111368,8 +111770,8 @@ async function handleMigrateKeyring(config) {
|
|
|
111368
111770
|
);
|
|
111369
111771
|
process.exit(1);
|
|
111370
111772
|
}
|
|
111371
|
-
const devKeyringPath =
|
|
111372
|
-
if (!
|
|
111773
|
+
const devKeyringPath = path15.join(CONFIG_DIR, "dev-keyring.json");
|
|
111774
|
+
if (!fs13.existsSync(devKeyringPath)) {
|
|
111373
111775
|
console.error(`Error: no plaintext keyring at ${devKeyringPath}.`);
|
|
111374
111776
|
console.error(
|
|
111375
111777
|
" This subcommand recovers from configs where cli_encrypted_key was lost\n but a plaintext key remains on disk. If you have neither, run\n `motebit` (no args) to create a fresh identity."
|
|
@@ -111378,7 +111780,7 @@ async function handleMigrateKeyring(config) {
|
|
|
111378
111780
|
}
|
|
111379
111781
|
let devKeyring;
|
|
111380
111782
|
try {
|
|
111381
|
-
const raw =
|
|
111783
|
+
const raw = fs13.readFileSync(devKeyringPath, "utf-8");
|
|
111382
111784
|
devKeyring = JSON.parse(raw);
|
|
111383
111785
|
} catch (err2) {
|
|
111384
111786
|
console.error(
|
|
@@ -111444,9 +111846,9 @@ async function handleMigrateKeyring(config) {
|
|
|
111444
111846
|
saveFullConfig(fullConfig);
|
|
111445
111847
|
secureErase(privateKeyBytes);
|
|
111446
111848
|
try {
|
|
111447
|
-
const stat =
|
|
111448
|
-
|
|
111449
|
-
|
|
111849
|
+
const stat = fs13.statSync(devKeyringPath);
|
|
111850
|
+
fs13.writeFileSync(devKeyringPath, "0".repeat(Math.min(stat.size, 4096)));
|
|
111851
|
+
fs13.unlinkSync(devKeyringPath);
|
|
111450
111852
|
} catch (err2) {
|
|
111451
111853
|
console.warn(
|
|
111452
111854
|
`Warning: could not remove ${devKeyringPath} (${err2 instanceof Error ? err2.message : String(err2)}).`
|
|
@@ -111829,7 +112231,7 @@ init_dist6();
|
|
|
111829
112231
|
init_config2();
|
|
111830
112232
|
init_identity();
|
|
111831
112233
|
init_colors();
|
|
111832
|
-
import * as
|
|
112234
|
+
import * as fs14 from "fs";
|
|
111833
112235
|
import * as readline5 from "readline";
|
|
111834
112236
|
var IDENTITY_SUITE = "motebit-jcs-ed25519-hex-v1";
|
|
111835
112237
|
function askVisible(prompt2) {
|
|
@@ -111855,7 +112257,7 @@ async function handleRestore(config) {
|
|
|
111855
112257
|
let mdContent = null;
|
|
111856
112258
|
if (mdPath != null) {
|
|
111857
112259
|
try {
|
|
111858
|
-
mdContent =
|
|
112260
|
+
mdContent = fs14.readFileSync(mdPath, "utf-8");
|
|
111859
112261
|
} catch (err2) {
|
|
111860
112262
|
console.error(`Cannot read ${mdPath}: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
111861
112263
|
process.exit(1);
|
|
@@ -112047,7 +112449,7 @@ async function handleKeychain(config) {
|
|
|
112047
112449
|
|
|
112048
112450
|
// src/subcommands/relay.ts
|
|
112049
112451
|
init_esm_shims();
|
|
112050
|
-
import * as
|
|
112452
|
+
import * as fs15 from "fs";
|
|
112051
112453
|
import { serve } from "@hono/node-server";
|
|
112052
112454
|
|
|
112053
112455
|
// ../../services/relay/dist/index.js
|
|
@@ -120650,7 +121052,7 @@ function resolveRelayDbPath(override) {
|
|
|
120650
121052
|
if (override != null && override !== "") return override;
|
|
120651
121053
|
const envPath = process.env["MOTEBIT_RELAY_DB_PATH"];
|
|
120652
121054
|
if (envPath != null && envPath !== "") return envPath;
|
|
120653
|
-
|
|
121055
|
+
fs15.mkdirSync(RELAY_DIR, { recursive: true });
|
|
120654
121056
|
return RELAY_DB_PATH;
|
|
120655
121057
|
}
|
|
120656
121058
|
async function resolveOptions2(config) {
|
|
@@ -120784,22 +121186,22 @@ init_dist6();
|
|
|
120784
121186
|
init_config2();
|
|
120785
121187
|
init_identity();
|
|
120786
121188
|
import * as readline6 from "readline";
|
|
120787
|
-
import * as
|
|
120788
|
-
import * as
|
|
121189
|
+
import * as fs16 from "fs";
|
|
121190
|
+
import * as path16 from "path";
|
|
120789
121191
|
function discoverIdentityFile() {
|
|
120790
121192
|
let dir = process.cwd();
|
|
120791
|
-
const root =
|
|
120792
|
-
let parent =
|
|
121193
|
+
const root = path16.parse(dir).root;
|
|
121194
|
+
let parent = path16.dirname(dir);
|
|
120793
121195
|
while (dir !== parent && dir !== root) {
|
|
120794
|
-
const candidate =
|
|
120795
|
-
if (
|
|
121196
|
+
const candidate = path16.join(dir, "motebit.md");
|
|
121197
|
+
if (fs16.existsSync(candidate)) return candidate;
|
|
120796
121198
|
dir = parent;
|
|
120797
|
-
parent =
|
|
121199
|
+
parent = path16.dirname(dir);
|
|
120798
121200
|
}
|
|
120799
|
-
const rootCandidate =
|
|
120800
|
-
if (
|
|
120801
|
-
const homeCandidate =
|
|
120802
|
-
if (
|
|
121201
|
+
const rootCandidate = path16.join(root, "motebit.md");
|
|
121202
|
+
if (fs16.existsSync(rootCandidate)) return rootCandidate;
|
|
121203
|
+
const homeCandidate = path16.join(CONFIG_DIR, "identity.md");
|
|
121204
|
+
if (fs16.existsSync(homeCandidate)) return homeCandidate;
|
|
120803
121205
|
return null;
|
|
120804
121206
|
}
|
|
120805
121207
|
async function handleRotate(config) {
|
|
@@ -120814,7 +121216,7 @@ async function handleRotate(config) {
|
|
|
120814
121216
|
Identity file: ${identityPath}`);
|
|
120815
121217
|
let existingContent;
|
|
120816
121218
|
try {
|
|
120817
|
-
existingContent =
|
|
121219
|
+
existingContent = fs16.readFileSync(identityPath, "utf-8");
|
|
120818
121220
|
} catch (err2) {
|
|
120819
121221
|
const msg = err2 instanceof Error ? err2.message : String(err2);
|
|
120820
121222
|
console.error(`Error: cannot read identity file: ${msg}`);
|
|
@@ -120885,7 +121287,7 @@ Identity file: ${identityPath}`);
|
|
|
120885
121287
|
rl.close();
|
|
120886
121288
|
process.exit(1);
|
|
120887
121289
|
}
|
|
120888
|
-
|
|
121290
|
+
fs16.writeFileSync(identityPath, rotatedContent, "utf-8");
|
|
120889
121291
|
console.log(" Identity file: updated and re-signed");
|
|
120890
121292
|
fullConfig.cli_encrypted_key = await encryptPrivateKey(
|
|
120891
121293
|
bytesToHex4(rotateResult.newPrivateKey),
|
|
@@ -121077,12 +121479,12 @@ init_esm_shims();
|
|
|
121077
121479
|
init_dist6();
|
|
121078
121480
|
init_config2();
|
|
121079
121481
|
import * as crypto3 from "crypto";
|
|
121080
|
-
import * as
|
|
121081
|
-
import * as
|
|
121482
|
+
import * as fs17 from "fs";
|
|
121483
|
+
import * as path17 from "path";
|
|
121082
121484
|
var SMOKE_UNIT_COST_USD = 0.01;
|
|
121083
121485
|
var SMOKE_CAPABILITY = "echo";
|
|
121084
|
-
var BUYER_EOA_FILE =
|
|
121085
|
-
var WORKER_EOA_FILE =
|
|
121486
|
+
var BUYER_EOA_FILE = path17.join(CONFIG_DIR, "smoke-x402-buyer-eoa.txt");
|
|
121487
|
+
var WORKER_EOA_FILE = path17.join(CONFIG_DIR, "smoke-x402-worker-eoa.txt");
|
|
121086
121488
|
var USDC_CONTRACTS2 = {
|
|
121087
121489
|
mainnet: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
121088
121490
|
testnet: "0x036CbD53842c5426634e7929541eC2318f3dCF7e"
|
|
@@ -121160,8 +121562,8 @@ async function handleSmokeX402(config) {
|
|
|
121160
121562
|
}
|
|
121161
121563
|
async function loadOrGenerateEoa(filePath, label) {
|
|
121162
121564
|
const { generatePrivateKey, privateKeyToAccount } = await import("viem/accounts");
|
|
121163
|
-
if (
|
|
121164
|
-
const privateKey2 =
|
|
121565
|
+
if (fs17.existsSync(filePath)) {
|
|
121566
|
+
const privateKey2 = fs17.readFileSync(filePath, "utf-8").trim();
|
|
121165
121567
|
if (!/^0x[0-9a-f]{64}$/i.test(privateKey2)) {
|
|
121166
121568
|
throw new Error(
|
|
121167
121569
|
`${filePath} is not a valid EOA private key (expected 0x + 64 hex). Delete the file to regenerate.`
|
|
@@ -121170,9 +121572,9 @@ async function loadOrGenerateEoa(filePath, label) {
|
|
|
121170
121572
|
const account2 = privateKeyToAccount(privateKey2);
|
|
121171
121573
|
return { address: account2.address, privateKey: privateKey2, justGenerated: false };
|
|
121172
121574
|
}
|
|
121173
|
-
|
|
121575
|
+
fs17.mkdirSync(path17.dirname(filePath), { recursive: true });
|
|
121174
121576
|
const privateKey = generatePrivateKey();
|
|
121175
|
-
|
|
121577
|
+
fs17.writeFileSync(filePath, privateKey, { mode: 384 });
|
|
121176
121578
|
const account = privateKeyToAccount(privateKey);
|
|
121177
121579
|
console.log(`Generated ${label} EOA at ${filePath} (mode 0600)`);
|
|
121178
121580
|
return { address: account.address, privateKey, justGenerated: true };
|
|
@@ -121397,13 +121799,13 @@ init_colors();
|
|
|
121397
121799
|
import {
|
|
121398
121800
|
appendFileSync,
|
|
121399
121801
|
existsSync as existsSync10,
|
|
121400
|
-
mkdirSync as
|
|
121401
|
-
readFileSync as
|
|
121802
|
+
mkdirSync as mkdirSync12,
|
|
121803
|
+
readFileSync as readFileSync14,
|
|
121402
121804
|
readdirSync as readdirSync4,
|
|
121403
121805
|
statSync as statSync4,
|
|
121404
|
-
writeFileSync as
|
|
121806
|
+
writeFileSync as writeFileSync16
|
|
121405
121807
|
} from "fs";
|
|
121406
|
-
import { isAbsolute as isAbsolute3, join as
|
|
121808
|
+
import { isAbsolute as isAbsolute3, join as join19, resolve as resolve10 } from "path";
|
|
121407
121809
|
import * as readline7 from "readline";
|
|
121408
121810
|
var DEFAULT_RELAY_URL = "https://relay.motebit.com";
|
|
121409
121811
|
var REGISTRY_ADDRESS_RE = /^did:key:z[1-9A-HJ-NP-Za-km-z]+\/[a-z0-9-]+@[^/]+$/;
|
|
@@ -121423,15 +121825,15 @@ function resolveRelayUrl() {
|
|
|
121423
121825
|
var SKILLS_DIR_NAME = "skills";
|
|
121424
121826
|
var AUDIT_LOG_NAME = "audit.log";
|
|
121425
121827
|
function getSkillsRoot() {
|
|
121426
|
-
return
|
|
121828
|
+
return join19(CONFIG_DIR, SKILLS_DIR_NAME);
|
|
121427
121829
|
}
|
|
121428
121830
|
function getAuditLogPath() {
|
|
121429
|
-
return
|
|
121831
|
+
return join19(getSkillsRoot(), AUDIT_LOG_NAME);
|
|
121430
121832
|
}
|
|
121431
121833
|
function makeAuditSink() {
|
|
121432
121834
|
return (event) => {
|
|
121433
121835
|
const root = getSkillsRoot();
|
|
121434
|
-
if (!existsSync10(root))
|
|
121836
|
+
if (!existsSync10(root)) mkdirSync12(root, { recursive: true });
|
|
121435
121837
|
appendFileSync(getAuditLogPath(), JSON.stringify(event) + "\n", "utf-8");
|
|
121436
121838
|
};
|
|
121437
121839
|
}
|
|
@@ -121469,18 +121871,18 @@ async function handleSkillsInstall(config) {
|
|
|
121469
121871
|
await installFromDirectory(config, sourceArg);
|
|
121470
121872
|
}
|
|
121471
121873
|
async function installFromDirectory(config, sourceArg) {
|
|
121472
|
-
const
|
|
121874
|
+
const path20 = isAbsolute3(sourceArg) ? sourceArg : resolve10(process.cwd(), sourceArg);
|
|
121473
121875
|
let stat;
|
|
121474
121876
|
try {
|
|
121475
|
-
stat = statSync4(
|
|
121877
|
+
stat = statSync4(path20);
|
|
121476
121878
|
} catch {
|
|
121477
|
-
console.error(error2(`No such path: ${
|
|
121879
|
+
console.error(error2(`No such path: ${path20}`));
|
|
121478
121880
|
process.exit(1);
|
|
121479
121881
|
}
|
|
121480
121882
|
if (!stat.isDirectory()) {
|
|
121481
121883
|
console.error(
|
|
121482
121884
|
error2(
|
|
121483
|
-
`Source must be a directory containing SKILL.md and skill-envelope.json. Got: ${
|
|
121885
|
+
`Source must be a directory containing SKILL.md and skill-envelope.json. Got: ${path20}`
|
|
121484
121886
|
)
|
|
121485
121887
|
);
|
|
121486
121888
|
console.error(dim("(git+ssh install sources land in phase 2.)"));
|
|
@@ -121488,13 +121890,13 @@ async function installFromDirectory(config, sourceArg) {
|
|
|
121488
121890
|
}
|
|
121489
121891
|
let installSource;
|
|
121490
121892
|
try {
|
|
121491
|
-
installSource = resolveDirectorySkillSource(
|
|
121893
|
+
installSource = resolveDirectorySkillSource(path20);
|
|
121492
121894
|
} catch (err2) {
|
|
121493
|
-
console.error(error2(`Failed to read skill at ${
|
|
121895
|
+
console.error(error2(`Failed to read skill at ${path20}:`));
|
|
121494
121896
|
console.error(` ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
121495
121897
|
process.exit(1);
|
|
121496
121898
|
}
|
|
121497
|
-
await runInstall(config, installSource, `directory:${
|
|
121899
|
+
await runInstall(config, installSource, `directory:${path20}`, path20);
|
|
121498
121900
|
}
|
|
121499
121901
|
async function installFromRelay(config, rawAddress, parsed) {
|
|
121500
121902
|
const relayUrl = resolveRelayUrl().replace(/\/$/, "");
|
|
@@ -121570,8 +121972,8 @@ async function installFromRelay(config, rawAddress, parsed) {
|
|
|
121570
121972
|
const bodyBytes = base64Decode2(bundle.body);
|
|
121571
121973
|
const fileBytes = {};
|
|
121572
121974
|
if (bundle.files) {
|
|
121573
|
-
for (const [
|
|
121574
|
-
fileBytes[
|
|
121975
|
+
for (const [path20, b64] of Object.entries(bundle.files)) {
|
|
121976
|
+
fileBytes[path20] = base64Decode2(b64);
|
|
121575
121977
|
}
|
|
121576
121978
|
}
|
|
121577
121979
|
const installSource = {
|
|
@@ -121767,9 +122169,9 @@ function parseAuditFilters(config) {
|
|
|
121767
122169
|
return { skillName, type, limit, json: config.json };
|
|
121768
122170
|
}
|
|
121769
122171
|
function readAuditEvents() {
|
|
121770
|
-
const
|
|
121771
|
-
if (!existsSync10(
|
|
121772
|
-
const text =
|
|
122172
|
+
const path20 = getAuditLogPath();
|
|
122173
|
+
if (!existsSync10(path20)) return [];
|
|
122174
|
+
const text = readFileSync14(path20, "utf-8");
|
|
121773
122175
|
const events = [];
|
|
121774
122176
|
for (const line of text.split("\n")) {
|
|
121775
122177
|
const trimmed = line.trim();
|
|
@@ -121931,8 +122333,8 @@ async function handleSkillsRunScript(config) {
|
|
|
121931
122333
|
const { mkdtempSync, writeFileSync: writeBytes, chmodSync: chmodSync3, rmSync: rmSync3 } = await import("fs");
|
|
121932
122334
|
const { tmpdir: tmpdir2 } = await import("os");
|
|
121933
122335
|
const { spawnSync: spawnSync2 } = await import("child_process");
|
|
121934
|
-
const tempDir = mkdtempSync(
|
|
121935
|
-
const tempPath =
|
|
122336
|
+
const tempDir = mkdtempSync(join19(tmpdir2(), "motebit-skill-script-"));
|
|
122337
|
+
const tempPath = join19(tempDir, scriptName);
|
|
121936
122338
|
try {
|
|
121937
122339
|
writeBytes(tempPath, Buffer.from(scriptBytes));
|
|
121938
122340
|
chmodSync3(tempPath, 448);
|
|
@@ -122002,17 +122404,17 @@ function collectAuxFiles2(skillDir) {
|
|
|
122002
122404
|
function walk2(current2, base) {
|
|
122003
122405
|
const entries = readdirSync4(current2, { withFileTypes: true });
|
|
122004
122406
|
for (const entry of entries) {
|
|
122005
|
-
const full =
|
|
122407
|
+
const full = join19(current2, entry.name);
|
|
122006
122408
|
if (entry.isDirectory()) {
|
|
122007
122409
|
walk2(full, base);
|
|
122008
122410
|
} else if (entry.isFile()) {
|
|
122009
122411
|
const rel = full.slice(base.length + 1).split(/[\\/]+/).join("/");
|
|
122010
|
-
out[rel] =
|
|
122412
|
+
out[rel] = readFileSync14(full);
|
|
122011
122413
|
}
|
|
122012
122414
|
}
|
|
122013
122415
|
}
|
|
122014
122416
|
for (const subdir of AUX_DIRS2) {
|
|
122015
|
-
const subdirPath =
|
|
122417
|
+
const subdirPath = join19(skillDir, subdir);
|
|
122016
122418
|
if (existsSync10(subdirPath)) walk2(subdirPath, skillDir);
|
|
122017
122419
|
}
|
|
122018
122420
|
return out;
|
|
@@ -122063,12 +122465,12 @@ async function loadIdentityKey() {
|
|
|
122063
122465
|
};
|
|
122064
122466
|
}
|
|
122065
122467
|
async function signSkillDirectory(skillDir, privateKey, publicKey) {
|
|
122066
|
-
const skillMdPath =
|
|
122468
|
+
const skillMdPath = join19(skillDir, SKILL_MD_NAME);
|
|
122067
122469
|
if (!existsSync10(skillMdPath)) {
|
|
122068
122470
|
console.error(error2(` No SKILL.md at ${skillMdPath}`));
|
|
122069
122471
|
process.exit(1);
|
|
122070
122472
|
}
|
|
122071
|
-
const text =
|
|
122473
|
+
const text = readFileSync14(skillMdPath, "utf-8");
|
|
122072
122474
|
const parsed = parseSkillFile(text);
|
|
122073
122475
|
const body = parsed.body;
|
|
122074
122476
|
const motebitNoSig = { ...parsed.manifest.motebit };
|
|
@@ -122087,7 +122489,7 @@ async function signSkillDirectory(skillDir, privateKey, publicKey) {
|
|
|
122087
122489
|
const bodyHash = await hash(body);
|
|
122088
122490
|
const auxFiles = collectAuxFiles2(skillDir);
|
|
122089
122491
|
const filesEntries = await Promise.all(
|
|
122090
|
-
Object.entries(auxFiles).sort(([a4], [b5]) => a4.localeCompare(b5)).map(async ([
|
|
122492
|
+
Object.entries(auxFiles).sort(([a4], [b5]) => a4.localeCompare(b5)).map(async ([path20, bytes]) => ({ path: path20, hash: await hash(bytes) }))
|
|
122091
122493
|
);
|
|
122092
122494
|
const signedEnvelope = await signSkillEnvelope(
|
|
122093
122495
|
{
|
|
@@ -122105,9 +122507,9 @@ async function signSkillDirectory(skillDir, privateKey, publicKey) {
|
|
|
122105
122507
|
publicKey
|
|
122106
122508
|
);
|
|
122107
122509
|
const skillMdContent = serializeSkillFile(signedManifest, body);
|
|
122108
|
-
|
|
122109
|
-
|
|
122110
|
-
|
|
122510
|
+
writeFileSync16(skillMdPath, skillMdContent);
|
|
122511
|
+
writeFileSync16(
|
|
122512
|
+
join19(skillDir, SKILL_ENVELOPE_JSON_NAME),
|
|
122111
122513
|
JSON.stringify(signedEnvelope, null, 2) + "\n"
|
|
122112
122514
|
);
|
|
122113
122515
|
return { envelope: signedEnvelope, manifest: signedManifest, body };
|
|
@@ -122137,8 +122539,8 @@ async function handleSkillsPublish(config) {
|
|
|
122137
122539
|
}
|
|
122138
122540
|
const auxFiles = collectAuxFiles2(skillDir);
|
|
122139
122541
|
const filesPayload = {};
|
|
122140
|
-
for (const [
|
|
122141
|
-
filesPayload[
|
|
122542
|
+
for (const [path20, bytes] of Object.entries(auxFiles)) {
|
|
122543
|
+
filesPayload[path20] = bytesToBase64(bytes);
|
|
122142
122544
|
}
|
|
122143
122545
|
const submission = {
|
|
122144
122546
|
envelope,
|
|
@@ -122184,8 +122586,8 @@ async function handleSkillsPublish(config) {
|
|
|
122184
122586
|
init_esm_shims();
|
|
122185
122587
|
init_dist34();
|
|
122186
122588
|
init_dist6();
|
|
122187
|
-
import * as
|
|
122188
|
-
import * as
|
|
122589
|
+
import * as fs18 from "fs";
|
|
122590
|
+
import * as path18 from "path";
|
|
122189
122591
|
function tryParseJson(text) {
|
|
122190
122592
|
try {
|
|
122191
122593
|
return JSON.parse(text);
|
|
@@ -122196,7 +122598,7 @@ function tryParseJson(text) {
|
|
|
122196
122598
|
function readJsonFile(filePath) {
|
|
122197
122599
|
let raw;
|
|
122198
122600
|
try {
|
|
122199
|
-
raw =
|
|
122601
|
+
raw = fs18.readFileSync(filePath, "utf-8");
|
|
122200
122602
|
} catch {
|
|
122201
122603
|
return { ok: false, error: "file not found" };
|
|
122202
122604
|
}
|
|
@@ -122229,10 +122631,10 @@ function extractSubjectMotebitId(vc) {
|
|
|
122229
122631
|
return typeof subject.id === "string" ? subject.id : null;
|
|
122230
122632
|
}
|
|
122231
122633
|
async function handleVerify(filePath) {
|
|
122232
|
-
const resolved =
|
|
122634
|
+
const resolved = path18.resolve(filePath);
|
|
122233
122635
|
let stat;
|
|
122234
122636
|
try {
|
|
122235
|
-
stat =
|
|
122637
|
+
stat = fs18.statSync(resolved);
|
|
122236
122638
|
} catch {
|
|
122237
122639
|
console.error(`Error: path does not exist: ${resolved}`);
|
|
122238
122640
|
process.exit(1);
|
|
@@ -122257,7 +122659,7 @@ async function handleVerify(filePath) {
|
|
|
122257
122659
|
async function verifySingleIdentityFile(filePath) {
|
|
122258
122660
|
let content;
|
|
122259
122661
|
try {
|
|
122260
|
-
content =
|
|
122662
|
+
content = fs18.readFileSync(filePath, "utf-8");
|
|
122261
122663
|
} catch {
|
|
122262
122664
|
console.error(`Error: cannot read file: ${filePath}`);
|
|
122263
122665
|
process.exit(1);
|
|
@@ -122350,16 +122752,16 @@ Verifying ${data.length} credential${data.length !== 1 ? "s" : ""}...
|
|
|
122350
122752
|
}
|
|
122351
122753
|
async function verifyBundle(dirPath) {
|
|
122352
122754
|
console.log(`
|
|
122353
|
-
Verifying ${
|
|
122755
|
+
Verifying ${path18.basename(dirPath)}/...
|
|
122354
122756
|
`);
|
|
122355
122757
|
let passed = true;
|
|
122356
122758
|
let motebitId = null;
|
|
122357
122759
|
let identityDid = null;
|
|
122358
|
-
const identityPath =
|
|
122359
|
-
if (
|
|
122760
|
+
const identityPath = path18.join(dirPath, "motebit.md");
|
|
122761
|
+
if (fs18.existsSync(identityPath)) {
|
|
122360
122762
|
let content;
|
|
122361
122763
|
try {
|
|
122362
|
-
content =
|
|
122764
|
+
content = fs18.readFileSync(identityPath, "utf-8");
|
|
122363
122765
|
} catch {
|
|
122364
122766
|
console.log(` Identity (motebit.md): FAILED \u2014 cannot read file`);
|
|
122365
122767
|
passed = false;
|
|
@@ -122381,9 +122783,9 @@ Verifying ${path17.basename(dirPath)}/...
|
|
|
122381
122783
|
} else {
|
|
122382
122784
|
console.log(` Identity (motebit.md): not found, skipping`);
|
|
122383
122785
|
}
|
|
122384
|
-
const credsPath =
|
|
122786
|
+
const credsPath = path18.join(dirPath, "credentials.json");
|
|
122385
122787
|
const credentials = [];
|
|
122386
|
-
if (
|
|
122788
|
+
if (fs18.existsSync(credsPath)) {
|
|
122387
122789
|
const credResult = readJsonFile(credsPath);
|
|
122388
122790
|
if (!credResult.ok) {
|
|
122389
122791
|
console.log(` Credentials: FAILED \u2014 ${credResult.error}`);
|
|
@@ -122426,8 +122828,8 @@ Verifying ${path17.basename(dirPath)}/...
|
|
|
122426
122828
|
} else {
|
|
122427
122829
|
console.log(` Credentials: not found, skipping`);
|
|
122428
122830
|
}
|
|
122429
|
-
const vpPath =
|
|
122430
|
-
if (
|
|
122831
|
+
const vpPath = path18.join(dirPath, "presentation.json");
|
|
122832
|
+
if (fs18.existsSync(vpPath)) {
|
|
122431
122833
|
const vpResult = readJsonFile(vpPath);
|
|
122432
122834
|
if (!vpResult.ok) {
|
|
122433
122835
|
console.log(` Presentation: FAILED \u2014 ${vpResult.error}`);
|
|
@@ -122476,8 +122878,8 @@ Verifying ${path17.basename(dirPath)}/...
|
|
|
122476
122878
|
passed = false;
|
|
122477
122879
|
}
|
|
122478
122880
|
}
|
|
122479
|
-
const budgetPath =
|
|
122480
|
-
if (
|
|
122881
|
+
const budgetPath = path18.join(dirPath, "budget.json");
|
|
122882
|
+
if (fs18.existsSync(budgetPath)) {
|
|
122481
122883
|
const budgetResult = readJsonFile(budgetPath);
|
|
122482
122884
|
if (!budgetResult.ok) {
|
|
122483
122885
|
console.log(` Budget: FAILED \u2014 ${budgetResult.error}`);
|
|
@@ -122499,8 +122901,8 @@ Verifying ${path17.basename(dirPath)}/...
|
|
|
122499
122901
|
} else {
|
|
122500
122902
|
console.log(` Budget: not found, skipping`);
|
|
122501
122903
|
}
|
|
122502
|
-
const gradientPath =
|
|
122503
|
-
if (
|
|
122904
|
+
const gradientPath = path18.join(dirPath, "gradient.json");
|
|
122905
|
+
if (fs18.existsSync(gradientPath)) {
|
|
122504
122906
|
const gradientResult = readJsonFile(gradientPath);
|
|
122505
122907
|
if (!gradientResult.ok) {
|
|
122506
122908
|
console.log(` Gradient: FAILED \u2014 ${gradientResult.error}`);
|
|
@@ -122527,7 +122929,7 @@ init_esm_shims();
|
|
|
122527
122929
|
init_dist6();
|
|
122528
122930
|
init_dist31();
|
|
122529
122931
|
init_colors();
|
|
122530
|
-
import { readFileSync as
|
|
122932
|
+
import { readFileSync as readFileSync16 } from "fs";
|
|
122531
122933
|
import { resolve as resolve12 } from "path";
|
|
122532
122934
|
var KIND_KEYWORDS = /* @__PURE__ */ new Set(["receipt", "token", "listing"]);
|
|
122533
122935
|
function isVerifyKind(s3) {
|
|
@@ -122538,7 +122940,7 @@ async function verifyWire(kind, filePath, now = Date.now()) {
|
|
|
122538
122940
|
const absPath = resolve12(filePath);
|
|
122539
122941
|
let raw;
|
|
122540
122942
|
try {
|
|
122541
|
-
const text =
|
|
122943
|
+
const text = readFileSync16(absPath, "utf-8");
|
|
122542
122944
|
raw = JSON.parse(text);
|
|
122543
122945
|
checks.push({ name: "json", ok: true, detail: `parsed ${text.length} bytes` });
|
|
122544
122946
|
} catch (err2) {
|
|
@@ -122662,7 +123064,7 @@ async function handleVerifyWire(kindArg, pathArg, opts) {
|
|
|
122662
123064
|
// src/subcommands/verify-release.ts
|
|
122663
123065
|
init_esm_shims();
|
|
122664
123066
|
import { createHash as createHash3 } from "crypto";
|
|
122665
|
-
import { readFileSync as
|
|
123067
|
+
import { readFileSync as readFileSync17 } from "fs";
|
|
122666
123068
|
init_config2();
|
|
122667
123069
|
init_config2();
|
|
122668
123070
|
async function handleVerifyRelease(options = {}) {
|
|
@@ -122676,7 +123078,7 @@ async function handleVerifyRelease(options = {}) {
|
|
|
122676
123078
|
}
|
|
122677
123079
|
let selfHash;
|
|
122678
123080
|
try {
|
|
122679
|
-
selfHash = createHash3("sha256").update(
|
|
123081
|
+
selfHash = createHash3("sha256").update(readFileSync17(bundlePath)).digest("hex");
|
|
122680
123082
|
} catch (err2) {
|
|
122681
123083
|
console.error(
|
|
122682
123084
|
`verify-release: cannot read own bytes at ${bundlePath}: ${err2 instanceof Error ? err2.message : String(err2)}`
|
|
@@ -122741,8 +123143,8 @@ init_dist22();
|
|
|
122741
123143
|
init_dist2();
|
|
122742
123144
|
init_dist6();
|
|
122743
123145
|
init_dist34();
|
|
122744
|
-
import * as
|
|
122745
|
-
import * as
|
|
123146
|
+
import * as fs19 from "fs";
|
|
123147
|
+
import * as path19 from "path";
|
|
122746
123148
|
init_dist10();
|
|
122747
123149
|
init_dist13();
|
|
122748
123150
|
|
|
@@ -123634,10 +124036,10 @@ async function publishServiceListing(syncUrl, motebitId, headers, toolNames, pri
|
|
|
123634
124036
|
}
|
|
123635
124037
|
async function handleRun(config) {
|
|
123636
124038
|
const explicitIdentity = config.identity != null && config.identity !== "";
|
|
123637
|
-
const identityPath = explicitIdentity ?
|
|
124039
|
+
const identityPath = explicitIdentity ? path19.resolve(config.identity) : path19.resolve("motebit.md");
|
|
123638
124040
|
let identityContent;
|
|
123639
124041
|
try {
|
|
123640
|
-
identityContent =
|
|
124042
|
+
identityContent = fs19.readFileSync(identityPath, "utf-8");
|
|
123641
124043
|
} catch {
|
|
123642
124044
|
if (explicitIdentity) {
|
|
123643
124045
|
console.error(`Error: cannot read identity file: ${identityPath}`);
|
|
@@ -123751,7 +124153,7 @@ async function handleRun(config) {
|
|
|
123751
124153
|
if (watchedYaml != null) {
|
|
123752
124154
|
console.log(`Watching ${watchedYaml} \u2014 changes will re-apply automatically.`);
|
|
123753
124155
|
try {
|
|
123754
|
-
|
|
124156
|
+
fs19.watch(watchedYaml, () => {
|
|
123755
124157
|
if (yamlDebounce) clearTimeout(yamlDebounce);
|
|
123756
124158
|
yamlDebounce = setTimeout(() => {
|
|
123757
124159
|
void (async () => {
|
|
@@ -124231,10 +124633,10 @@ async function handleServe(config) {
|
|
|
124231
124633
|
let guardianAttestation;
|
|
124232
124634
|
let policyOverrides = {};
|
|
124233
124635
|
if (config.identity != null && config.identity !== "") {
|
|
124234
|
-
const identityPath =
|
|
124636
|
+
const identityPath = path19.resolve(config.identity);
|
|
124235
124637
|
let identityContent;
|
|
124236
124638
|
try {
|
|
124237
|
-
identityContent =
|
|
124639
|
+
identityContent = fs19.readFileSync(identityPath, "utf-8");
|
|
124238
124640
|
} catch {
|
|
124239
124641
|
console.error(`Error: cannot read identity file: ${identityPath}`);
|
|
124240
124642
|
process.exit(1);
|
|
@@ -124299,7 +124701,7 @@ async function handleServe(config) {
|
|
|
124299
124701
|
const runtimeHostServer = election.server;
|
|
124300
124702
|
if (config.tools) {
|
|
124301
124703
|
const { pathToFileURL } = await import("url");
|
|
124302
|
-
const resolved =
|
|
124704
|
+
const resolved = path19.resolve(config.tools);
|
|
124303
124705
|
const mod2 = await import(pathToFileURL(resolved).href);
|
|
124304
124706
|
const entries = mod2.default ?? mod2.tools;
|
|
124305
124707
|
if (!Array.isArray(entries)) {
|
|
@@ -124539,7 +124941,7 @@ async function handleServe(config) {
|
|
|
124539
124941
|
}
|
|
124540
124942
|
if (config.identity != null && config.identity !== "") {
|
|
124541
124943
|
try {
|
|
124542
|
-
deps.identityFileContent =
|
|
124944
|
+
deps.identityFileContent = fs19.readFileSync(path19.resolve(config.identity), "utf-8");
|
|
124543
124945
|
} catch {
|
|
124544
124946
|
}
|
|
124545
124947
|
}
|
|
@@ -124816,7 +125218,7 @@ init_esm_shims();
|
|
|
124816
125218
|
import { spawn } from "child_process";
|
|
124817
125219
|
import { mkdtemp, writeFile as writeFile3, unlink } from "fs/promises";
|
|
124818
125220
|
import { tmpdir } from "os";
|
|
124819
|
-
import { join as
|
|
125221
|
+
import { join as join21 } from "path";
|
|
124820
125222
|
|
|
124821
125223
|
// ../../packages/voice/dist/index.js
|
|
124822
125224
|
init_esm_shims();
|
|
@@ -125092,22 +125494,22 @@ var SystemTTSProvider = class {
|
|
|
125092
125494
|
}
|
|
125093
125495
|
};
|
|
125094
125496
|
async function writeTempMp3(buf) {
|
|
125095
|
-
const dir = await mkdtemp(
|
|
125096
|
-
const
|
|
125097
|
-
await writeFile3(
|
|
125098
|
-
return
|
|
125497
|
+
const dir = await mkdtemp(join21(tmpdir(), "motebit-tts-"));
|
|
125498
|
+
const path20 = join21(dir, "out.mp3");
|
|
125499
|
+
await writeFile3(path20, buf);
|
|
125500
|
+
return path20;
|
|
125099
125501
|
}
|
|
125100
|
-
function mp3PlayerCommand(
|
|
125101
|
-
if (process.platform === "darwin") return { bin: "afplay", args: [
|
|
125102
|
-
return { bin: "mpg123", args: ["-q",
|
|
125502
|
+
function mp3PlayerCommand(path20) {
|
|
125503
|
+
if (process.platform === "darwin") return { bin: "afplay", args: [path20] };
|
|
125504
|
+
return { bin: "mpg123", args: ["-q", path20] };
|
|
125103
125505
|
}
|
|
125104
125506
|
function systemSpeakCommand() {
|
|
125105
125507
|
if (process.platform === "darwin") return { bin: "say", args: [] };
|
|
125106
125508
|
if (process.platform === "linux") return { bin: "espeak", args: [] };
|
|
125107
125509
|
return null;
|
|
125108
125510
|
}
|
|
125109
|
-
function playMp3(
|
|
125110
|
-
const cmd = mp3PlayerCommand(
|
|
125511
|
+
function playMp3(path20, onSpawn) {
|
|
125512
|
+
const cmd = mp3PlayerCommand(path20);
|
|
125111
125513
|
if (!cmd) {
|
|
125112
125514
|
return Promise.reject(new Error(`No MP3 player available on ${process.platform}`));
|
|
125113
125515
|
}
|
|
@@ -125488,12 +125890,16 @@ async function main() {
|
|
|
125488
125890
|
const validProviders = ["anthropic", "openai", "google", "local-server", "proxy"];
|
|
125489
125891
|
if (validProviders.includes(personalityConfig.default_provider)) {
|
|
125490
125892
|
config.provider = personalityConfig.default_provider;
|
|
125893
|
+
if (!config.modelExplicit) {
|
|
125894
|
+
config.model = defaultModelForProvider(config.provider);
|
|
125895
|
+
}
|
|
125491
125896
|
}
|
|
125492
125897
|
}
|
|
125493
125898
|
if (personalityConfig.default_model != null && personalityConfig.default_model !== "" && !process.argv.includes("--model")) {
|
|
125494
|
-
if (
|
|
125899
|
+
if (admitModelForProvider(config.provider, personalityConfig.default_model).admissible) {
|
|
125495
125900
|
config.model = personalityConfig.default_model;
|
|
125496
125901
|
} else {
|
|
125902
|
+
config.model = defaultModelForProvider(config.provider);
|
|
125497
125903
|
console.log(
|
|
125498
125904
|
dim(
|
|
125499
125905
|
` [config default_model "${personalityConfig.default_model}" belongs to another provider; using ${config.model} for ${config.provider}]`
|
|
@@ -125501,11 +125907,14 @@ async function main() {
|
|
|
125501
125907
|
);
|
|
125502
125908
|
}
|
|
125503
125909
|
}
|
|
125504
|
-
if (process.argv.includes("--model")
|
|
125505
|
-
|
|
125506
|
-
|
|
125507
|
-
|
|
125508
|
-
|
|
125910
|
+
if (process.argv.includes("--model")) {
|
|
125911
|
+
const admission = admitModelForProvider(config.provider, config.model);
|
|
125912
|
+
if (!admission.admissible) {
|
|
125913
|
+
console.error(
|
|
125914
|
+
`Model "${config.model}" does not belong to provider "${config.provider}" \u2014 ${admission.teach ?? "pick a matching pair, or drop --model to use the provider's default."}`
|
|
125915
|
+
);
|
|
125916
|
+
process.exit(1);
|
|
125917
|
+
}
|
|
125509
125918
|
}
|
|
125510
125919
|
if (fullConfig.max_tokens != null && !process.argv.includes("--max-tokens")) {
|
|
125511
125920
|
config.maxTokens = fullConfig.max_tokens;
|
|
@@ -125857,6 +126266,14 @@ async function main() {
|
|
|
125857
126266
|
console.log(dim(" recovery seed not backed up \u2014 `motebit seed reveal` (once, on paper)"));
|
|
125858
126267
|
console.log();
|
|
125859
126268
|
}
|
|
126269
|
+
if (process.env["MOTEBIT_NO_UPDATE_CHECK"] !== "1") {
|
|
126270
|
+
const updateNudge = renderUpdateNudge({ currentVersion: VERSION, state: readUpdateState() });
|
|
126271
|
+
if (updateNudge != null) {
|
|
126272
|
+
console.log(dim(` ${updateNudge}`));
|
|
126273
|
+
console.log();
|
|
126274
|
+
}
|
|
126275
|
+
refreshUpdateCheckInBackground();
|
|
126276
|
+
}
|
|
125860
126277
|
if (isFirstLaunch) {
|
|
125861
126278
|
try {
|
|
125862
126279
|
const activationRunId = crypto.randomUUID();
|
|
@@ -125895,6 +126312,12 @@ async function main() {
|
|
|
125895
126312
|
}
|
|
125896
126313
|
}
|
|
125897
126314
|
const prompt2 = () => {
|
|
126315
|
+
setModeRow(
|
|
126316
|
+
renderModeRow({
|
|
126317
|
+
model: runtime.currentModel ?? config.model,
|
|
126318
|
+
provider: config.provider
|
|
126319
|
+
})
|
|
126320
|
+
);
|
|
125898
126321
|
readInput(prompt("you>") + " ").then(
|
|
125899
126322
|
(line) => void handleLine(line),
|
|
125900
126323
|
() => {
|
|
@@ -125941,16 +126364,8 @@ ${prompt("mote>")} ${result.response}
|
|
|
125941
126364
|
console.log(
|
|
125942
126365
|
meta(` [memories: ${result.memoriesFormed.map((m4) => m4.content).join(", ")}]`)
|
|
125943
126366
|
);
|
|
126367
|
+
console.log();
|
|
125944
126368
|
}
|
|
125945
|
-
const s3 = result.stateAfter;
|
|
125946
|
-
console.log(
|
|
125947
|
-
meta(
|
|
125948
|
-
` [state: attention=${s3.attention.toFixed(2)} confidence=${s3.confidence.toFixed(2)} valence=${s3.affect_valence.toFixed(2)} curiosity=${s3.curiosity.toFixed(2)}]`
|
|
125949
|
-
)
|
|
125950
|
-
);
|
|
125951
|
-
const bodyLine = formatBodyAwareness(result.cues);
|
|
125952
|
-
if (bodyLine) console.log(meta(` ${bodyLine}`));
|
|
125953
|
-
console.log();
|
|
125954
126369
|
} else {
|
|
125955
126370
|
writeOutput("\n" + prompt("mote>") + " ");
|
|
125956
126371
|
const grantOptions = grantPresenter?.delegationForTurn() ?? void 0;
|