@slopus/happy-providers 0.0.1 → 0.0.5
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/EXAMPLES.md +42 -74
- package/README.md +176 -100
- package/dist/core/BaseSession.d.ts +3 -2
- package/dist/core/BaseSession.d.ts.map +1 -1
- package/dist/core/BaseSession.js.map +1 -1
- package/dist/core/EmptyResponseError.d.ts +3 -3
- package/dist/core/EmptyResponseError.d.ts.map +1 -1
- package/dist/core/EmptyResponseError.js.map +1 -1
- package/dist/core/SessionAssistantMessageAccumulator.d.ts +17 -0
- package/dist/core/SessionAssistantMessageAccumulator.d.ts.map +1 -0
- package/dist/core/SessionAssistantMessageAccumulator.js +154 -0
- package/dist/core/SessionAssistantMessageAccumulator.js.map +1 -0
- package/dist/core/SessionCompaction.d.ts +4 -11
- package/dist/core/SessionCompaction.d.ts.map +1 -1
- package/dist/core/SessionContext.d.ts +35 -33
- package/dist/core/SessionContext.d.ts.map +1 -1
- package/dist/core/SessionEvent.d.ts +23 -8
- package/dist/core/SessionEvent.d.ts.map +1 -1
- package/dist/core/SessionEvent.js.map +1 -1
- package/dist/core/SessionRunRequest.d.ts +2 -5
- package/dist/core/SessionRunRequest.d.ts.map +1 -1
- package/dist/core/SessionTool.d.ts +1 -3
- package/dist/core/SessionTool.d.ts.map +1 -1
- package/dist/core/SessionUsage.d.ts +14 -0
- package/dist/core/SessionUsage.d.ts.map +1 -0
- package/dist/core/{SessionCacheUsage.js → SessionUsage.js} +2 -2
- package/dist/core/SessionUsage.js.map +1 -0
- package/dist/core/addSessionUsage.d.ts +3 -0
- package/dist/core/addSessionUsage.d.ts.map +1 -0
- package/dist/core/{addSessionCacheUsage.js → addSessionUsage.js} +3 -3
- package/dist/core/addSessionUsage.js.map +1 -0
- package/dist/core/emitToolCallResult.d.ts +1 -0
- package/dist/core/emitToolCallResult.d.ts.map +1 -1
- package/dist/core/emitToolCallResult.js +6 -2
- package/dist/core/emitToolCallResult.js.map +1 -1
- package/dist/core/toSessionReminderMessage.d.ts.map +1 -1
- package/dist/core/toSessionReminderMessage.js +6 -2
- package/dist/core/toSessionReminderMessage.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/protocol/anthropic/collectAnthropicCompaction.d.ts +2 -2
- package/dist/protocol/anthropic/collectAnthropicCompaction.d.ts.map +1 -1
- package/dist/protocol/anthropic/collectAnthropicCompaction.js +14 -9
- package/dist/protocol/anthropic/collectAnthropicCompaction.js.map +1 -1
- package/dist/protocol/anthropic/mapAnthropicStream.d.ts.map +1 -1
- package/dist/protocol/anthropic/mapAnthropicStream.js +52 -30
- package/dist/protocol/anthropic/mapAnthropicStream.js.map +1 -1
- package/dist/protocol/anthropic/toAnthropicMessages.d.ts +1 -2
- package/dist/protocol/anthropic/toAnthropicMessages.d.ts.map +1 -1
- package/dist/protocol/anthropic/toAnthropicMessages.js +46 -108
- package/dist/protocol/anthropic/toAnthropicMessages.js.map +1 -1
- package/dist/protocol/responses/ResponsesSession.d.ts +3 -2
- package/dist/protocol/responses/ResponsesSession.d.ts.map +1 -1
- package/dist/protocol/responses/ResponsesSession.js +19 -48
- package/dist/protocol/responses/ResponsesSession.js.map +1 -1
- package/dist/protocol/responses/mapOpenAIResponseStream.d.ts +9 -6
- package/dist/protocol/responses/mapOpenAIResponseStream.d.ts.map +1 -1
- package/dist/protocol/responses/mapOpenAIResponseStream.js +191 -59
- package/dist/protocol/responses/mapOpenAIResponseStream.js.map +1 -1
- package/dist/protocol/responses/toOpenAIInputContent.d.ts +2 -2
- package/dist/protocol/responses/toOpenAIInputContent.d.ts.map +1 -1
- package/dist/protocol/responses/toOpenAIInputContent.js +4 -4
- package/dist/protocol/responses/toOpenAIInputContent.js.map +1 -1
- package/dist/protocol/responses/toOpenAIResponseInput.d.ts.map +1 -1
- package/dist/protocol/responses/toOpenAIResponseInput.js +74 -68
- package/dist/protocol/responses/toOpenAIResponseInput.js.map +1 -1
- package/dist/protocol/responses/toSessionUsage.d.ts +4 -0
- package/dist/protocol/responses/toSessionUsage.d.ts.map +1 -0
- package/dist/protocol/responses/{toSessionCacheUsage.js → toSessionUsage.js} +4 -4
- package/dist/protocol/responses/toSessionUsage.js.map +1 -0
- package/dist/vendors/bedrock/AnthropicBedrockSession.d.ts +3 -2
- package/dist/vendors/bedrock/AnthropicBedrockSession.d.ts.map +1 -1
- package/dist/vendors/bedrock/AnthropicBedrockSession.js +34 -73
- package/dist/vendors/bedrock/AnthropicBedrockSession.js.map +1 -1
- package/dist/vendors/claude/ClaudeSession.d.ts +3 -2
- package/dist/vendors/claude/ClaudeSession.d.ts.map +1 -1
- package/dist/vendors/claude/ClaudeSession.js +180 -82
- package/dist/vendors/claude/ClaudeSession.js.map +1 -1
- package/dist/vendors/claude/impl/ClaudeToolBridge.js +1 -7
- package/dist/vendors/claude/impl/ClaudeToolBridge.js.map +1 -1
- package/dist/vendors/claude/impl/claudeMessageIdentity.d.ts +3 -4
- package/dist/vendors/claude/impl/claudeMessageIdentity.d.ts.map +1 -1
- package/dist/vendors/claude/impl/claudeMessageIdentity.js +9 -12
- package/dist/vendors/claude/impl/claudeMessageIdentity.js.map +1 -1
- package/dist/vendors/claude/impl/createClaudeSessionReplay.js +36 -30
- package/dist/vendors/claude/impl/createClaudeSessionReplay.js.map +1 -1
- package/dist/vendors/claude/impl/toClaudeSdkOptions.d.ts.map +1 -1
- package/dist/vendors/claude/impl/toClaudeSdkOptions.js +2 -2
- package/dist/vendors/claude/impl/toClaudeSdkOptions.js.map +1 -1
- package/dist/vendors/codex/CodexSession.d.ts +3 -2
- package/dist/vendors/codex/CodexSession.d.ts.map +1 -1
- package/dist/vendors/codex/CodexSession.js +45 -65
- package/dist/vendors/codex/CodexSession.js.map +1 -1
- package/dist/vendors/codex/CodexToolVendor.d.ts +2 -1
- package/dist/vendors/codex/CodexToolVendor.d.ts.map +1 -1
- package/dist/vendors/codex/impl/codexCompaction.d.ts +2 -2
- package/dist/vendors/codex/impl/codexCompaction.d.ts.map +1 -1
- package/dist/vendors/codex/impl/codexCompaction.js +15 -7
- package/dist/vendors/codex/impl/codexCompaction.js.map +1 -1
- package/dist/vendors/codex/impl/createCodexModelSwitchMessage.d.ts.map +1 -1
- package/dist/vendors/codex/impl/createCodexModelSwitchMessage.js +11 -8
- package/dist/vendors/codex/impl/createCodexModelSwitchMessage.js.map +1 -1
- package/dist/vendors/codex/impl/getCodexContextSuffix.js +13 -15
- package/dist/vendors/codex/impl/getCodexContextSuffix.js.map +1 -1
- package/dist/vendors/codex/impl/getCodexIncrementalInput.d.ts +2 -2
- package/dist/vendors/codex/impl/getCodexIncrementalInput.d.ts.map +1 -1
- package/dist/vendors/codex/impl/getCodexIncrementalInput.js +15 -4
- package/dist/vendors/codex/impl/getCodexIncrementalInput.js.map +1 -1
- package/dist/vendors/codex/impl/getCodexTurnKey.js +1 -1
- package/dist/vendors/codex/impl/getCodexTurnKey.js.map +1 -1
- package/dist/vendors/codex/impl/settleCodexToolSearch.d.ts +4 -3
- package/dist/vendors/codex/impl/settleCodexToolSearch.d.ts.map +1 -1
- package/dist/vendors/codex/impl/settleCodexToolSearch.js +14 -2
- package/dist/vendors/codex/impl/settleCodexToolSearch.js.map +1 -1
- package/dist/vendors/codex/impl/toCodexToolDefinitions.d.ts.map +1 -1
- package/dist/vendors/codex/impl/toCodexToolDefinitions.js +6 -27
- package/dist/vendors/codex/impl/toCodexToolDefinitions.js.map +1 -1
- package/dist/vendors/codex/impl/withCodexSkills.d.ts.map +1 -1
- package/dist/vendors/codex/impl/withCodexSkills.js +8 -12
- package/dist/vendors/codex/impl/withCodexSkills.js.map +1 -1
- package/dist/vendors/codex/tools/tool_search.d.ts +9 -5
- package/dist/vendors/codex/tools/tool_search.d.ts.map +1 -1
- package/dist/vendors/codex/tools/tool_search.js +8 -10
- package/dist/vendors/codex/tools/tool_search.js.map +1 -1
- package/dist/vendors/grok/GrokSession.d.ts +3 -2
- package/dist/vendors/grok/GrokSession.d.ts.map +1 -1
- package/dist/vendors/grok/GrokSession.js +26 -48
- package/dist/vendors/grok/GrokSession.js.map +1 -1
- package/dist/vendors/grok/impl/grokMessages.js +11 -5
- package/dist/vendors/grok/impl/grokMessages.js.map +1 -1
- package/dist/vendors/grok/impl/stripGrokContextImages.d.ts.map +1 -1
- package/dist/vendors/grok/impl/stripGrokContextImages.js +3 -3
- package/dist/vendors/grok/impl/stripGrokContextImages.js.map +1 -1
- package/dist/vendors/grok/impl/toGrokInputContent.d.ts +2 -2
- package/dist/vendors/grok/impl/toGrokInputContent.d.ts.map +1 -1
- package/dist/vendors/grok/impl/toGrokInputContent.js +4 -4
- package/dist/vendors/grok/impl/toGrokInputContent.js.map +1 -1
- package/dist/vendors/grok/impl/toGrokResponseInput.d.ts.map +1 -1
- package/dist/vendors/grok/impl/toGrokResponseInput.js +78 -70
- package/dist/vendors/grok/impl/toGrokResponseInput.js.map +1 -1
- package/package.json +2 -1
- package/dist/core/SessionCacheUsage.d.ts +0 -9
- package/dist/core/SessionCacheUsage.d.ts.map +0 -1
- package/dist/core/SessionCacheUsage.js.map +0 -1
- package/dist/core/addSessionCacheUsage.d.ts +0 -3
- package/dist/core/addSessionCacheUsage.d.ts.map +0 -1
- package/dist/core/addSessionCacheUsage.js.map +0 -1
- package/dist/protocol/responses/toSessionCacheUsage.d.ts +0 -4
- package/dist/protocol/responses/toSessionCacheUsage.d.ts.map +0 -1
- package/dist/protocol/responses/toSessionCacheUsage.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ResponseInputItem, ResponseOutputItem } from "openai/resources/responses/responses.js";
|
|
2
2
|
import type { CodexResponseRequest } from "../../../vendors/codex/impl/CodexResponseRequest.js";
|
|
3
3
|
/** Returns the wire-input suffix reusable with the last response ID, or undefined. */
|
|
4
|
-
export declare function getCodexIncrementalInput(previousRequest: CodexResponseRequest,
|
|
5
|
-
export declare function getCodexIncrementalInput(previousRequest: object,
|
|
4
|
+
export declare function getCodexIncrementalInput(previousRequest: CodexResponseRequest, outputItems: readonly ResponseOutputItem[], currentRequest: CodexResponseRequest): ResponseInputItem[] | undefined;
|
|
5
|
+
export declare function getCodexIncrementalInput(previousRequest: object, outputItems: readonly unknown[], currentRequest: object): unknown[] | undefined;
|
|
6
6
|
//# sourceMappingURL=getCodexIncrementalInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCodexIncrementalInput.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/getCodexIncrementalInput.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,iBAAiB,EACjB,kBAAkB,EACrB,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAEzF,sFAAsF;AACtF,wBAAgB,wBAAwB,CACpC,eAAe,EAAE,oBAAoB,EACrC,
|
|
1
|
+
{"version":3,"file":"getCodexIncrementalInput.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/getCodexIncrementalInput.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,iBAAiB,EACjB,kBAAkB,EACrB,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAEzF,sFAAsF;AACtF,wBAAgB,wBAAwB,CACpC,eAAe,EAAE,oBAAoB,EACrC,WAAW,EAAE,SAAS,kBAAkB,EAAE,EAC1C,cAAc,EAAE,oBAAoB,GACrC,iBAAiB,EAAE,GAAG,SAAS,CAAC;AACnC,wBAAgB,wBAAwB,CACpC,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,SAAS,OAAO,EAAE,EAC/B,cAAc,EAAE,MAAM,GACvB,OAAO,EAAE,GAAG,SAAS,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { codexValuesEqual } from "../../../vendors/codex/impl/codexValuesEqual.js";
|
|
2
2
|
import { codexRequestPropertiesMatch } from "../../../vendors/codex/impl/codexRequestPropertiesMatch.js";
|
|
3
|
-
export function getCodexIncrementalInput(previousRequest,
|
|
3
|
+
export function getCodexIncrementalInput(previousRequest, outputItems, currentRequest) {
|
|
4
4
|
if (!codexRequestPropertiesMatch(previousRequest, currentRequest))
|
|
5
5
|
return undefined;
|
|
6
6
|
const previousValue = Reflect.get(previousRequest, "input");
|
|
7
7
|
const currentValue = Reflect.get(currentRequest, "input");
|
|
8
8
|
const previousInput = Array.isArray(previousValue) ? previousValue : [];
|
|
9
9
|
const currentInput = Array.isArray(currentValue) ? currentValue : [];
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
10
|
+
const reusableOutputItems = outputItems.filter(isResponseInputItem);
|
|
11
|
+
if (reusableOutputItems.length !== outputItems.length)
|
|
12
12
|
return undefined;
|
|
13
|
-
const expectedPrefix = [...previousInput, ...
|
|
13
|
+
const expectedPrefix = [...previousInput, ...reusableOutputItems].map(clearIgnoredMetadata);
|
|
14
14
|
if (currentInput.length < expectedPrefix.length)
|
|
15
15
|
return undefined;
|
|
16
16
|
const actualPrefix = currentInput.slice(0, expectedPrefix.length).map(clearIgnoredMetadata);
|
|
@@ -59,6 +59,17 @@ function clearIgnoredMetadata(value) {
|
|
|
59
59
|
return value;
|
|
60
60
|
const copy = structuredClone(value);
|
|
61
61
|
delete copy.internal_chat_message_metadata_passthrough;
|
|
62
|
+
// Public assistant blocks intentionally omit provider-generated output-item identities.
|
|
63
|
+
// The stateful session still has the original items, so compare their caller-visible
|
|
64
|
+
// semantics and keep stable call_id values as the continuation identity.
|
|
65
|
+
delete copy.id;
|
|
66
|
+
if (copy.type === "message" ||
|
|
67
|
+
copy.type === "function_call" ||
|
|
68
|
+
copy.type === "custom_tool_call") {
|
|
69
|
+
delete copy.status;
|
|
70
|
+
}
|
|
71
|
+
if (copy.type === "message")
|
|
72
|
+
delete copy.phase;
|
|
62
73
|
return copy;
|
|
63
74
|
}
|
|
64
75
|
//# sourceMappingURL=getCodexIncrementalInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCodexIncrementalInput.js","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/getCodexIncrementalInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,qDAAqD,CAAC;AAkBlG,MAAM,UAAU,wBAAwB,CACpC,eAAuB,EACvB,
|
|
1
|
+
{"version":3,"file":"getCodexIncrementalInput.js","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/getCodexIncrementalInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,qDAAqD,CAAC;AAkBlG,MAAM,UAAU,wBAAwB,CACpC,eAAuB,EACvB,WAA+B,EAC/B,cAAsB;IAEtB,IAAI,CAAC,2BAA2B,CAAC,eAAe,EAAE,cAAc,CAAC;QAAE,OAAO,SAAS,CAAC;IACpF,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAC5D,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC1D,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACrE,MAAM,mBAAmB,GAAG,WAAW,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;IACpE,IAAI,mBAAmB,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;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KAAc;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACtF,MAAM,IAAI,GAAG,eAAe,CAAC,KAAK,CAA4B,CAAC;IAC/D,OAAO,IAAI,CAAC,0CAA0C,CAAC;IACvD,wFAAwF;IACxF,qFAAqF;IACrF,yEAAyE;IACzE,OAAO,IAAI,CAAC,EAAE,CAAC;IACf,IACI,IAAI,CAAC,IAAI,KAAK,SAAS;QACvB,IAAI,CAAC,IAAI,KAAK,eAAe;QAC7B,IAAI,CAAC,IAAI,KAAK,kBAAkB,EAClC,CAAC;QACC,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IACD,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC;IAC/C,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function getCodexTurnKey(messages) {
|
|
2
|
-
const lastTurnBoundaryIndex = messages.findLastIndex((message) =>
|
|
2
|
+
const lastTurnBoundaryIndex = messages.findLastIndex((message) => message.role === "user" ||
|
|
3
3
|
(message.role === "agent" && message.agentMessageTriggerTurn === true));
|
|
4
4
|
return JSON.stringify(messages.slice(0, lastTurnBoundaryIndex < 0 ? messages.length : lastTurnBoundaryIndex + 1));
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCodexTurnKey.js","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/getCodexTurnKey.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,eAAe,CAAC,QAAmC;IAC/D,MAAM,qBAAqB,GAAG,QAAQ,CAAC,aAAa,CAChD,CAAC,OAAO,EAAE,EAAE,CACR,
|
|
1
|
+
{"version":3,"file":"getCodexTurnKey.js","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/getCodexTurnKey.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,eAAe,CAAC,QAAmC;IAC/D,MAAM,qBAAqB,GAAG,QAAQ,CAAC,aAAa,CAChD,CAAC,OAAO,EAAE,EAAE,CACR,OAAO,CAAC,IAAI,KAAK,MAAM;QACvB,CAAC,OAAO,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,CAAC,uBAAuB,KAAK,IAAI,CAAC,CAC7E,CAAC;IACF,OAAO,IAAI,CAAC,SAAS,CACjB,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,qBAAqB,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,qBAAqB,GAAG,CAAC,CAAC,CAC7F,CAAC;AACN,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SessionAssistantMessage, SessionToolCallBlock } from "../../../core/SessionContext.js";
|
|
2
2
|
import type { SessionTool } from "../../../core/SessionTool.js";
|
|
3
3
|
export interface CodexToolSearchResult {
|
|
4
4
|
assistantText: string;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
message: SessionAssistantMessage;
|
|
6
|
+
outputItems: readonly string[];
|
|
7
|
+
toolCalls: readonly Omit<SessionToolCallBlock, "type">[];
|
|
7
8
|
}
|
|
8
9
|
export declare function settleCodexToolSearch<T extends CodexToolSearchResult>(result: T, tools: readonly SessionTool[]): {
|
|
9
10
|
result: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settleCodexToolSearch.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/settleCodexToolSearch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"settleCodexToolSearch.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/settleCodexToolSearch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAYzD,MAAM,WAAW,qBAAqB;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,uBAAuB,CAAC;IACjC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,SAAS,EAAE,SAAS,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,EAAE,CAAC;CAC5D;AAED,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,qBAAqB,EACjE,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,SAAS,WAAW,EAAE,GAC9B;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CA4CjC"}
|
|
@@ -10,7 +10,7 @@ export function settleCodexToolSearch(result, tools) {
|
|
|
10
10
|
const searches = result.toolCalls.filter(isClientToolSearchCall);
|
|
11
11
|
if (searches.length === 0)
|
|
12
12
|
return { result, settled: false };
|
|
13
|
-
const deferredTools = tools.filter((tool) => tool.server === undefined && tool.
|
|
13
|
+
const deferredTools = tools.filter((tool) => tool.server === undefined && tool.defer === true);
|
|
14
14
|
const outputs = searches.map((call) => {
|
|
15
15
|
let matched = [];
|
|
16
16
|
try {
|
|
@@ -34,7 +34,19 @@ export function settleCodexToolSearch(result, tools) {
|
|
|
34
34
|
settled: true,
|
|
35
35
|
result: {
|
|
36
36
|
...result,
|
|
37
|
-
|
|
37
|
+
outputItems: [...result.outputItems, ...outputs],
|
|
38
|
+
message: {
|
|
39
|
+
role: "assistant",
|
|
40
|
+
content: [
|
|
41
|
+
...result.message.content,
|
|
42
|
+
...outputs.map((output, index) => ({
|
|
43
|
+
type: "tool_result",
|
|
44
|
+
callId: searches[index].callId,
|
|
45
|
+
content: [],
|
|
46
|
+
vendor: { outputItem: output },
|
|
47
|
+
})),
|
|
48
|
+
],
|
|
49
|
+
},
|
|
38
50
|
toolCalls: result.toolCalls.filter((call) => !isClientToolSearchCall(call)),
|
|
39
51
|
},
|
|
40
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settleCodexToolSearch.js","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/settleCodexToolSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAIhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAExF,MAAM,yBAAyB,GAAG,IAAI,CAAC,MAAM,CACzC;IACI,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACpC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;CACrD,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAClC,CAAC;
|
|
1
|
+
{"version":3,"file":"settleCodexToolSearch.js","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/settleCodexToolSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAIhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAExF,MAAM,yBAAyB,GAAG,IAAI,CAAC,MAAM,CACzC;IACI,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACpC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;C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CAAC,CAAC,CAAC;IACH,OAAO;QACH,OAAO,EAAE,IAAI;QACb,MAAM,EAAE;YACJ,GAAG,MAAM;YACT,WAAW,EAAE,CAAC,GAAG,MAAM,CAAC,WAAW,EAAE,GAAG,OAAO,CAAC;YAChD,OAAO,EAAE;gBACL,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACL,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO;oBACzB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;wBAC/B,IAAI,EAAE,aAAsB;wBAC5B,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAE,CAAC,MAAM;wBAC/B,OAAO,EAAE,EAAE;wBACX,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE;qBACjC,CAAC,CAAC;iBACN;aACJ;YACD,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;SACzE;KACT,CAAC;AACN,CAAC;AAED,SAAS,sBAAsB,CAAC,IAAwC;IACpE,MAAM,MAAM,GACR,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI;QACnD,CAAC,CAAE,IAAI,CAAC,MAAiD;QACzD,CAAC,CAAC,SAAS,CAAC;IACpB,OAAO,MAAM,EAAE,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC,IAAI,KAAK,kBAAkB,CAAC;AAC9E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toCodexToolDefinitions.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/toCodexToolDefinitions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"toCodexToolDefinitions.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/toCodexToolDefinitions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,KAAK,EAAiB,IAAI,EAAE,MAAM,yCAAyC,CAAC;AAkBnF,wBAAgB,sBAAsB,CAClC,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,OAAO,GAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAO,GAC5C,IAAI,EAAE,CAwCR"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { Type } from "@sinclair/typebox";
|
|
2
2
|
import { toJsonSchema } from "../../../vendors/codex/impl/toJsonSchema.js";
|
|
3
3
|
const clientToolSearch = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
provider: "codex",
|
|
7
|
-
type: "tool_search",
|
|
8
|
-
execution: "client",
|
|
9
|
-
},
|
|
4
|
+
type: "tool_search",
|
|
5
|
+
execution: "client",
|
|
10
6
|
description: "# Tool discovery\n\nSearches deferred tools and returns matching definitions for the next model call.\n\nSome tools may not have been provided upfront. Use `tool_search` to discover a relevant deferred tool.",
|
|
11
7
|
parameters: Type.Object({
|
|
12
8
|
limit: Type.Optional(Type.Number({ description: "Maximum number of tools to return. Defaults to 8." })),
|
|
@@ -21,7 +17,7 @@ export function toCodexToolDefinitions(tools, options = {}) {
|
|
|
21
17
|
const output = [];
|
|
22
18
|
const namespaces = new Map();
|
|
23
19
|
for (const tool of tools) {
|
|
24
|
-
if (tool.
|
|
20
|
+
if (tool.defer === true && options.includeDeferred !== true)
|
|
25
21
|
continue;
|
|
26
22
|
const definition = toCodexTool(tool);
|
|
27
23
|
if (tool.namespace === undefined) {
|
|
@@ -46,11 +42,8 @@ export function toCodexToolDefinitions(tools, options = {}) {
|
|
|
46
42
|
}
|
|
47
43
|
namespace.tools.push(definition);
|
|
48
44
|
}
|
|
49
|
-
if (options.includeDeferred !== true &&
|
|
50
|
-
|
|
51
|
-
!tools.some((tool) => tool.vendor?.type ===
|
|
52
|
-
"tool_search")) {
|
|
53
|
-
output.push(toCodexTool(clientToolSearch));
|
|
45
|
+
if (options.includeDeferred !== true && tools.some((tool) => tool.defer === true) && true) {
|
|
46
|
+
output.push(clientToolSearch);
|
|
54
47
|
}
|
|
55
48
|
return output;
|
|
56
49
|
}
|
|
@@ -61,17 +54,6 @@ function toCodexTool(tool) {
|
|
|
61
54
|
if (tool.server !== undefined) {
|
|
62
55
|
return structuredClone(tool.server);
|
|
63
56
|
}
|
|
64
|
-
const vendor = tool.vendor;
|
|
65
|
-
if (vendor?.provider === "codex" &&
|
|
66
|
-
vendor.type === "tool_search" &&
|
|
67
|
-
vendor.execution === "client") {
|
|
68
|
-
return {
|
|
69
|
-
type: "tool_search",
|
|
70
|
-
execution: "client",
|
|
71
|
-
...(tool.description === undefined ? {} : { description: tool.description }),
|
|
72
|
-
...(tool.parameters === undefined ? {} : { parameters: toJsonSchema(tool.parameters) }),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
57
|
if (tool.grammar !== undefined) {
|
|
76
58
|
return {
|
|
77
59
|
type: "custom",
|
|
@@ -85,10 +67,7 @@ function toCodexTool(tool) {
|
|
|
85
67
|
name: tool.name,
|
|
86
68
|
...(tool.description === undefined ? {} : { description: tool.description }),
|
|
87
69
|
strict: false,
|
|
88
|
-
...(tool.
|
|
89
|
-
(vendor?.provider === "codex" && vendor.type === "function" && vendor.deferLoading === true)
|
|
90
|
-
? { defer_loading: true }
|
|
91
|
-
: {}),
|
|
70
|
+
...(tool.defer === true ? { defer_loading: true } : {}),
|
|
92
71
|
parameters: tool.parameters === undefined ? null : toJsonSchema(tool.parameters),
|
|
93
72
|
};
|
|
94
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toCodexToolDefinitions.js","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/toCodexToolDefinitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"toCodexToolDefinitions.js","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/toCodexToolDefinitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAGpE,MAAM,gBAAgB,GAAG;IACrB,IAAI,EAAE,aAAa;IACnB,SAAS,EAAE,QAAQ;IACnB,WAAW,EACP,iNAAiN;IACrN,UAAU,EAAE,IAAI,CAAC,MAAM,CACnB;QACI,KAAK,EAAE,IAAI,CAAC,QAAQ,CAChB,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,mDAAmD,EAAE,CAAC,CACpF;QACD,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;KAC1E,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAClC;CACoB,CAAC;AAE1B,MAAM,UAAU,sBAAsB,CAClC,KAA6B,EAC7B,OAAO,GAAkC,EAAE;IAE3C,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAAC;QACxC,CAAC,WAAW,EAAE,mCAAmC,CAAC;QAClD,CAAC,eAAe,EAAE,6CAA6C,CAAC;KACnE,CAAC,CAAC;IACH,MAAM,MAAM,GAAW,EAAE,CAAC;IAC1B,MAAM,UAAU,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEpD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,CAAC,eAAe,KAAK,IAAI;YAAE,SAAS;QACtE,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAC/B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACxB,SAAS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,EAAE,MAAM,wBAAwB,CAAC;AAG3D,wBAAgB,eAAe,CAC3B,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,KAAK,EAAE,MAAM,GACd,cAAc,
|
|
1
|
+
{"version":3,"file":"withCodexSkills.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/withCodexSkills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D,wBAAgB,eAAe,CAC3B,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,KAAK,EAAE,MAAM,GACd,cAAc,CAoBhB"}
|
|
@@ -4,24 +4,20 @@ export function withCodexSkills(context, skills, model) {
|
|
|
4
4
|
if (prompt === undefined)
|
|
5
5
|
return context;
|
|
6
6
|
const messages = context.messages.map((message) => message.role === "system"
|
|
7
|
-
? {
|
|
8
|
-
|
|
9
|
-
content: typeof message.content === "string"
|
|
10
|
-
? [message.content]
|
|
11
|
-
: [...message.content],
|
|
12
|
-
}
|
|
13
|
-
: message);
|
|
7
|
+
? { ...message, content: [...message.content] }
|
|
8
|
+
: structuredClone(message));
|
|
14
9
|
const target = messages.find((message) => message.role === "system" &&
|
|
15
|
-
message.content.some((part) => part.startsWith("<apps_instructions>")));
|
|
10
|
+
message.content.some((part) => part.text.startsWith("<apps_instructions>")));
|
|
16
11
|
if (target === undefined) {
|
|
17
12
|
const firstSystemMessage = messages.find((message) => message.role === "system");
|
|
18
|
-
if (firstSystemMessage?.role === "system")
|
|
19
|
-
firstSystemMessage.content.push(prompt);
|
|
13
|
+
if (firstSystemMessage?.role === "system") {
|
|
14
|
+
firstSystemMessage.content.push({ type: "text", text: prompt });
|
|
15
|
+
}
|
|
20
16
|
else
|
|
21
|
-
messages.unshift({ role: "system", content: [prompt] });
|
|
17
|
+
messages.unshift({ role: "system", content: [{ type: "text", text: prompt }] });
|
|
22
18
|
}
|
|
23
19
|
else if (target.role === "system")
|
|
24
|
-
target.content.push(prompt);
|
|
20
|
+
target.content.push({ type: "text", text: prompt });
|
|
25
21
|
return { ...context, messages };
|
|
26
22
|
}
|
|
27
23
|
//# sourceMappingURL=withCodexSkills.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withCodexSkills.js","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/withCodexSkills.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAE1F,MAAM,UAAU,eAAe,CAC3B,OAAuB,EACvB,MAA+B,EAC/B,KAAa;IAEb,MAAM,MAAM,GAAG,uBAAuB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC;IACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAC9C,OAAO,CAAC,IAAI,KAAK,QAAQ;QACrB,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"withCodexSkills.js","sourceRoot":"","sources":["../../../../sources/vendors/codex/impl/withCodexSkills.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAE1F,MAAM,UAAU,eAAe,CAC3B,OAAuB,EACvB,MAA+B,EAC/B,KAAa;IAEb,MAAM,MAAM,GAAG,uBAAuB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC;IACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAC9C,OAAO,CAAC,IAAI,KAAK,QAAQ;QACrB,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,O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|
-
readonly type: "tool_search";
|
|
6
|
-
readonly execution: "client";
|
|
7
|
-
};
|
|
8
3
|
readonly description: "# Tool discovery\n\nSearches over deferred tool metadata with BM25 and exposes matching tools for the next model call.\n\nYou have access to tools from the following sources:\n- AllTrails: Enables discovery and exploration of outdoor trails (hiking, running, biking, backpacking, etc.) by searching near a point, within a geographic bounding box, near the user, or by trail name, with rich filters for conditions, difficulty, and suitability. Provides detailed trail information and a 7-day trailhead weather forecast for specific trails.\n- Apple Music: Searches the Apple Music catalog for specific artists, albums, songs, and playlists, and returns canonical catalog objects suitable for navigation or display. Also enriches model-generated song lists by batch-matching them to Apple Music tracks, adding official metadata and playable links for draft playlists or curated song collections.\n- Bee Production\n- Codex Document Control: Use Codex Document Control to find connected document sessions, inspect the tools supported by a selected session, and execute one supported tool against that session. Call `list_document_sessions` first to choose the intended connected session, call `get_document_tool_schemas` before constructing tool arguments, then call `execute_document_command` with a caller-stable `idempotency_key`. Use this only for connected Codex document control; do not use it for general spreadsheet, presentation, or document tasks without a connected document session.\n- GitHub: Access repositories, issues, and pull requests. Required for some features such as Codex\n- Happy List\n- Hotline: Look up local hotline information for the user based on country inferred from the conversation. You must use this tool before providing helpline information; do not guess.\n- Multi-agent tools: Spawn and manage sub-agents.\n- Plugin Management: Plugin Management: uninstall: uninstall_app; install/connect: api_tool.search_plugins then api_tool.suggest_installs. Codex uninstall: plugin_management.uninstall_plugin; install: request_plugin_install. Use Plugin Management, not named plugin tools, for permissions/removal/deps. Clarify ambiguity with exact IDs. Route named-plugin access questions and approval-label requests (Always ask, Any changes, Important actions, Never ask, Use my default), even without permission wording. Call the matching tool for clear targets/modes or global/default changes. Ask without calling for missing/broad targets (Google), vague/conflicting modes, risky removal, or delegated choice. Disable is unsupported; explain without calling. Exclude how-to/undo, OAuth/admin scopes, npm/Chrome/code plugins, and ordinary use. Complete all actions; report only confirmed results.\n- Sites: Use Sites to build, save, deploy, and inspect websites such as landing pages, portfolios, dashboards, portals, trackers, hubs, games, and internal tools. Always use Sites when .openai/hosting.json exists. Use Sites skills for local implementation, validation, source preparation, and artifact packaging. Use this connector for site creation, runtime environment variables, versions, production deployments, and access controls. Read .openai/hosting.json before creating a site and reuse its project_id when present. Treat Sites IDs and cursors as opaque: copy them exactly from .openai/hosting.json or Sites responses as applicable, and never invent, reformat, derive, or substitute them. Never call create_site more than once for the same local site. Push the exact source state before saving a version. commit_sha must identify that pushed state, and any archive must be built from it. Deploy only saved versions; every Sites deployment URL is production. Inspect deployment status when the initial result is non-terminal or the user asks for progress. Unless the user asks for local-only work or a saved version without deployment, finish deployable site work with a production deployment.\nSome of the tools may not have been provided to you upfront, and you should use this tool (`tool_search`) to search for the required tools. For MCP tool discovery, always use `tool_search` instead of `list_mcp_resources` or `list_mcp_resource_templates`.";
|
|
9
4
|
readonly parameters: import("@sinclair/typebox").TObject<{
|
|
10
5
|
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
11
6
|
query: import("@sinclair/typebox").TString;
|
|
12
7
|
}>;
|
|
8
|
+
readonly server: {
|
|
9
|
+
readonly type: "tool_search";
|
|
10
|
+
readonly execution: "client";
|
|
11
|
+
readonly description: "# Tool discovery\n\nSearches over deferred tool metadata with BM25 and exposes matching tools for the next model call.\n\nYou have access to tools from the following sources:\n- AllTrails: Enables discovery and exploration of outdoor trails (hiking, running, biking, backpacking, etc.) by searching near a point, within a geographic bounding box, near the user, or by trail name, with rich filters for conditions, difficulty, and suitability. Provides detailed trail information and a 7-day trailhead weather forecast for specific trails.\n- Apple Music: Searches the Apple Music catalog for specific artists, albums, songs, and playlists, and returns canonical catalog objects suitable for navigation or display. Also enriches model-generated song lists by batch-matching them to Apple Music tracks, adding official metadata and playable links for draft playlists or curated song collections.\n- Bee Production\n- Codex Document Control: Use Codex Document Control to find connected document sessions, inspect the tools supported by a selected session, and execute one supported tool against that session. Call `list_document_sessions` first to choose the intended connected session, call `get_document_tool_schemas` before constructing tool arguments, then call `execute_document_command` with a caller-stable `idempotency_key`. Use this only for connected Codex document control; do not use it for general spreadsheet, presentation, or document tasks without a connected document session.\n- GitHub: Access repositories, issues, and pull requests. Required for some features such as Codex\n- Happy List\n- Hotline: Look up local hotline information for the user based on country inferred from the conversation. You must use this tool before providing helpline information; do not guess.\n- Multi-agent tools: Spawn and manage sub-agents.\n- Plugin Management: Plugin Management: uninstall: uninstall_app; install/connect: api_tool.search_plugins then api_tool.suggest_installs. Codex uninstall: plugin_management.uninstall_plugin; install: request_plugin_install. Use Plugin Management, not named plugin tools, for permissions/removal/deps. Clarify ambiguity with exact IDs. Route named-plugin access questions and approval-label requests (Always ask, Any changes, Important actions, Never ask, Use my default), even without permission wording. Call the matching tool for clear targets/modes or global/default changes. Ask without calling for missing/broad targets (Google), vague/conflicting modes, risky removal, or delegated choice. Disable is unsupported; explain without calling. Exclude how-to/undo, OAuth/admin scopes, npm/Chrome/code plugins, and ordinary use. Complete all actions; report only confirmed results.\n- Sites: Use Sites to build, save, deploy, and inspect websites such as landing pages, portfolios, dashboards, portals, trackers, hubs, games, and internal tools. Always use Sites when .openai/hosting.json exists. Use Sites skills for local implementation, validation, source preparation, and artifact packaging. Use this connector for site creation, runtime environment variables, versions, production deployments, and access controls. Read .openai/hosting.json before creating a site and reuse its project_id when present. Treat Sites IDs and cursors as opaque: copy them exactly from .openai/hosting.json or Sites responses as applicable, and never invent, reformat, derive, or substitute them. Never call create_site more than once for the same local site. Push the exact source state before saving a version. commit_sha must identify that pushed state, and any archive must be built from it. Deploy only saved versions; every Sites deployment URL is production. Inspect deployment status when the initial result is non-terminal or the user asks for progress. Unless the user asks for local-only work or a saved version without deployment, finish deployable site work with a production deployment.\nSome of the tools may not have been provided to you upfront, and you should use this tool (`tool_search`) to search for the required tools. For MCP tool discovery, always use `tool_search` instead of `list_mcp_resources` or `list_mcp_resource_templates`.";
|
|
12
|
+
readonly parameters: import("@sinclair/typebox").TObject<{
|
|
13
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
14
|
+
query: import("@sinclair/typebox").TString;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
13
17
|
};
|
|
14
18
|
//# sourceMappingURL=tool_search.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool_search.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/codex/tools/tool_search.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool_search.d.ts","sourceRoot":"","sources":["../../../../sources/vendors/codex/tools/tool_search.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,WAAW;mBACd,aAAa;;;;;;;uBAGH,aAAa;4BAAa,QAAQ;;;;;;;CACtB,CAAC"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { Type } from "@sinclair/typebox";
|
|
2
|
+
const description = "# Tool discovery\n\nSearches over deferred tool metadata with BM25 and exposes matching tools for the next model call.\n\nYou have access to tools from the following sources:\n- AllTrails: Enables discovery and exploration of outdoor trails (hiking, running, biking, backpacking, etc.) by searching near a point, within a geographic bounding box, near the user, or by trail name, with rich filters for conditions, difficulty, and suitability. Provides detailed trail information and a 7-day trailhead weather forecast for specific trails.\n- Apple Music: Searches the Apple Music catalog for specific artists, albums, songs, and playlists, and returns canonical catalog objects suitable for navigation or display. Also enriches model-generated song lists by batch-matching them to Apple Music tracks, adding official metadata and playable links for draft playlists or curated song collections.\n- Bee Production\n- Codex Document Control: Use Codex Document Control to find connected document sessions, inspect the tools supported by a selected session, and execute one supported tool against that session. Call `list_document_sessions` first to choose the intended connected session, call `get_document_tool_schemas` before constructing tool arguments, then call `execute_document_command` with a caller-stable `idempotency_key`. Use this only for connected Codex document control; do not use it for general spreadsheet, presentation, or document tasks without a connected document session.\n- GitHub: Access repositories, issues, and pull requests. Required for some features such as Codex\n- Happy List\n- Hotline: Look up local hotline information for the user based on country inferred from the conversation. You must use this tool before providing helpline information; do not guess.\n- Multi-agent tools: Spawn and manage sub-agents.\n- Plugin Management: Plugin Management: uninstall: uninstall_app; install/connect: api_tool.search_plugins then api_tool.suggest_installs. Codex uninstall: plugin_management.uninstall_plugin; install: request_plugin_install. Use Plugin Management, not named plugin tools, for permissions/removal/deps. Clarify ambiguity with exact IDs. Route named-plugin access questions and approval-label requests (Always ask, Any changes, Important actions, Never ask, Use my default), even without permission wording. Call the matching tool for clear targets/modes or global/default changes. Ask without calling for missing/broad targets (Google), vague/conflicting modes, risky removal, or delegated choice. Disable is unsupported; explain without calling. Exclude how-to/undo, OAuth/admin scopes, npm/Chrome/code plugins, and ordinary use. Complete all actions; report only confirmed results.\n- Sites: Use Sites to build, save, deploy, and inspect websites such as landing pages, portfolios, dashboards, portals, trackers, hubs, games, and internal tools. Always use Sites when .openai/hosting.json exists. Use Sites skills for local implementation, validation, source preparation, and artifact packaging. Use this connector for site creation, runtime environment variables, versions, production deployments, and access controls. Read .openai/hosting.json before creating a site and reuse its project_id when present. Treat Sites IDs and cursors as opaque: copy them exactly from .openai/hosting.json or Sites responses as applicable, and never invent, reformat, derive, or substitute them. Never call create_site more than once for the same local site. Push the exact source state before saving a version. commit_sha must identify that pushed state, and any archive must be built from it. Deploy only saved versions; every Sites deployment URL is production. Inspect deployment status when the initial result is non-terminal or the user asks for progress. Unless the user asks for local-only work or a saved version without deployment, finish deployable site work with a production deployment.\nSome of the tools may not have been provided to you upfront, and you should use this tool (`tool_search`) to search for the required tools. For MCP tool discovery, always use `tool_search` instead of `list_mcp_resources` or `list_mcp_resource_templates`.";
|
|
3
|
+
const parameters = Type.Object({
|
|
4
|
+
limit: Type.Optional(Type.Number({ description: "Maximum number of tools to return. Defaults to 8." })),
|
|
5
|
+
query: Type.String({ description: "Search query for deferred tools." }),
|
|
6
|
+
}, { additionalProperties: false });
|
|
2
7
|
export const tool_search = {
|
|
3
8
|
name: "tool_search",
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
execution: "client",
|
|
8
|
-
},
|
|
9
|
-
description: "# Tool discovery\n\nSearches over deferred tool metadata with BM25 and exposes matching tools for the next model call.\n\nYou have access to tools from the following sources:\n- AllTrails: Enables discovery and exploration of outdoor trails (hiking, running, biking, backpacking, etc.) by searching near a point, within a geographic bounding box, near the user, or by trail name, with rich filters for conditions, difficulty, and suitability. Provides detailed trail information and a 7-day trailhead weather forecast for specific trails.\n- Apple Music: Searches the Apple Music catalog for specific artists, albums, songs, and playlists, and returns canonical catalog objects suitable for navigation or display. Also enriches model-generated song lists by batch-matching them to Apple Music tracks, adding official metadata and playable links for draft playlists or curated song collections.\n- Bee Production\n- Codex Document Control: Use Codex Document Control to find connected document sessions, inspect the tools supported by a selected session, and execute one supported tool against that session. Call `list_document_sessions` first to choose the intended connected session, call `get_document_tool_schemas` before constructing tool arguments, then call `execute_document_command` with a caller-stable `idempotency_key`. Use this only for connected Codex document control; do not use it for general spreadsheet, presentation, or document tasks without a connected document session.\n- GitHub: Access repositories, issues, and pull requests. Required for some features such as Codex\n- Happy List\n- Hotline: Look up local hotline information for the user based on country inferred from the conversation. You must use this tool before providing helpline information; do not guess.\n- Multi-agent tools: Spawn and manage sub-agents.\n- Plugin Management: Plugin Management: uninstall: uninstall_app; install/connect: api_tool.search_plugins then api_tool.suggest_installs. Codex uninstall: plugin_management.uninstall_plugin; install: request_plugin_install. Use Plugin Management, not named plugin tools, for permissions/removal/deps. Clarify ambiguity with exact IDs. Route named-plugin access questions and approval-label requests (Always ask, Any changes, Important actions, Never ask, Use my default), even without permission wording. Call the matching tool for clear targets/modes or global/default changes. Ask without calling for missing/broad targets (Google), vague/conflicting modes, risky removal, or delegated choice. Disable is unsupported; explain without calling. Exclude how-to/undo, OAuth/admin scopes, npm/Chrome/code plugins, and ordinary use. Complete all actions; report only confirmed results.\n- Sites: Use Sites to build, save, deploy, and inspect websites such as landing pages, portfolios, dashboards, portals, trackers, hubs, games, and internal tools. Always use Sites when .openai/hosting.json exists. Use Sites skills for local implementation, validation, source preparation, and artifact packaging. Use this connector for site creation, runtime environment variables, versions, production deployments, and access controls. Read .openai/hosting.json before creating a site and reuse its project_id when present. Treat Sites IDs and cursors as opaque: copy them exactly from .openai/hosting.json or Sites responses as applicable, and never invent, reformat, derive, or substitute them. Never call create_site more than once for the same local site. Push the exact source state before saving a version. commit_sha must identify that pushed state, and any archive must be built from it. Deploy only saved versions; every Sites deployment URL is production. Inspect deployment status when the initial result is non-terminal or the user asks for progress. Unless the user asks for local-only work or a saved version without deployment, finish deployable site work with a production deployment.\nSome of the tools may not have been provided to you upfront, and you should use this tool (`tool_search`) to search for the required tools. For MCP tool discovery, always use `tool_search` instead of `list_mcp_resources` or `list_mcp_resource_templates`.",
|
|
10
|
-
parameters: Type.Object({
|
|
11
|
-
limit: Type.Optional(Type.Number({ description: "Maximum number of tools to return. Defaults to 8." })),
|
|
12
|
-
query: Type.String({ description: "Search query for deferred tools." }),
|
|
13
|
-
}, { additionalProperties: false }),
|
|
9
|
+
description,
|
|
10
|
+
parameters,
|
|
11
|
+
server: { type: "tool_search", execution: "client", description, parameters },
|
|
14
12
|
};
|
|
15
13
|
//# sourceMappingURL=tool_search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool_search.js","sourceRoot":"","sources":["../../../../sources/vendors/codex/tools/tool_search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"tool_search.js","sourceRoot":"","sources":["../../../../sources/vendors/codex/tools/tool_search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIzC,MAAM,WAAW,GACb,ylIAAylI,CAAC;AAE9lI,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAC1B;IACI,KAAK,EAAE,IAAI,CAAC,QAAQ,CAChB,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,mDAAmD,EAAE,CAAC,CACpF;IACD,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;CAC1E,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAClC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,IAAI,EAAE,aAAa;IACnB,WAAW;IACX,UAAU;IACV,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE;CACjD,CAAC"}
|
|
@@ -6,6 +6,7 @@ import type { SessionRunRequest } from "../../core/SessionRunRequest.js";
|
|
|
6
6
|
import type { SessionOptions } from "../../core/SessionOptions.js";
|
|
7
7
|
import type { SessionTool } from "../../core/SessionTool.js";
|
|
8
8
|
import type { GrokCredential } from "../../vendors/VendorCredential.js";
|
|
9
|
+
import type { Context } from "@steve.kite/stdlib";
|
|
9
10
|
export interface GrokSessionOptions extends SessionOptions, InferenceRetryOptions {
|
|
10
11
|
credential: GrokCredential;
|
|
11
12
|
endpoint: string;
|
|
@@ -27,8 +28,8 @@ export declare class GrokSession extends BaseSession {
|
|
|
27
28
|
private readonly resolveInferenceMaxRetries;
|
|
28
29
|
private readonly emptyResponseRetryWait;
|
|
29
30
|
constructor(id: string, options: GrokSessionOptions);
|
|
30
|
-
run(request: SessionRunRequest): SessionStream;
|
|
31
|
-
compact(options
|
|
31
|
+
run(ctx: Context, request: SessionRunRequest): SessionStream;
|
|
32
|
+
compact(ctx: Context, options: SessionCompactionOptions): Promise<SessionCompaction>;
|
|
32
33
|
destroy(): void;
|
|
33
34
|
private streamRun;
|
|
34
35
|
private runCompactionAttempt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrokSession.d.ts","sourceRoot":"","sources":["../../../sources/vendors/grok/GrokSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAEH,KAAK,qBAAqB,EAC7B,MAAM,kCAAkC,CAAC;AAO1C,OAAO,KAAK,EAAE,iBAAi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E,cAAc,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IAEvC,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAiB;IAC5C,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAEpB;IAChB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqB;IAC/C,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAe;IAC1D,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAErC;IAEF,YAAY,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAuBlD;IAED,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,GAAG,aAAa,CAE3D;IAEK,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAuIzF;IAED,OAAO,IAAI,IAAI,CAEd;YAEc,SAAS;YAqFV,oBAAoB;YAiEnB,eAAe;IAkJ9B,0FAA0F;YAC5E,2BAA2B;CAK5C"}
|
|
@@ -60,20 +60,15 @@ export class GrokSession extends BaseSession {
|
|
|
60
60
|
...(this.userAgent === undefined ? {} : { userAgent: this.userAgent }),
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
run(request) {
|
|
64
|
-
return this.streamRun(request);
|
|
63
|
+
run(ctx, request) {
|
|
64
|
+
return this.streamRun(ctx, request);
|
|
65
65
|
}
|
|
66
|
-
async compact(options
|
|
67
|
-
const
|
|
68
|
-
const context =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
: {
|
|
74
|
-
instructions: this.context.instructions,
|
|
75
|
-
messages: [...options.context.messages],
|
|
76
|
-
};
|
|
66
|
+
async compact(ctx, options) {
|
|
67
|
+
const signal = ctx.lifetime;
|
|
68
|
+
const context = {
|
|
69
|
+
instructions: options.context.instructions,
|
|
70
|
+
messages: [...options.context.messages],
|
|
71
|
+
};
|
|
77
72
|
if (signal?.aborted) {
|
|
78
73
|
return { status: "cancelled", context };
|
|
79
74
|
}
|
|
@@ -84,7 +79,6 @@ export class GrokSession extends BaseSession {
|
|
|
84
79
|
status: "failed",
|
|
85
80
|
kind: "inference_error",
|
|
86
81
|
message: "A model is required for Grok compaction.",
|
|
87
|
-
context,
|
|
88
82
|
};
|
|
89
83
|
}
|
|
90
84
|
this.activeModel = model;
|
|
@@ -101,7 +95,9 @@ export class GrokSession extends BaseSession {
|
|
|
101
95
|
...configured.context.messages,
|
|
102
96
|
{
|
|
103
97
|
role: "user",
|
|
104
|
-
content:
|
|
98
|
+
content: [
|
|
99
|
+
{ type: "text", text: createGrokCompactionPrompt(options.instructions) },
|
|
100
|
+
],
|
|
105
101
|
},
|
|
106
102
|
],
|
|
107
103
|
};
|
|
@@ -122,7 +118,6 @@ export class GrokSession extends BaseSession {
|
|
|
122
118
|
status: "failed",
|
|
123
119
|
kind: "inference_error",
|
|
124
120
|
message: result.message,
|
|
125
|
-
context,
|
|
126
121
|
};
|
|
127
122
|
}
|
|
128
123
|
const invalidKind = result.emittedToolCall
|
|
@@ -147,7 +142,6 @@ export class GrokSession extends BaseSession {
|
|
|
147
142
|
message: lastInvalidKind === "tool_call"
|
|
148
143
|
? "Grok emitted tool calls in three compaction attempts."
|
|
149
144
|
: "Grok returned three compaction summaries shorter than 500 characters.",
|
|
150
|
-
context,
|
|
151
145
|
};
|
|
152
146
|
}
|
|
153
147
|
const { rawSummary, encryptedReasoning, usage } = completedAttempt;
|
|
@@ -156,7 +150,6 @@ export class GrokSession extends BaseSession {
|
|
|
156
150
|
status: "failed",
|
|
157
151
|
kind: "inference_error",
|
|
158
152
|
message: "Grok completed compaction without reporting token usage.",
|
|
159
|
-
context,
|
|
160
153
|
};
|
|
161
154
|
}
|
|
162
155
|
const summary = formatGrokCompactionSummary(rawSummary);
|
|
@@ -166,7 +159,12 @@ export class GrokSession extends BaseSession {
|
|
|
166
159
|
const query = latestUserMessage && extractGrokUserQuery(latestUserMessage);
|
|
167
160
|
const preservedQuery = query === undefined
|
|
168
161
|
? []
|
|
169
|
-
: [
|
|
162
|
+
: [
|
|
163
|
+
{
|
|
164
|
+
role: "user",
|
|
165
|
+
content: [{ type: "text", text: wrapGrokUserQuery(query) }],
|
|
166
|
+
},
|
|
167
|
+
];
|
|
170
168
|
const preservedMessages = [
|
|
171
169
|
...userInfo,
|
|
172
170
|
...projectInstructions,
|
|
@@ -179,7 +177,7 @@ export class GrokSession extends BaseSession {
|
|
|
179
177
|
...preservedMessages,
|
|
180
178
|
{
|
|
181
179
|
role: "user",
|
|
182
|
-
content: createGrokCompactionContinuation(rawSummary),
|
|
180
|
+
content: [{ type: "text", text: createGrokCompactionContinuation(rawSummary) }],
|
|
183
181
|
},
|
|
184
182
|
...stateReminders,
|
|
185
183
|
],
|
|
@@ -196,8 +194,8 @@ export class GrokSession extends BaseSession {
|
|
|
196
194
|
destroy() {
|
|
197
195
|
this.connection.close();
|
|
198
196
|
}
|
|
199
|
-
async *streamRun(request) {
|
|
200
|
-
const
|
|
197
|
+
async *streamRun(ctx, request) {
|
|
198
|
+
const abort = ctx.lifetime;
|
|
201
199
|
const previousUserQueries = countGrokUserQueries(this.context.messages);
|
|
202
200
|
const messages = [...request.context.messages];
|
|
203
201
|
const nextUserQueries = countGrokUserQueries(messages);
|
|
@@ -205,7 +203,7 @@ export class GrokSession extends BaseSession {
|
|
|
205
203
|
this.turnIndex += nextUserQueries - previousUserQueries;
|
|
206
204
|
}
|
|
207
205
|
this.context = {
|
|
208
|
-
instructions: this.context.instructions,
|
|
206
|
+
instructions: request.context.instructions ?? this.context.instructions,
|
|
209
207
|
messages,
|
|
210
208
|
};
|
|
211
209
|
const context = this.context;
|
|
@@ -271,32 +269,12 @@ export class GrokSession extends BaseSession {
|
|
|
271
269
|
yield terminal;
|
|
272
270
|
return;
|
|
273
271
|
}
|
|
274
|
-
if (result !== undefined &&
|
|
275
|
-
(result.assistantText.length > 0 ||
|
|
276
|
-
result.encryptedReasoning !== undefined ||
|
|
277
|
-
result.toolCalls.length > 0 ||
|
|
278
|
-
result.responseItems.length > 0)) {
|
|
272
|
+
if (result !== undefined && result.message.content.length > 0) {
|
|
279
273
|
this.context = {
|
|
280
274
|
instructions: this.context.instructions,
|
|
281
|
-
messages: [
|
|
282
|
-
...this.context.messages,
|
|
283
|
-
{
|
|
284
|
-
role: "assistant",
|
|
285
|
-
content: result.assistantText,
|
|
286
|
-
...(result.encryptedReasoning === undefined
|
|
287
|
-
? {}
|
|
288
|
-
: { encryptedReasoning: result.encryptedReasoning }),
|
|
289
|
-
...(result.toolCalls.length === 0 ? {} : { toolCalls: result.toolCalls }),
|
|
290
|
-
...(result.responseItems.length === 0
|
|
291
|
-
? {}
|
|
292
|
-
: { responseItems: result.responseItems }),
|
|
293
|
-
},
|
|
294
|
-
],
|
|
275
|
+
messages: [...this.context.messages, result.message],
|
|
295
276
|
};
|
|
296
277
|
}
|
|
297
|
-
if (result !== undefined && result.responseItems.length > 0) {
|
|
298
|
-
yield { type: "response_items", items: result.responseItems };
|
|
299
|
-
}
|
|
300
278
|
if (blockOpen)
|
|
301
279
|
yield { type: "block_stop" };
|
|
302
280
|
if (terminal !== undefined)
|
|
@@ -335,8 +313,8 @@ export class GrokSession extends BaseSession {
|
|
|
335
313
|
event.type === "toolcall_end") {
|
|
336
314
|
emittedToolCall = true;
|
|
337
315
|
}
|
|
338
|
-
if (event.type === "
|
|
339
|
-
encryptedReasoning = event.
|
|
316
|
+
if (event.type === "reasoning_end")
|
|
317
|
+
encryptedReasoning = event.reasoning;
|
|
340
318
|
if (event.type === "token_usage")
|
|
341
319
|
usage = event.usage;
|
|
342
320
|
if (isSessionErrorDone(event)) {
|
|
@@ -407,7 +385,7 @@ export class GrokSession extends BaseSession {
|
|
|
407
385
|
}
|
|
408
386
|
if (event.type === "text_delta" ||
|
|
409
387
|
event.type === "reasoning_delta" ||
|
|
410
|
-
event.type === "
|
|
388
|
+
event.type === "reasoning_end" ||
|
|
411
389
|
event.type === "toolcall_start" ||
|
|
412
390
|
event.type === "toolcall_delta" ||
|
|
413
391
|
event.type === "toolcall_end") {
|