@sanity-labs/nuum 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +38 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34518,9 +34518,10 @@ function scanSubdirectories(dir, skills) {
|
|
|
34518
34518
|
}
|
|
34519
34519
|
} catch {}
|
|
34520
34520
|
}
|
|
34521
|
-
function discoverSkills(
|
|
34521
|
+
function discoverSkills(options = {}) {
|
|
34522
|
+
const cwd = options.cwd ?? process.cwd();
|
|
34523
|
+
const home = options.home ?? homedir2();
|
|
34522
34524
|
const skills = new Map;
|
|
34523
|
-
const home = homedir2();
|
|
34524
34525
|
scanDirectory(cwd, skills);
|
|
34525
34526
|
scanSubdirectories(cwd, skills);
|
|
34526
34527
|
if (cwd !== home) {
|
|
@@ -34564,7 +34565,7 @@ var cachedSkills = null;
|
|
|
34564
34565
|
var cachedCwd = null;
|
|
34565
34566
|
function getSkills(cwd = process.cwd()) {
|
|
34566
34567
|
if (cachedSkills === null || cachedCwd !== cwd) {
|
|
34567
|
-
cachedSkills = discoverSkills(cwd);
|
|
34568
|
+
cachedSkills = discoverSkills({ cwd });
|
|
34568
34569
|
cachedCwd = cwd;
|
|
34569
34570
|
}
|
|
34570
34571
|
return cachedSkills;
|
|
@@ -34747,6 +34748,26 @@ function formatIdRange(firstId, lastId, timestamp) {
|
|
|
34747
34748
|
}
|
|
34748
34749
|
return `[${formatTimestamp(timestamp)} id:${firstId}...${lastId}]`;
|
|
34749
34750
|
}
|
|
34751
|
+
function ensureAllToolCallsHaveResults(toolCalls, toolResults) {
|
|
34752
|
+
if (toolResults.length >= toolCalls.length) {
|
|
34753
|
+
return toolResults;
|
|
34754
|
+
}
|
|
34755
|
+
const completeResults = [...toolResults];
|
|
34756
|
+
for (let i = toolResults.length;i < toolCalls.length; i++) {
|
|
34757
|
+
const call = toolCalls[i];
|
|
34758
|
+
log4.warn("synthesizing error result for orphaned tool call", {
|
|
34759
|
+
toolCallId: call.toolCallId,
|
|
34760
|
+
toolName: call.toolName
|
|
34761
|
+
});
|
|
34762
|
+
completeResults.push({
|
|
34763
|
+
type: "tool-result",
|
|
34764
|
+
toolCallId: call.toolCallId,
|
|
34765
|
+
toolName: call.toolName,
|
|
34766
|
+
result: "Error: Tool execution failed (no result recorded - possible crash or disk full)"
|
|
34767
|
+
});
|
|
34768
|
+
}
|
|
34769
|
+
return completeResults;
|
|
34770
|
+
}
|
|
34750
34771
|
function processMessageForTurn(message, allMessages, currentIdx) {
|
|
34751
34772
|
const turns = [];
|
|
34752
34773
|
switch (message.type) {
|
|
@@ -34805,13 +34826,12 @@ function processMessageForTurn(message, allMessages, currentIdx) {
|
|
|
34805
34826
|
content: assistantContent
|
|
34806
34827
|
};
|
|
34807
34828
|
turns.push(assistantMsg);
|
|
34808
|
-
|
|
34809
|
-
|
|
34810
|
-
|
|
34811
|
-
|
|
34812
|
-
|
|
34813
|
-
|
|
34814
|
-
}
|
|
34829
|
+
const completeResults = ensureAllToolCallsHaveResults(toolCalls, toolResults);
|
|
34830
|
+
const toolMsg = {
|
|
34831
|
+
role: "tool",
|
|
34832
|
+
content: completeResults
|
|
34833
|
+
};
|
|
34834
|
+
turns.push(toolMsg);
|
|
34815
34835
|
} else {
|
|
34816
34836
|
turns.push({ role: "assistant", content: formatWithId(message.id, message.createdAt, message.content) });
|
|
34817
34837
|
}
|
|
@@ -34867,13 +34887,12 @@ function processMessageForTurn(message, allMessages, currentIdx) {
|
|
|
34867
34887
|
content: assistantContent
|
|
34868
34888
|
};
|
|
34869
34889
|
turns.push(assistantMsg);
|
|
34870
|
-
|
|
34871
|
-
|
|
34872
|
-
|
|
34873
|
-
|
|
34874
|
-
|
|
34875
|
-
|
|
34876
|
-
}
|
|
34890
|
+
const completeResults = ensureAllToolCallsHaveResults(toolCalls, toolResults);
|
|
34891
|
+
const toolMsg = {
|
|
34892
|
+
role: "tool",
|
|
34893
|
+
content: completeResults
|
|
34894
|
+
};
|
|
34895
|
+
turns.push(toolMsg);
|
|
34877
34896
|
}
|
|
34878
34897
|
return { turns, nextIdx };
|
|
34879
34898
|
}
|
|
@@ -47357,8 +47376,8 @@ async function runRepl(options) {
|
|
|
47357
47376
|
}
|
|
47358
47377
|
|
|
47359
47378
|
// src/version.ts
|
|
47360
|
-
var VERSION = "0.2.
|
|
47361
|
-
var GIT_HASH = "
|
|
47379
|
+
var VERSION = "0.2.1";
|
|
47380
|
+
var GIT_HASH = "73e0b24";
|
|
47362
47381
|
var VERSION_STRING = `miriad-code v${VERSION} (${GIT_HASH})`;
|
|
47363
47382
|
|
|
47364
47383
|
// src/cli/index.ts
|