negotium 0.2.14 → 0.2.16
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/agent-helpers.js +178 -26
- package/dist/agent-helpers.js.map +8 -8
- package/dist/{chunk-5g5a63vv.js → chunk-5cpdbbeh.js} +56 -6
- package/dist/{chunk-5g5a63vv.js.map → chunk-5cpdbbeh.js.map} +4 -4
- package/dist/hosted-agent.js +118 -9
- package/dist/hosted-agent.js.map +6 -6
- package/dist/main.js +389 -50
- package/dist/main.js.map +15 -15
- package/dist/mcp-factories.js +247 -36
- package/dist/mcp-factories.js.map +9 -9
- package/dist/registry.js +3 -3
- package/dist/registry.js.map +2 -2
- package/dist/rollout.js +1 -1
- package/dist/runtime/src/agents/codex-provider.ts +53 -2
- package/dist/runtime/src/agents/rollout/codex.ts +62 -0
- package/dist/runtime/src/mcp/factories/token-stats.ts +33 -11
- package/dist/runtime/src/mcp/runtime-spec.ts +58 -1
- package/dist/runtime/src/node-host.ts +1 -0
- package/dist/runtime/src/runtime/public-helpers.ts +8 -0
- package/dist/runtime/src/runtime/turn-event-stream.ts +17 -2
- package/dist/runtime/src/storage/token-stats.ts +200 -19
- package/dist/runtime/src/version.ts +1 -1
- package/dist/runtime-helpers.js +443 -30
- package/dist/runtime-helpers.js.map +9 -3
- package/dist/storage.js +112 -11
- package/dist/storage.js.map +3 -3
- package/dist/types/packages/core/src/agents/codex-provider.d.ts +13 -0
- package/dist/types/packages/core/src/agents/rollout/codex.d.ts +9 -0
- package/dist/types/packages/core/src/mcp/factories/token-stats.d.ts +4 -2
- package/dist/types/packages/core/src/runtime/bashrs-completions.d.ts +50 -0
- package/dist/types/packages/core/src/runtime/public-helpers.d.ts +2 -0
- package/dist/types/packages/core/src/storage/token-stats.d.ts +35 -6
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -861,7 +861,7 @@ function canonicalMcpBridgeEnv(scope) {
|
|
|
861
861
|
}
|
|
862
862
|
|
|
863
863
|
// ../../packages/core/src/mcp/runtime-spec.ts
|
|
864
|
-
import { createHmac, timingSafeEqual } from "crypto";
|
|
864
|
+
import { createHash, createHmac, timingSafeEqual } from "crypto";
|
|
865
865
|
var RUNTIME_MCP_KEY = "runtime";
|
|
866
866
|
var RUNTIME_MCP_BASE_PATH = "/mcp/runtime";
|
|
867
867
|
var TOKEN_TTL_MS = 4 * 60 * 60 * 1000;
|
|
@@ -899,19 +899,69 @@ function buildRuntimeMcpSpec(agent, ctx) {
|
|
|
899
899
|
return {
|
|
900
900
|
type: "sse",
|
|
901
901
|
url: `${base}/sse?${query}`,
|
|
902
|
-
timeout: CLAUDE_MCP_TOOL_TIMEOUT_MS
|
|
902
|
+
timeout: CLAUDE_MCP_TOOL_TIMEOUT_MS,
|
|
903
|
+
...agent === "maestro" ? { lifecycle: "turn" } : {}
|
|
903
904
|
};
|
|
904
905
|
}
|
|
906
|
+
function hostedMcpCacheIdentity(surface, ctx) {
|
|
907
|
+
let semanticContext;
|
|
908
|
+
switch (surface) {
|
|
909
|
+
case "system-health":
|
|
910
|
+
semanticContext = {};
|
|
911
|
+
break;
|
|
912
|
+
case "token-stats":
|
|
913
|
+
case "agent-health":
|
|
914
|
+
semanticContext = { userId: ctx.userId };
|
|
915
|
+
break;
|
|
916
|
+
case "task":
|
|
917
|
+
semanticContext = {
|
|
918
|
+
userId: ctx.userId,
|
|
919
|
+
topicTitle: ctx.topicTitle,
|
|
920
|
+
topicId: ctx.topicId ?? null
|
|
921
|
+
};
|
|
922
|
+
break;
|
|
923
|
+
case "wiki":
|
|
924
|
+
case "skills":
|
|
925
|
+
semanticContext = {
|
|
926
|
+
userId: ctx.userId,
|
|
927
|
+
topicId: ctx.wikiTopicId ?? ctx.topicId ?? null
|
|
928
|
+
};
|
|
929
|
+
break;
|
|
930
|
+
case "vault":
|
|
931
|
+
semanticContext = { userId: ctx.userId, cwd: ctx.cwd, agent: ctx.agent };
|
|
932
|
+
break;
|
|
933
|
+
case "session-comm":
|
|
934
|
+
semanticContext = {
|
|
935
|
+
userId: ctx.userId,
|
|
936
|
+
topicTitle: ctx.topicTitle,
|
|
937
|
+
topicId: ctx.topicId ?? null,
|
|
938
|
+
subagentParentTopicId: ctx.subagentParentTopicId ?? null,
|
|
939
|
+
depth: ctx.depth ?? 0,
|
|
940
|
+
silent: ctx.silent ?? false,
|
|
941
|
+
agent: ctx.agent,
|
|
942
|
+
peerBridge: ctx.peerBridge ?? null
|
|
943
|
+
};
|
|
944
|
+
break;
|
|
945
|
+
}
|
|
946
|
+
const digest = createHash("sha256").update(JSON.stringify([surface, semanticContext])).digest("hex").slice(0, 24);
|
|
947
|
+
return `hosted:${surface}:${digest}`;
|
|
948
|
+
}
|
|
905
949
|
function buildHostedMcpSpec(agent, surface, ctx) {
|
|
906
950
|
const token = issueHostedMcpToken(surface, ctx);
|
|
907
951
|
const base = `http://127.0.0.1:${runtimePort}${RUNTIME_MCP_BASE_PATH}/${surface}`;
|
|
908
952
|
const query = `token=${encodeURIComponent(token)}`;
|
|
909
953
|
if (agent === "codex")
|
|
910
954
|
return { url: `${base}/mcp?${query}` };
|
|
955
|
+
const queryBound = surface === "session-comm" && (ctx.silent === true || ctx.peerBridge !== undefined);
|
|
956
|
+
const lifecycle = queryBound ? "turn" : surface === "session-comm" ? "session" : "process";
|
|
911
957
|
return {
|
|
912
958
|
type: "sse",
|
|
913
959
|
url: `${base}/sse?${query}`,
|
|
914
|
-
timeout: CLAUDE_MCP_TOOL_TIMEOUT_MS
|
|
960
|
+
timeout: CLAUDE_MCP_TOOL_TIMEOUT_MS,
|
|
961
|
+
...agent === "maestro" ? {
|
|
962
|
+
lifecycle,
|
|
963
|
+
cacheKey: hostedMcpCacheIdentity(surface, ctx)
|
|
964
|
+
} : {}
|
|
915
965
|
};
|
|
916
966
|
}
|
|
917
967
|
|
|
@@ -1728,12 +1778,12 @@ if (isBun) {
|
|
|
1728
1778
|
}
|
|
1729
1779
|
|
|
1730
1780
|
// ../../packages/core/src/storage/vault-crypto-core.ts
|
|
1731
|
-
import { createCipheriv, createDecipheriv, createHash, randomBytes as randomBytes3 } from "crypto";
|
|
1781
|
+
import { createCipheriv, createDecipheriv, createHash as createHash2, randomBytes as randomBytes3 } from "crypto";
|
|
1732
1782
|
var ENVELOPE_PREFIX = "otium-vault:v1:";
|
|
1733
1783
|
var IV_BYTES = 12;
|
|
1734
1784
|
var KEY_BYTES = 32;
|
|
1735
1785
|
function encryptionKey(masterKey) {
|
|
1736
|
-
return
|
|
1786
|
+
return createHash2("sha256").update("otium-vault-value-v1\x00", "utf8").update(masterKey, "utf8").digest().subarray(0, KEY_BYTES);
|
|
1737
1787
|
}
|
|
1738
1788
|
function aad(userId, key) {
|
|
1739
1789
|
return Buffer.from(`${userId}\x00${key.toUpperCase()}`, "utf8");
|
|
@@ -2431,4 +2481,4 @@ function formatDateBucket(d) {
|
|
|
2431
2481
|
|
|
2432
2482
|
export { __require, logger, CLAUDE_EFFORT_VALUES, CODEX_EFFORT_VALUES, MAESTRO_EFFORT_VALUES, MODEL_SONNET, MODEL_OPUS, MODEL_FABLE, configureRolloutHost, assertUuidLike, ensureCwdExists, extractChatPairs, encodeClaudeCwd, writeClaudeRollout, repairPoisonedRollout, hostedCodexHomePath, extractLatestCodexPatchPreview, extractCodexPatchCallIds, readCodexPatchCallIds, readLatestCodexPatchPreview, extractLatestCodexContextUsage, readLatestCodexContextUsage, migrateCodexRolloutNativeMultiAgentMetadata, latestCodexRolloutPath, writeCodexRollout, decodeUuidV7Timestamp };
|
|
2433
2483
|
|
|
2434
|
-
//# debugId=
|
|
2484
|
+
//# debugId=7493A6445956EC1B64756E2164756E21
|