@codelia/core 0.1.80 → 0.1.81
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.cjs +57 -18
- package/dist/index.d.ts +8 -1
- package/dist/index.js +56 -18
- package/package.json +3 -3
- package/prompts/AGENTS.md +1 -0
- package/prompts/system.md +10 -0
package/dist/index.cjs
CHANGED
|
@@ -49,6 +49,7 @@ __export(index_exports, {
|
|
|
49
49
|
ProviderFailureError: () => ProviderFailureError,
|
|
50
50
|
TaskComplete: () => TaskComplete,
|
|
51
51
|
ToolOutputCacheService: () => ToolOutputCacheService,
|
|
52
|
+
ToolPermissionDenied: () => ToolPermissionDenied,
|
|
52
53
|
XAI_DEFAULT_MODEL: () => XAI_DEFAULT_MODEL,
|
|
53
54
|
XAI_DEFAULT_REASONING_EFFORT: () => XAI_DEFAULT_REASONING_EFFORT,
|
|
54
55
|
XAI_MODELS: () => XAI_MODELS,
|
|
@@ -96,6 +97,14 @@ var buildGpt56Model = (id) => ({
|
|
|
96
97
|
supportsFast: true
|
|
97
98
|
});
|
|
98
99
|
var OPENAI_MODELS = [
|
|
100
|
+
{
|
|
101
|
+
id: "gpt-6-astra",
|
|
102
|
+
provider: "openai",
|
|
103
|
+
contextWindow: 105e4,
|
|
104
|
+
maxInputTokens: 27e4,
|
|
105
|
+
maxOutputTokens: 128e3,
|
|
106
|
+
supportsFast: true
|
|
107
|
+
},
|
|
99
108
|
...GPT_5_6_PROVIDER_MODELS.map(buildGpt56Model),
|
|
100
109
|
{
|
|
101
110
|
id: "gpt-5.5",
|
|
@@ -362,6 +371,10 @@ var MessageHistoryAdapter = class {
|
|
|
362
371
|
}
|
|
363
372
|
};
|
|
364
373
|
|
|
374
|
+
// src/llm/openai/history.ts
|
|
375
|
+
var ResponsesHistoryAdapter = class extends MessageHistoryAdapter {
|
|
376
|
+
};
|
|
377
|
+
|
|
365
378
|
// src/llm/failures.ts
|
|
366
379
|
var ProviderFailureError = class extends Error {
|
|
367
380
|
failure;
|
|
@@ -785,10 +798,6 @@ async function* invokeWithRetry({
|
|
|
785
798
|
}
|
|
786
799
|
}
|
|
787
800
|
|
|
788
|
-
// src/llm/openai/history.ts
|
|
789
|
-
var ResponsesHistoryAdapter = class extends MessageHistoryAdapter {
|
|
790
|
-
};
|
|
791
|
-
|
|
792
801
|
// src/models/anthropic.ts
|
|
793
802
|
var ANTHROPIC_DEFAULT_MODEL = "claude-sonnet-4-5";
|
|
794
803
|
var ANTHROPIC_MODELS = [
|
|
@@ -1863,6 +1872,16 @@ var TaskComplete = class extends Error {
|
|
|
1863
1872
|
}
|
|
1864
1873
|
};
|
|
1865
1874
|
|
|
1875
|
+
// src/types/permissions.ts
|
|
1876
|
+
var ToolPermissionDenied = class extends Error {
|
|
1877
|
+
constructor(decision) {
|
|
1878
|
+
super(`Permission denied${decision.reason ? `: ${decision.reason}` : ""}`);
|
|
1879
|
+
this.decision = decision;
|
|
1880
|
+
this.name = "ToolPermissionDenied";
|
|
1881
|
+
}
|
|
1882
|
+
decision;
|
|
1883
|
+
};
|
|
1884
|
+
|
|
1866
1885
|
// src/agent/tool-execution.ts
|
|
1867
1886
|
var toolResultToContent = (result) => {
|
|
1868
1887
|
if (result.type === "text") return result.text;
|
|
@@ -1891,6 +1910,23 @@ var createToolContext = (signal) => {
|
|
|
1891
1910
|
now: () => /* @__PURE__ */ new Date()
|
|
1892
1911
|
};
|
|
1893
1912
|
};
|
|
1913
|
+
var permissionDeniedResult = (toolCall, decision) => {
|
|
1914
|
+
const toolName = toolCall.function.name;
|
|
1915
|
+
const deniedContent = `Permission denied${decision.reason ? `: ${decision.reason}` : ""}`;
|
|
1916
|
+
return {
|
|
1917
|
+
message: {
|
|
1918
|
+
role: "tool",
|
|
1919
|
+
tool_call_id: toolCall.id,
|
|
1920
|
+
tool_name: toolName,
|
|
1921
|
+
content: deniedContent,
|
|
1922
|
+
is_error: true
|
|
1923
|
+
},
|
|
1924
|
+
...decision.stop_turn ? {
|
|
1925
|
+
done: true,
|
|
1926
|
+
finalMessage: "Permission request was denied. Turn stopped. Please send your next input to continue."
|
|
1927
|
+
} : {}
|
|
1928
|
+
};
|
|
1929
|
+
};
|
|
1894
1930
|
var executeToolCall = async ({
|
|
1895
1931
|
toolCall,
|
|
1896
1932
|
tools,
|
|
@@ -1918,20 +1954,7 @@ var executeToolCall = async ({
|
|
|
1918
1954
|
createToolContext(signal)
|
|
1919
1955
|
);
|
|
1920
1956
|
if (decision.decision === "deny") {
|
|
1921
|
-
|
|
1922
|
-
return {
|
|
1923
|
-
message: {
|
|
1924
|
-
role: "tool",
|
|
1925
|
-
tool_call_id: toolCall.id,
|
|
1926
|
-
tool_name: toolName,
|
|
1927
|
-
content: deniedContent,
|
|
1928
|
-
is_error: true
|
|
1929
|
-
},
|
|
1930
|
-
...decision.stop_turn ? {
|
|
1931
|
-
done: true,
|
|
1932
|
-
finalMessage: "Permission request was denied. Turn stopped. Please send your next input to continue."
|
|
1933
|
-
} : {}
|
|
1934
|
-
};
|
|
1957
|
+
return permissionDeniedResult(toolCall, decision);
|
|
1935
1958
|
}
|
|
1936
1959
|
} catch (error) {
|
|
1937
1960
|
return {
|
|
@@ -1959,6 +1982,8 @@ var executeToolCall = async ({
|
|
|
1959
1982
|
}
|
|
1960
1983
|
};
|
|
1961
1984
|
} catch (error) {
|
|
1985
|
+
if (error instanceof ToolPermissionDenied)
|
|
1986
|
+
return permissionDeniedResult(toolCall, error.decision);
|
|
1962
1987
|
if (error instanceof TaskComplete) {
|
|
1963
1988
|
return {
|
|
1964
1989
|
message: {
|
|
@@ -2221,12 +2246,19 @@ var Agent = class {
|
|
|
2221
2246
|
return;
|
|
2222
2247
|
}
|
|
2223
2248
|
this.history.enqueueUserMessage(message);
|
|
2249
|
+
const receiveMessages = async () => {
|
|
2250
|
+
const messages = await options.pollMessages?.() ?? [];
|
|
2251
|
+
for (const content of messages) this.history.enqueueUserMessage(content);
|
|
2252
|
+
return messages;
|
|
2253
|
+
};
|
|
2224
2254
|
let iterations = 0;
|
|
2225
2255
|
const runTools = [...this.tools, ...options.tools ?? []];
|
|
2226
2256
|
const runToolChoice = options.toolChoice ?? this.toolChoice;
|
|
2227
2257
|
while (iterations < this.maxIterations) {
|
|
2228
2258
|
iterations++;
|
|
2229
2259
|
throwIfAborted(signal);
|
|
2260
|
+
for (const content of await receiveMessages())
|
|
2261
|
+
yield { type: "hidden_user_message", content };
|
|
2230
2262
|
await this.trimToolOutputs();
|
|
2231
2263
|
throwIfAborted(signal);
|
|
2232
2264
|
const invokeInput = this.history.prepareInvokeInput({
|
|
@@ -2303,6 +2335,10 @@ var Agent = class {
|
|
|
2303
2335
|
if (!hasToolCalls) {
|
|
2304
2336
|
if (!this.requireDoneTool) {
|
|
2305
2337
|
yield* this.checkAndCompact(signal, { session });
|
|
2338
|
+
const incoming = await receiveMessages();
|
|
2339
|
+
for (const content of incoming)
|
|
2340
|
+
yield { type: "hidden_user_message", content };
|
|
2341
|
+
if (incoming.length) continue;
|
|
2306
2342
|
const finalText = assistantTexts.join("\n").trim();
|
|
2307
2343
|
const finalResponseEvent2 = {
|
|
2308
2344
|
type: "final",
|
|
@@ -2453,9 +2489,11 @@ var Agent = class {
|
|
|
2453
2489
|
}
|
|
2454
2490
|
yield* this.checkAndCompact(signal, { session });
|
|
2455
2491
|
}
|
|
2492
|
+
if (signal?.aborted) throw createAbortError2();
|
|
2456
2493
|
const finalResponse = await this.generateFinalResponse(session, signal);
|
|
2457
2494
|
const finalResponseEvent = {
|
|
2458
2495
|
type: "final",
|
|
2496
|
+
termination_reason: "max_steps",
|
|
2459
2497
|
content: finalResponse
|
|
2460
2498
|
};
|
|
2461
2499
|
yield finalResponseEvent;
|
|
@@ -7782,6 +7820,7 @@ function defineTool(toolOptions) {
|
|
|
7782
7820
|
ProviderFailureError,
|
|
7783
7821
|
TaskComplete,
|
|
7784
7822
|
ToolOutputCacheService,
|
|
7823
|
+
ToolPermissionDenied,
|
|
7785
7824
|
XAI_DEFAULT_MODEL,
|
|
7786
7825
|
XAI_DEFAULT_REASONING_EFFORT,
|
|
7787
7826
|
XAI_MODELS,
|
package/dist/index.d.ts
CHANGED
|
@@ -406,6 +406,11 @@ type ToolPermissionDecision = {
|
|
|
406
406
|
reason?: string;
|
|
407
407
|
stop_turn?: boolean;
|
|
408
408
|
};
|
|
409
|
+
/** Carries a permission decision made inside a tool's shared execution gate. */
|
|
410
|
+
declare class ToolPermissionDenied extends Error {
|
|
411
|
+
readonly decision: ToolPermissionDecision;
|
|
412
|
+
constructor(decision: ToolPermissionDecision);
|
|
413
|
+
}
|
|
409
414
|
type ToolPermissionHook = (call: ToolCall, rawArgs: string, ctx: ToolContext) => Promise<ToolPermissionDecision> | ToolPermissionDecision;
|
|
410
415
|
|
|
411
416
|
type SessionHeader = {
|
|
@@ -596,6 +601,8 @@ type AgentSession = {
|
|
|
596
601
|
};
|
|
597
602
|
|
|
598
603
|
type AgentRunOptions = {
|
|
604
|
+
/** Untrusted messages polled only between model/tool batches; never starts a nested run. */
|
|
605
|
+
pollMessages?: () => Promise<string[]>;
|
|
599
606
|
session?: AgentSession;
|
|
600
607
|
signal?: AbortSignal;
|
|
601
608
|
forceCompaction?: boolean;
|
|
@@ -996,4 +1003,4 @@ declare class TaskComplete extends Error {
|
|
|
996
1003
|
constructor(finalMessage?: string);
|
|
997
1004
|
}
|
|
998
1005
|
|
|
999
|
-
export { ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_MODELS, Agent, type AgentEventRecord, type AgentOptions, type AgentRunOptions, type AgentServices, type AgentSession, type BaseChatModel, type BaseMessage, ChatAnthropic, type ChatInvokeContext, type ChatInvokeInput, ChatMoonshot, ChatOpenAI, ChatOpenRouter, ChatXai, ChatZai, type ContentPart, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_MODELS, type LlmRequestRecord, type LlmResponseRecord, MOONSHOT_DEFAULT_MODEL, MOONSHOT_MODELS, type ModelCapabilities, type ModelCost, type ModelEntry, type ModelLimits, type ModelMetadataIndex, type ModelMetadataService, type ModelRegistry, type ModelSpec, OPENAI_DEFAULT_MODEL, OPENAI_DEFAULT_REASONING_EFFORT, OPENAI_MODELS, type ProviderFailure, type ProviderFailureClassifier, ProviderFailureError, type ProviderFailureKind, type ResolveStorageOptions, type RetryDelaySource, type RunContextRecord, type RunEndRecord, type RunErrorRecord, type RunEventStoreFactory, type RunEventStoreInit, type RunStartRecord, type RunStatusRecord, type SessionHeader, type SessionRecord, type SessionState, type SessionStateStore, type SessionStateSummary, type SessionStore, type StorageLayout, type StoragePathService, type StoragePaths, type StringifyContentMode, type StringifyContentOptions, TaskComplete, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, type ToolPermissionHook, type ToolResult, XAI_DEFAULT_MODEL, XAI_DEFAULT_REASONING_EFFORT, XAI_MODELS, ZAI_DEFAULT_MODEL, ZAI_MODELS, ZAI_REASONING_EFFORT_MODELS, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, isProviderFailureError, isUsableModelSpec, listModels, registerModels, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };
|
|
1006
|
+
export { ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_MODELS, Agent, type AgentEventRecord, type AgentOptions, type AgentRunOptions, type AgentServices, type AgentSession, type BaseChatModel, type BaseMessage, ChatAnthropic, type ChatInvokeContext, type ChatInvokeInput, ChatMoonshot, ChatOpenAI, ChatOpenRouter, ChatXai, ChatZai, type ContentPart, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_MODELS, type LlmRequestRecord, type LlmResponseRecord, MOONSHOT_DEFAULT_MODEL, MOONSHOT_MODELS, type ModelCapabilities, type ModelCost, type ModelEntry, type ModelLimits, type ModelMetadataIndex, type ModelMetadataService, type ModelRegistry, type ModelSpec, OPENAI_DEFAULT_MODEL, OPENAI_DEFAULT_REASONING_EFFORT, OPENAI_MODELS, type ProviderFailure, type ProviderFailureClassifier, ProviderFailureError, type ProviderFailureKind, type ResolveStorageOptions, type RetryDelaySource, type RunContextRecord, type RunEndRecord, type RunErrorRecord, type RunEventStoreFactory, type RunEventStoreInit, type RunStartRecord, type RunStatusRecord, type SessionHeader, type SessionRecord, type SessionState, type SessionStateStore, type SessionStateSummary, type SessionStore, type StorageLayout, type StoragePathService, type StoragePaths, type StringifyContentMode, type StringifyContentOptions, TaskComplete, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, ToolPermissionDenied, type ToolPermissionHook, type ToolResult, XAI_DEFAULT_MODEL, XAI_DEFAULT_REASONING_EFFORT, XAI_MODELS, ZAI_DEFAULT_MODEL, ZAI_MODELS, ZAI_REASONING_EFFORT_MODELS, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, isProviderFailureError, isUsableModelSpec, listModels, registerModels, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,14 @@ var buildGpt56Model = (id) => ({
|
|
|
23
23
|
supportsFast: true
|
|
24
24
|
});
|
|
25
25
|
var OPENAI_MODELS = [
|
|
26
|
+
{
|
|
27
|
+
id: "gpt-6-astra",
|
|
28
|
+
provider: "openai",
|
|
29
|
+
contextWindow: 105e4,
|
|
30
|
+
maxInputTokens: 27e4,
|
|
31
|
+
maxOutputTokens: 128e3,
|
|
32
|
+
supportsFast: true
|
|
33
|
+
},
|
|
26
34
|
...GPT_5_6_PROVIDER_MODELS.map(buildGpt56Model),
|
|
27
35
|
{
|
|
28
36
|
id: "gpt-5.5",
|
|
@@ -289,6 +297,10 @@ var MessageHistoryAdapter = class {
|
|
|
289
297
|
}
|
|
290
298
|
};
|
|
291
299
|
|
|
300
|
+
// src/llm/openai/history.ts
|
|
301
|
+
var ResponsesHistoryAdapter = class extends MessageHistoryAdapter {
|
|
302
|
+
};
|
|
303
|
+
|
|
292
304
|
// src/llm/failures.ts
|
|
293
305
|
var ProviderFailureError = class extends Error {
|
|
294
306
|
failure;
|
|
@@ -712,10 +724,6 @@ async function* invokeWithRetry({
|
|
|
712
724
|
}
|
|
713
725
|
}
|
|
714
726
|
|
|
715
|
-
// src/llm/openai/history.ts
|
|
716
|
-
var ResponsesHistoryAdapter = class extends MessageHistoryAdapter {
|
|
717
|
-
};
|
|
718
|
-
|
|
719
727
|
// src/models/anthropic.ts
|
|
720
728
|
var ANTHROPIC_DEFAULT_MODEL = "claude-sonnet-4-5";
|
|
721
729
|
var ANTHROPIC_MODELS = [
|
|
@@ -1790,6 +1798,16 @@ var TaskComplete = class extends Error {
|
|
|
1790
1798
|
}
|
|
1791
1799
|
};
|
|
1792
1800
|
|
|
1801
|
+
// src/types/permissions.ts
|
|
1802
|
+
var ToolPermissionDenied = class extends Error {
|
|
1803
|
+
constructor(decision) {
|
|
1804
|
+
super(`Permission denied${decision.reason ? `: ${decision.reason}` : ""}`);
|
|
1805
|
+
this.decision = decision;
|
|
1806
|
+
this.name = "ToolPermissionDenied";
|
|
1807
|
+
}
|
|
1808
|
+
decision;
|
|
1809
|
+
};
|
|
1810
|
+
|
|
1793
1811
|
// src/agent/tool-execution.ts
|
|
1794
1812
|
var toolResultToContent = (result) => {
|
|
1795
1813
|
if (result.type === "text") return result.text;
|
|
@@ -1818,6 +1836,23 @@ var createToolContext = (signal) => {
|
|
|
1818
1836
|
now: () => /* @__PURE__ */ new Date()
|
|
1819
1837
|
};
|
|
1820
1838
|
};
|
|
1839
|
+
var permissionDeniedResult = (toolCall, decision) => {
|
|
1840
|
+
const toolName = toolCall.function.name;
|
|
1841
|
+
const deniedContent = `Permission denied${decision.reason ? `: ${decision.reason}` : ""}`;
|
|
1842
|
+
return {
|
|
1843
|
+
message: {
|
|
1844
|
+
role: "tool",
|
|
1845
|
+
tool_call_id: toolCall.id,
|
|
1846
|
+
tool_name: toolName,
|
|
1847
|
+
content: deniedContent,
|
|
1848
|
+
is_error: true
|
|
1849
|
+
},
|
|
1850
|
+
...decision.stop_turn ? {
|
|
1851
|
+
done: true,
|
|
1852
|
+
finalMessage: "Permission request was denied. Turn stopped. Please send your next input to continue."
|
|
1853
|
+
} : {}
|
|
1854
|
+
};
|
|
1855
|
+
};
|
|
1821
1856
|
var executeToolCall = async ({
|
|
1822
1857
|
toolCall,
|
|
1823
1858
|
tools,
|
|
@@ -1845,20 +1880,7 @@ var executeToolCall = async ({
|
|
|
1845
1880
|
createToolContext(signal)
|
|
1846
1881
|
);
|
|
1847
1882
|
if (decision.decision === "deny") {
|
|
1848
|
-
|
|
1849
|
-
return {
|
|
1850
|
-
message: {
|
|
1851
|
-
role: "tool",
|
|
1852
|
-
tool_call_id: toolCall.id,
|
|
1853
|
-
tool_name: toolName,
|
|
1854
|
-
content: deniedContent,
|
|
1855
|
-
is_error: true
|
|
1856
|
-
},
|
|
1857
|
-
...decision.stop_turn ? {
|
|
1858
|
-
done: true,
|
|
1859
|
-
finalMessage: "Permission request was denied. Turn stopped. Please send your next input to continue."
|
|
1860
|
-
} : {}
|
|
1861
|
-
};
|
|
1883
|
+
return permissionDeniedResult(toolCall, decision);
|
|
1862
1884
|
}
|
|
1863
1885
|
} catch (error) {
|
|
1864
1886
|
return {
|
|
@@ -1886,6 +1908,8 @@ var executeToolCall = async ({
|
|
|
1886
1908
|
}
|
|
1887
1909
|
};
|
|
1888
1910
|
} catch (error) {
|
|
1911
|
+
if (error instanceof ToolPermissionDenied)
|
|
1912
|
+
return permissionDeniedResult(toolCall, error.decision);
|
|
1889
1913
|
if (error instanceof TaskComplete) {
|
|
1890
1914
|
return {
|
|
1891
1915
|
message: {
|
|
@@ -2148,12 +2172,19 @@ var Agent = class {
|
|
|
2148
2172
|
return;
|
|
2149
2173
|
}
|
|
2150
2174
|
this.history.enqueueUserMessage(message);
|
|
2175
|
+
const receiveMessages = async () => {
|
|
2176
|
+
const messages = await options.pollMessages?.() ?? [];
|
|
2177
|
+
for (const content of messages) this.history.enqueueUserMessage(content);
|
|
2178
|
+
return messages;
|
|
2179
|
+
};
|
|
2151
2180
|
let iterations = 0;
|
|
2152
2181
|
const runTools = [...this.tools, ...options.tools ?? []];
|
|
2153
2182
|
const runToolChoice = options.toolChoice ?? this.toolChoice;
|
|
2154
2183
|
while (iterations < this.maxIterations) {
|
|
2155
2184
|
iterations++;
|
|
2156
2185
|
throwIfAborted(signal);
|
|
2186
|
+
for (const content of await receiveMessages())
|
|
2187
|
+
yield { type: "hidden_user_message", content };
|
|
2157
2188
|
await this.trimToolOutputs();
|
|
2158
2189
|
throwIfAborted(signal);
|
|
2159
2190
|
const invokeInput = this.history.prepareInvokeInput({
|
|
@@ -2230,6 +2261,10 @@ var Agent = class {
|
|
|
2230
2261
|
if (!hasToolCalls) {
|
|
2231
2262
|
if (!this.requireDoneTool) {
|
|
2232
2263
|
yield* this.checkAndCompact(signal, { session });
|
|
2264
|
+
const incoming = await receiveMessages();
|
|
2265
|
+
for (const content of incoming)
|
|
2266
|
+
yield { type: "hidden_user_message", content };
|
|
2267
|
+
if (incoming.length) continue;
|
|
2233
2268
|
const finalText = assistantTexts.join("\n").trim();
|
|
2234
2269
|
const finalResponseEvent2 = {
|
|
2235
2270
|
type: "final",
|
|
@@ -2380,9 +2415,11 @@ var Agent = class {
|
|
|
2380
2415
|
}
|
|
2381
2416
|
yield* this.checkAndCompact(signal, { session });
|
|
2382
2417
|
}
|
|
2418
|
+
if (signal?.aborted) throw createAbortError2();
|
|
2383
2419
|
const finalResponse = await this.generateFinalResponse(session, signal);
|
|
2384
2420
|
const finalResponseEvent = {
|
|
2385
2421
|
type: "final",
|
|
2422
|
+
termination_reason: "max_steps",
|
|
2386
2423
|
content: finalResponse
|
|
2387
2424
|
};
|
|
2388
2425
|
yield finalResponseEvent;
|
|
@@ -7708,6 +7745,7 @@ export {
|
|
|
7708
7745
|
ProviderFailureError,
|
|
7709
7746
|
TaskComplete,
|
|
7710
7747
|
ToolOutputCacheService,
|
|
7748
|
+
ToolPermissionDenied,
|
|
7711
7749
|
XAI_DEFAULT_MODEL,
|
|
7712
7750
|
XAI_DEFAULT_REASONING_EFFORT,
|
|
7713
7751
|
XAI_MODELS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codelia/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.81",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@anthropic-ai/sdk": "^0.110.0",
|
|
29
|
-
"@codelia/config": "0.1.
|
|
30
|
-
"@codelia/shared-types": "0.1.
|
|
29
|
+
"@codelia/config": "0.1.81",
|
|
30
|
+
"@codelia/shared-types": "0.1.81",
|
|
31
31
|
"json-schema": "^0.4.0",
|
|
32
32
|
"openai": "^6.46.0",
|
|
33
33
|
"ws": "^8.21.0",
|
package/prompts/AGENTS.md
CHANGED
|
@@ -13,3 +13,4 @@
|
|
|
13
13
|
- Keep external-access guidance tool-agnostic and high-level: describe when facts, state, or operations depend on resources outside the workspace or local environment, but do not make external access a blanket substitute for local inspection and verification.
|
|
14
14
|
- Avoid duplicating the same rule across multiple sections unless repetition is necessary for safety.
|
|
15
15
|
- Keep the shared prompt collaborative and action-oriented: prefer early concrete exploration, and let stronger verification guidance dominate later in the task.
|
|
16
|
+
- Keep subagent usage policy in the shared system prompt: interactive delegation requires explicit user authorization for the current task; unattended execution alone is not authorization. Keep parameter validation and limits in tool descriptions.
|
package/prompts/system.md
CHANGED
|
@@ -86,6 +86,16 @@ Shell / execution:
|
|
|
86
86
|
- When work depends on background processes, ports, pidfiles, or other shared machine resources, check for conflicts with leftover state from earlier attempts and avoid relying on ambiguous ownership.
|
|
87
87
|
- If work must survive runtime exit or behave like a service, start it explicitly out of process using shell-native detach/daemonization for that environment (for example `nohup`, `setsid`, `disown`, a service manager, or `docker compose up -d`) and verify readiness/liveness separately.
|
|
88
88
|
|
|
89
|
+
## Subagents and delegation
|
|
90
|
+
|
|
91
|
+
- Use subagents only when delegation tools are available. In interactive sessions, delegate only when the user explicitly asks to use subagents or parallel agents, or has already authorized their use for the current task. Requests to work faster, investigate, review, or run commands in parallel do not by themselves authorize agent delegation.
|
|
92
|
+
- Within that authorized task, choose useful subtasks and coordinate the children without asking for permission for each spawn or message. Respect later limits or revocation; authorization does not carry over to unrelated tasks.
|
|
93
|
+
- For non-interactive work, follow the task or host's explicit delegation policy. Do not infer permission to delegate merely because the session is unattended. If authorization is unclear, continue the work yourself.
|
|
94
|
+
- Delegate concrete, bounded work that can usefully proceed independently. Give each child a self-contained assignment, relevant constraints, and the expected result. Keep ownership of integration and verification, and avoid duplicating a child's ongoing work.
|
|
95
|
+
- Honor the user's model or model-profile instructions when spawning a child: pass the requested model or configured profile through the spawn tool without changing the parent model. Configured profiles and their purposes appear in `<subagent_model_profiles>`; select a matching profile when appropriate, otherwise leave selection omitted to use the configured default or inherit the parent. Do not probe model availability before spawning or silently substitute another model after failure.
|
|
96
|
+
- Choose a short, distinctive agent code name for each child, varying invented words and combinations freely. Keep the name separate from the work assignment, and use task IDs to address children.
|
|
97
|
+
- Parent and children share live files. Coordinate overlapping edits and test effects through messages, respond to questions, and verify child results before relying on them. Keep the user informed of meaningful delegation progress.
|
|
98
|
+
|
|
89
99
|
## Repository and change safety
|
|
90
100
|
|
|
91
101
|
- Always follow the nearest in-scope `AGENTS.md` and `RULES.md` (directory-specific) instructions.
|