@superatomai/sdk-node 0.0.66-dsp → 0.0.67-dsp
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/README.md +942 -942
- package/dist/index.d.mts +18 -5
- package/dist/index.d.ts +18 -5
- package/dist/index.js +18 -9
- package/dist/index.mjs +17 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5113,6 +5113,11 @@ interface CodingAgentSessionOptions {
|
|
|
5113
5113
|
env?: Record<string, string>;
|
|
5114
5114
|
/** Opt out of env scrubbing. Only for local debugging. */
|
|
5115
5115
|
inheritEnv?: boolean;
|
|
5116
|
+
/**
|
|
5117
|
+
* Workspace file holding the standing instructions. The driver must make its
|
|
5118
|
+
* harness read it: codex only finds AGENTS.md by itself.
|
|
5119
|
+
*/
|
|
5120
|
+
instructionsFile?: string;
|
|
5116
5121
|
}
|
|
5117
5122
|
interface CodingAgentSession {
|
|
5118
5123
|
readonly harness: string;
|
|
@@ -5409,10 +5414,9 @@ interface CodingAgentDefinition<TInput = unknown, TOutput = unknown> {
|
|
|
5409
5414
|
mode: 'task' | 'chat';
|
|
5410
5415
|
/**
|
|
5411
5416
|
* Directory holding this agent's system.md. Defaults to
|
|
5412
|
-
* `<promptRoot>/<id>`. The runner copies
|
|
5413
|
-
*
|
|
5414
|
-
*
|
|
5415
|
-
* version-controlled while the workspace stays disposable.
|
|
5417
|
+
* `<promptRoot>/<id>`. The runner copies it into the workspace under the
|
|
5418
|
+
* same name, which is what the harness reads from its working directory —
|
|
5419
|
+
* the source stays version-controlled, the workspace stays disposable.
|
|
5416
5420
|
*/
|
|
5417
5421
|
promptDir?: string;
|
|
5418
5422
|
/** Override the deployment default for this agent alone. */
|
|
@@ -5591,6 +5595,15 @@ declare function listCodingAgents(): Array<{
|
|
|
5591
5595
|
}>;
|
|
5592
5596
|
declare function getCodingAgentsConfig(): Required<Pick<CodingAgentsConfig, "harness" | "promptRoot" | "runtimeDir" | "keepRuns" | "keepThreads">> & CodingAgentsConfig;
|
|
5593
5597
|
|
|
5598
|
+
/**
|
|
5599
|
+
* The workspace file the harness reads as its standing instructions.
|
|
5600
|
+
*
|
|
5601
|
+
* Codex discovers its project doc BY NAME and only knows AGENTS.md, so every
|
|
5602
|
+
* session is given this as `instructionsFile` and the driver registers it.
|
|
5603
|
+
* Keeping the workspace copy called system.md, like the version-controlled
|
|
5604
|
+
* source, removes the one-name-two-meanings indirection.
|
|
5605
|
+
*/
|
|
5606
|
+
declare const INSTRUCTIONS_FILE = "system.md";
|
|
5594
5607
|
interface RunAgentOptions<TInput> extends AgentRunContext {
|
|
5595
5608
|
input?: TInput;
|
|
5596
5609
|
/** Scopes a 'thread' agent. Ignored by a project-scoped one. */
|
|
@@ -6140,4 +6153,4 @@ declare class SuperatomSDK {
|
|
|
6140
6153
|
getConversationSimilarityThreshold(): number;
|
|
6141
6154
|
}
|
|
6142
6155
|
|
|
6143
|
-
export { ALL_COLUMN_KEYS, ANSWER_COMPONENT_NAMES, type AgentConfig, type AgentEvent, type AgentResponse, type AgentRunContext, type AgentRunHandlers, type AgentRunRecord, type AgentRunResult, type AgentTrigger, type AgentUsage, type AnswerProvider, type AnswerProviderContext, type ApplySummary, BM25L, type BM25LOptions, type BaseLLMConfig, type BuildTriggerInput, CATEGORY_KEYS, CONTEXT_CONFIG, type CapturedLog, CleanupService, type CodexSessionOptions, type CodingAgentCollectionConfig, type CodingAgentDefinition, type CodingAgentSession, type CodingAgentSessionOptions, type CodingAgentsConfig, type ColInfo, type ColType, type CollectionHandler, type CollectionOperation, type Component, type DBUIBlock, DEFAULT_AGENT_CONFIG, DEFAULT_FMT_CONFIG, type DashboardAgentCollectionConfig, type DatabaseType, type FindingCode, type Fmt, type FmtConfig, type Harness, type HybridSearchOptions, type IncomingMessage, type KbNodesQueryFilters, type KbNodesRequestPayload, LLM, type LLMUsageEntry, type LogLevel, MainAgent, type McpServerSpec, type Message, MissingRequestContextError, type ModelStrategy, NUMERIC_KEYS, type NarrationUpdate, type OutputContract, type OutputField, type OutputValidator, type Principal, type RequestContext, type RerankedResult, type RowFilter, type RunAgentOptions, STORAGE_CONFIG, type ScriptComponentSpec, ScriptMatcher, type ScriptParameter, type ScriptRecipe, type ScriptRecipeMetaRow, type ScriptRecipeStore, type ScriptResult, ScriptStore, type ScriptStoreOptions, type SelectedWorkflow, type SourcePolicy, type SpecToValidate, SuperatomSDK, type SuperatomSDKConfig, type T_RESPONSE, type TaskType, Thread, ThreadManager, type Tool$1 as Tool, type ToolOutputSchema, type TriggerEvent, type TriggerFireInfo, UIBlock, UILogCollector, type User, UserManager, type UsersData, type ValidationContext, type ValidationFinding, type WorkflowDescriptor, type Workspace, answerCatalogForBinding, answerComponents, anthropicLLM, assertReadOnlySql, bindContext, captureContext, clearContextTokens, contextTokenCount, createCodexSession, createCodingAgentSession, dashboardConversationHistory, dataFingerprint, describeContext, describeTriggers, emitAgentEvent, extractNamedExport, formatFindingsForAgent, geminiLLM, getCodingAgent, getCodingAgentsConfig, getRequestContext, groqLLM, hybridRerank, inferColumns, isUserContext, listCodingAgents, llmUsageLogger, logger, makeFmt, mintContextToken, normalizeScriptBody, onAgentRun, openaiLLM, policiesFromConfig, projectForDatasetBinding, queryCache, registerCodingAgentCollection, registerCodingAgents, registerDashboardAgentCollection, requireRequestContext, rerankChromaResults, rerankConversationResults, resolveContextToken, resolveScriptRecipeStore, revokeContextToken, runAsSystem, runAsUser, runCodingAgent, runScript, runWithContext, runWithMessageIdentity, startAgentTriggers, stopAgentTriggers, userPromptErrorLogger, validateComponentSpec, withCapturedContext, writeBridgeShims };
|
|
6156
|
+
export { ALL_COLUMN_KEYS, ANSWER_COMPONENT_NAMES, type AgentConfig, type AgentEvent, type AgentResponse, type AgentRunContext, type AgentRunHandlers, type AgentRunRecord, type AgentRunResult, type AgentTrigger, type AgentUsage, type AnswerProvider, type AnswerProviderContext, type ApplySummary, BM25L, type BM25LOptions, type BaseLLMConfig, type BuildTriggerInput, CATEGORY_KEYS, CONTEXT_CONFIG, type CapturedLog, CleanupService, type CodexSessionOptions, type CodingAgentCollectionConfig, type CodingAgentDefinition, type CodingAgentSession, type CodingAgentSessionOptions, type CodingAgentsConfig, type ColInfo, type ColType, type CollectionHandler, type CollectionOperation, type Component, type DBUIBlock, DEFAULT_AGENT_CONFIG, DEFAULT_FMT_CONFIG, type DashboardAgentCollectionConfig, type DatabaseType, type FindingCode, type Fmt, type FmtConfig, type Harness, type HybridSearchOptions, INSTRUCTIONS_FILE, type IncomingMessage, type KbNodesQueryFilters, type KbNodesRequestPayload, LLM, type LLMUsageEntry, type LogLevel, MainAgent, type McpServerSpec, type Message, MissingRequestContextError, type ModelStrategy, NUMERIC_KEYS, type NarrationUpdate, type OutputContract, type OutputField, type OutputValidator, type Principal, type RequestContext, type RerankedResult, type RowFilter, type RunAgentOptions, STORAGE_CONFIG, type ScriptComponentSpec, ScriptMatcher, type ScriptParameter, type ScriptRecipe, type ScriptRecipeMetaRow, type ScriptRecipeStore, type ScriptResult, ScriptStore, type ScriptStoreOptions, type SelectedWorkflow, type SourcePolicy, type SpecToValidate, SuperatomSDK, type SuperatomSDKConfig, type T_RESPONSE, type TaskType, Thread, ThreadManager, type Tool$1 as Tool, type ToolOutputSchema, type TriggerEvent, type TriggerFireInfo, UIBlock, UILogCollector, type User, UserManager, type UsersData, type ValidationContext, type ValidationFinding, type WorkflowDescriptor, type Workspace, answerCatalogForBinding, answerComponents, anthropicLLM, assertReadOnlySql, bindContext, captureContext, clearContextTokens, contextTokenCount, createCodexSession, createCodingAgentSession, dashboardConversationHistory, dataFingerprint, describeContext, describeTriggers, emitAgentEvent, extractNamedExport, formatFindingsForAgent, geminiLLM, getCodingAgent, getCodingAgentsConfig, getRequestContext, groqLLM, hybridRerank, inferColumns, isUserContext, listCodingAgents, llmUsageLogger, logger, makeFmt, mintContextToken, normalizeScriptBody, onAgentRun, openaiLLM, policiesFromConfig, projectForDatasetBinding, queryCache, registerCodingAgentCollection, registerCodingAgents, registerDashboardAgentCollection, requireRequestContext, rerankChromaResults, rerankConversationResults, resolveContextToken, resolveScriptRecipeStore, revokeContextToken, runAsSystem, runAsUser, runCodingAgent, runScript, runWithContext, runWithMessageIdentity, startAgentTriggers, stopAgentTriggers, userPromptErrorLogger, validateComponentSpec, withCapturedContext, writeBridgeShims };
|
package/dist/index.d.ts
CHANGED
|
@@ -5113,6 +5113,11 @@ interface CodingAgentSessionOptions {
|
|
|
5113
5113
|
env?: Record<string, string>;
|
|
5114
5114
|
/** Opt out of env scrubbing. Only for local debugging. */
|
|
5115
5115
|
inheritEnv?: boolean;
|
|
5116
|
+
/**
|
|
5117
|
+
* Workspace file holding the standing instructions. The driver must make its
|
|
5118
|
+
* harness read it: codex only finds AGENTS.md by itself.
|
|
5119
|
+
*/
|
|
5120
|
+
instructionsFile?: string;
|
|
5116
5121
|
}
|
|
5117
5122
|
interface CodingAgentSession {
|
|
5118
5123
|
readonly harness: string;
|
|
@@ -5409,10 +5414,9 @@ interface CodingAgentDefinition<TInput = unknown, TOutput = unknown> {
|
|
|
5409
5414
|
mode: 'task' | 'chat';
|
|
5410
5415
|
/**
|
|
5411
5416
|
* Directory holding this agent's system.md. Defaults to
|
|
5412
|
-
* `<promptRoot>/<id>`. The runner copies
|
|
5413
|
-
*
|
|
5414
|
-
*
|
|
5415
|
-
* version-controlled while the workspace stays disposable.
|
|
5417
|
+
* `<promptRoot>/<id>`. The runner copies it into the workspace under the
|
|
5418
|
+
* same name, which is what the harness reads from its working directory —
|
|
5419
|
+
* the source stays version-controlled, the workspace stays disposable.
|
|
5416
5420
|
*/
|
|
5417
5421
|
promptDir?: string;
|
|
5418
5422
|
/** Override the deployment default for this agent alone. */
|
|
@@ -5591,6 +5595,15 @@ declare function listCodingAgents(): Array<{
|
|
|
5591
5595
|
}>;
|
|
5592
5596
|
declare function getCodingAgentsConfig(): Required<Pick<CodingAgentsConfig, "harness" | "promptRoot" | "runtimeDir" | "keepRuns" | "keepThreads">> & CodingAgentsConfig;
|
|
5593
5597
|
|
|
5598
|
+
/**
|
|
5599
|
+
* The workspace file the harness reads as its standing instructions.
|
|
5600
|
+
*
|
|
5601
|
+
* Codex discovers its project doc BY NAME and only knows AGENTS.md, so every
|
|
5602
|
+
* session is given this as `instructionsFile` and the driver registers it.
|
|
5603
|
+
* Keeping the workspace copy called system.md, like the version-controlled
|
|
5604
|
+
* source, removes the one-name-two-meanings indirection.
|
|
5605
|
+
*/
|
|
5606
|
+
declare const INSTRUCTIONS_FILE = "system.md";
|
|
5594
5607
|
interface RunAgentOptions<TInput> extends AgentRunContext {
|
|
5595
5608
|
input?: TInput;
|
|
5596
5609
|
/** Scopes a 'thread' agent. Ignored by a project-scoped one. */
|
|
@@ -6140,4 +6153,4 @@ declare class SuperatomSDK {
|
|
|
6140
6153
|
getConversationSimilarityThreshold(): number;
|
|
6141
6154
|
}
|
|
6142
6155
|
|
|
6143
|
-
export { ALL_COLUMN_KEYS, ANSWER_COMPONENT_NAMES, type AgentConfig, type AgentEvent, type AgentResponse, type AgentRunContext, type AgentRunHandlers, type AgentRunRecord, type AgentRunResult, type AgentTrigger, type AgentUsage, type AnswerProvider, type AnswerProviderContext, type ApplySummary, BM25L, type BM25LOptions, type BaseLLMConfig, type BuildTriggerInput, CATEGORY_KEYS, CONTEXT_CONFIG, type CapturedLog, CleanupService, type CodexSessionOptions, type CodingAgentCollectionConfig, type CodingAgentDefinition, type CodingAgentSession, type CodingAgentSessionOptions, type CodingAgentsConfig, type ColInfo, type ColType, type CollectionHandler, type CollectionOperation, type Component, type DBUIBlock, DEFAULT_AGENT_CONFIG, DEFAULT_FMT_CONFIG, type DashboardAgentCollectionConfig, type DatabaseType, type FindingCode, type Fmt, type FmtConfig, type Harness, type HybridSearchOptions, type IncomingMessage, type KbNodesQueryFilters, type KbNodesRequestPayload, LLM, type LLMUsageEntry, type LogLevel, MainAgent, type McpServerSpec, type Message, MissingRequestContextError, type ModelStrategy, NUMERIC_KEYS, type NarrationUpdate, type OutputContract, type OutputField, type OutputValidator, type Principal, type RequestContext, type RerankedResult, type RowFilter, type RunAgentOptions, STORAGE_CONFIG, type ScriptComponentSpec, ScriptMatcher, type ScriptParameter, type ScriptRecipe, type ScriptRecipeMetaRow, type ScriptRecipeStore, type ScriptResult, ScriptStore, type ScriptStoreOptions, type SelectedWorkflow, type SourcePolicy, type SpecToValidate, SuperatomSDK, type SuperatomSDKConfig, type T_RESPONSE, type TaskType, Thread, ThreadManager, type Tool$1 as Tool, type ToolOutputSchema, type TriggerEvent, type TriggerFireInfo, UIBlock, UILogCollector, type User, UserManager, type UsersData, type ValidationContext, type ValidationFinding, type WorkflowDescriptor, type Workspace, answerCatalogForBinding, answerComponents, anthropicLLM, assertReadOnlySql, bindContext, captureContext, clearContextTokens, contextTokenCount, createCodexSession, createCodingAgentSession, dashboardConversationHistory, dataFingerprint, describeContext, describeTriggers, emitAgentEvent, extractNamedExport, formatFindingsForAgent, geminiLLM, getCodingAgent, getCodingAgentsConfig, getRequestContext, groqLLM, hybridRerank, inferColumns, isUserContext, listCodingAgents, llmUsageLogger, logger, makeFmt, mintContextToken, normalizeScriptBody, onAgentRun, openaiLLM, policiesFromConfig, projectForDatasetBinding, queryCache, registerCodingAgentCollection, registerCodingAgents, registerDashboardAgentCollection, requireRequestContext, rerankChromaResults, rerankConversationResults, resolveContextToken, resolveScriptRecipeStore, revokeContextToken, runAsSystem, runAsUser, runCodingAgent, runScript, runWithContext, runWithMessageIdentity, startAgentTriggers, stopAgentTriggers, userPromptErrorLogger, validateComponentSpec, withCapturedContext, writeBridgeShims };
|
|
6156
|
+
export { ALL_COLUMN_KEYS, ANSWER_COMPONENT_NAMES, type AgentConfig, type AgentEvent, type AgentResponse, type AgentRunContext, type AgentRunHandlers, type AgentRunRecord, type AgentRunResult, type AgentTrigger, type AgentUsage, type AnswerProvider, type AnswerProviderContext, type ApplySummary, BM25L, type BM25LOptions, type BaseLLMConfig, type BuildTriggerInput, CATEGORY_KEYS, CONTEXT_CONFIG, type CapturedLog, CleanupService, type CodexSessionOptions, type CodingAgentCollectionConfig, type CodingAgentDefinition, type CodingAgentSession, type CodingAgentSessionOptions, type CodingAgentsConfig, type ColInfo, type ColType, type CollectionHandler, type CollectionOperation, type Component, type DBUIBlock, DEFAULT_AGENT_CONFIG, DEFAULT_FMT_CONFIG, type DashboardAgentCollectionConfig, type DatabaseType, type FindingCode, type Fmt, type FmtConfig, type Harness, type HybridSearchOptions, INSTRUCTIONS_FILE, type IncomingMessage, type KbNodesQueryFilters, type KbNodesRequestPayload, LLM, type LLMUsageEntry, type LogLevel, MainAgent, type McpServerSpec, type Message, MissingRequestContextError, type ModelStrategy, NUMERIC_KEYS, type NarrationUpdate, type OutputContract, type OutputField, type OutputValidator, type Principal, type RequestContext, type RerankedResult, type RowFilter, type RunAgentOptions, STORAGE_CONFIG, type ScriptComponentSpec, ScriptMatcher, type ScriptParameter, type ScriptRecipe, type ScriptRecipeMetaRow, type ScriptRecipeStore, type ScriptResult, ScriptStore, type ScriptStoreOptions, type SelectedWorkflow, type SourcePolicy, type SpecToValidate, SuperatomSDK, type SuperatomSDKConfig, type T_RESPONSE, type TaskType, Thread, ThreadManager, type Tool$1 as Tool, type ToolOutputSchema, type TriggerEvent, type TriggerFireInfo, UIBlock, UILogCollector, type User, UserManager, type UsersData, type ValidationContext, type ValidationFinding, type WorkflowDescriptor, type Workspace, answerCatalogForBinding, answerComponents, anthropicLLM, assertReadOnlySql, bindContext, captureContext, clearContextTokens, contextTokenCount, createCodexSession, createCodingAgentSession, dashboardConversationHistory, dataFingerprint, describeContext, describeTriggers, emitAgentEvent, extractNamedExport, formatFindingsForAgent, geminiLLM, getCodingAgent, getCodingAgentsConfig, getRequestContext, groqLLM, hybridRerank, inferColumns, isUserContext, listCodingAgents, llmUsageLogger, logger, makeFmt, mintContextToken, normalizeScriptBody, onAgentRun, openaiLLM, policiesFromConfig, projectForDatasetBinding, queryCache, registerCodingAgentCollection, registerCodingAgents, registerDashboardAgentCollection, requireRequestContext, rerankChromaResults, rerankConversationResults, resolveContextToken, resolveScriptRecipeStore, revokeContextToken, runAsSystem, runAsUser, runCodingAgent, runScript, runWithContext, runWithMessageIdentity, startAgentTriggers, stopAgentTriggers, userPromptErrorLogger, validateComponentSpec, withCapturedContext, writeBridgeShims };
|
package/dist/index.js
CHANGED
|
@@ -38,6 +38,7 @@ __export(index_exports, {
|
|
|
38
38
|
CleanupService: () => CleanupService,
|
|
39
39
|
DEFAULT_AGENT_CONFIG: () => DEFAULT_AGENT_CONFIG,
|
|
40
40
|
DEFAULT_FMT_CONFIG: () => DEFAULT_FMT_CONFIG,
|
|
41
|
+
INSTRUCTIONS_FILE: () => INSTRUCTIONS_FILE,
|
|
41
42
|
LLM: () => LLM,
|
|
42
43
|
MainAgent: () => MainAgent,
|
|
43
44
|
MissingRequestContextError: () => MissingRequestContextError,
|
|
@@ -24245,17 +24246,21 @@ function createCodexSession(opts) {
|
|
|
24245
24246
|
async function ensureThread() {
|
|
24246
24247
|
if (thread) return thread;
|
|
24247
24248
|
const { Codex } = await loadCodex();
|
|
24249
|
+
const config2 = {
|
|
24250
|
+
// Tools reach codex as MCP servers; each server's name shows up on
|
|
24251
|
+
// every tool event, so the runner can tell ours from codex's own.
|
|
24252
|
+
...opts.mcpServers && Object.keys(opts.mcpServers).length ? { mcp_servers: opts.mcpServers } : {},
|
|
24253
|
+
// Per run, not ~/.codex/config.toml: a host without that line would run
|
|
24254
|
+
// the agent with no instructions at all. AGENTS.md still wins if present.
|
|
24255
|
+
...opts.instructionsFile && opts.instructionsFile !== "AGENTS.md" ? { project_doc_fallback_filenames: [opts.instructionsFile] } : {},
|
|
24256
|
+
...opts.extraConfig ?? {}
|
|
24257
|
+
};
|
|
24248
24258
|
const codex = new Codex({
|
|
24249
24259
|
...opts.apiKey ? { apiKey: opts.apiKey } : {},
|
|
24250
24260
|
...opts.baseUrl ? { baseUrl: opts.baseUrl } : {},
|
|
24251
24261
|
env: buildEnv(opts),
|
|
24252
|
-
//
|
|
24253
|
-
|
|
24254
|
-
// Only send a config override when there is something in it. An empty
|
|
24255
|
-
// object is truthy, so the naive check sent config:{mcp_servers:{}} on
|
|
24256
|
-
// every run — a pointless CLI override on a path that is otherwise
|
|
24257
|
-
// completely default.
|
|
24258
|
-
...opts.mcpServers && Object.keys(opts.mcpServers).length || opts.extraConfig ? { config: { ...opts.mcpServers && Object.keys(opts.mcpServers).length ? { mcp_servers: opts.mcpServers } : {}, ...opts.extraConfig ?? {} } } : {}
|
|
24262
|
+
// Only when non-empty: an empty override is pointless CLI noise.
|
|
24263
|
+
...Object.keys(config2).length ? { config: config2 } : {}
|
|
24259
24264
|
});
|
|
24260
24265
|
thread = resumeId ? codex.resumeThread(resumeId, threadOptions()) : codex.startThread(threadOptions());
|
|
24261
24266
|
return thread;
|
|
@@ -24547,10 +24552,11 @@ function createWorkspace(dir, runId) {
|
|
|
24547
24552
|
}
|
|
24548
24553
|
};
|
|
24549
24554
|
}
|
|
24555
|
+
var INSTRUCTIONS_FILE = "system.md";
|
|
24550
24556
|
async function installInstructions(def, ws) {
|
|
24551
24557
|
const src = path9.join(resolvePromptDir(def), "system.md");
|
|
24552
24558
|
try {
|
|
24553
|
-
await ws.write(
|
|
24559
|
+
await ws.write(INSTRUCTIONS_FILE, await fsp.readFile(src, "utf-8"));
|
|
24554
24560
|
} catch {
|
|
24555
24561
|
logger.warn(`[CodingAgent:${def.id}] no system.md at ${src} \u2014 running without standing instructions`);
|
|
24556
24562
|
}
|
|
@@ -24669,13 +24675,14 @@ async function runCodingAgent(agentId, options = {}) {
|
|
|
24669
24675
|
if (outputPath) await fsp.rm(outputPath, { force: true });
|
|
24670
24676
|
const prompt = options.prompt ?? // buildPrompt may read what prepare() wrote, so it is only asked when
|
|
24671
24677
|
// prepare() actually ran.
|
|
24672
|
-
(runAsJob && def.buildPrompt ? await def.buildPrompt(ws, input, ctx) : outputPath ? `Carry out the task described in
|
|
24678
|
+
(runAsJob && def.buildPrompt ? await def.buildPrompt(ws, input, ctx) : outputPath ? `Carry out the task described in ${INSTRUCTIONS_FILE}. Write your finished result to this exact absolute path: ${outputPath}` : `Carry out the task described in ${INSTRUCTIONS_FILE}.`);
|
|
24673
24679
|
const tools = { ...cfg.sharedTools ?? {}, ...def.tools ?? {} };
|
|
24674
24680
|
const sessionEnv = def.env ? await def.env(input, ctx) : void 0;
|
|
24675
24681
|
const session = createCodingAgentSession(def.harness || cfg.harness, {
|
|
24676
24682
|
cwd: dir,
|
|
24677
24683
|
model: def.model || cfg.model,
|
|
24678
24684
|
resumeId,
|
|
24685
|
+
instructionsFile: INSTRUCTIONS_FILE,
|
|
24679
24686
|
// undefined, not {}, when this agent has no tools — see the driver.
|
|
24680
24687
|
mcpServers: tools && Object.keys(tools).length ? tools : void 0,
|
|
24681
24688
|
...sessionEnv ? { env: sessionEnv } : {},
|
|
@@ -24761,6 +24768,7 @@ async function runCodingAgent(agentId, options = {}) {
|
|
|
24761
24768
|
cwd: dir,
|
|
24762
24769
|
model: def.model || cfg.model,
|
|
24763
24770
|
resumeId: result.sessionId,
|
|
24771
|
+
instructionsFile: INSTRUCTIONS_FILE,
|
|
24764
24772
|
mcpServers: tools && Object.keys(tools).length ? tools : void 0,
|
|
24765
24773
|
...sessionEnv ? { env: sessionEnv } : {},
|
|
24766
24774
|
...def.networkAccessEnabled !== void 0 ? { networkAccessEnabled: def.networkAccessEnabled } : {},
|
|
@@ -28902,6 +28910,7 @@ var SuperatomSDK = class {
|
|
|
28902
28910
|
CleanupService,
|
|
28903
28911
|
DEFAULT_AGENT_CONFIG,
|
|
28904
28912
|
DEFAULT_FMT_CONFIG,
|
|
28913
|
+
INSTRUCTIONS_FILE,
|
|
28905
28914
|
LLM,
|
|
28906
28915
|
MainAgent,
|
|
28907
28916
|
MissingRequestContextError,
|
package/dist/index.mjs
CHANGED
|
@@ -24139,17 +24139,21 @@ function createCodexSession(opts) {
|
|
|
24139
24139
|
async function ensureThread() {
|
|
24140
24140
|
if (thread) return thread;
|
|
24141
24141
|
const { Codex } = await loadCodex();
|
|
24142
|
+
const config2 = {
|
|
24143
|
+
// Tools reach codex as MCP servers; each server's name shows up on
|
|
24144
|
+
// every tool event, so the runner can tell ours from codex's own.
|
|
24145
|
+
...opts.mcpServers && Object.keys(opts.mcpServers).length ? { mcp_servers: opts.mcpServers } : {},
|
|
24146
|
+
// Per run, not ~/.codex/config.toml: a host without that line would run
|
|
24147
|
+
// the agent with no instructions at all. AGENTS.md still wins if present.
|
|
24148
|
+
...opts.instructionsFile && opts.instructionsFile !== "AGENTS.md" ? { project_doc_fallback_filenames: [opts.instructionsFile] } : {},
|
|
24149
|
+
...opts.extraConfig ?? {}
|
|
24150
|
+
};
|
|
24142
24151
|
const codex = new Codex({
|
|
24143
24152
|
...opts.apiKey ? { apiKey: opts.apiKey } : {},
|
|
24144
24153
|
...opts.baseUrl ? { baseUrl: opts.baseUrl } : {},
|
|
24145
24154
|
env: buildEnv(opts),
|
|
24146
|
-
//
|
|
24147
|
-
|
|
24148
|
-
// Only send a config override when there is something in it. An empty
|
|
24149
|
-
// object is truthy, so the naive check sent config:{mcp_servers:{}} on
|
|
24150
|
-
// every run — a pointless CLI override on a path that is otherwise
|
|
24151
|
-
// completely default.
|
|
24152
|
-
...opts.mcpServers && Object.keys(opts.mcpServers).length || opts.extraConfig ? { config: { ...opts.mcpServers && Object.keys(opts.mcpServers).length ? { mcp_servers: opts.mcpServers } : {}, ...opts.extraConfig ?? {} } } : {}
|
|
24155
|
+
// Only when non-empty: an empty override is pointless CLI noise.
|
|
24156
|
+
...Object.keys(config2).length ? { config: config2 } : {}
|
|
24153
24157
|
});
|
|
24154
24158
|
thread = resumeId ? codex.resumeThread(resumeId, threadOptions()) : codex.startThread(threadOptions());
|
|
24155
24159
|
return thread;
|
|
@@ -24441,10 +24445,11 @@ function createWorkspace(dir, runId) {
|
|
|
24441
24445
|
}
|
|
24442
24446
|
};
|
|
24443
24447
|
}
|
|
24448
|
+
var INSTRUCTIONS_FILE = "system.md";
|
|
24444
24449
|
async function installInstructions(def, ws) {
|
|
24445
24450
|
const src = path9.join(resolvePromptDir(def), "system.md");
|
|
24446
24451
|
try {
|
|
24447
|
-
await ws.write(
|
|
24452
|
+
await ws.write(INSTRUCTIONS_FILE, await fsp.readFile(src, "utf-8"));
|
|
24448
24453
|
} catch {
|
|
24449
24454
|
logger.warn(`[CodingAgent:${def.id}] no system.md at ${src} \u2014 running without standing instructions`);
|
|
24450
24455
|
}
|
|
@@ -24563,13 +24568,14 @@ async function runCodingAgent(agentId, options = {}) {
|
|
|
24563
24568
|
if (outputPath) await fsp.rm(outputPath, { force: true });
|
|
24564
24569
|
const prompt = options.prompt ?? // buildPrompt may read what prepare() wrote, so it is only asked when
|
|
24565
24570
|
// prepare() actually ran.
|
|
24566
|
-
(runAsJob && def.buildPrompt ? await def.buildPrompt(ws, input, ctx) : outputPath ? `Carry out the task described in
|
|
24571
|
+
(runAsJob && def.buildPrompt ? await def.buildPrompt(ws, input, ctx) : outputPath ? `Carry out the task described in ${INSTRUCTIONS_FILE}. Write your finished result to this exact absolute path: ${outputPath}` : `Carry out the task described in ${INSTRUCTIONS_FILE}.`);
|
|
24567
24572
|
const tools = { ...cfg.sharedTools ?? {}, ...def.tools ?? {} };
|
|
24568
24573
|
const sessionEnv = def.env ? await def.env(input, ctx) : void 0;
|
|
24569
24574
|
const session = createCodingAgentSession(def.harness || cfg.harness, {
|
|
24570
24575
|
cwd: dir,
|
|
24571
24576
|
model: def.model || cfg.model,
|
|
24572
24577
|
resumeId,
|
|
24578
|
+
instructionsFile: INSTRUCTIONS_FILE,
|
|
24573
24579
|
// undefined, not {}, when this agent has no tools — see the driver.
|
|
24574
24580
|
mcpServers: tools && Object.keys(tools).length ? tools : void 0,
|
|
24575
24581
|
...sessionEnv ? { env: sessionEnv } : {},
|
|
@@ -24655,6 +24661,7 @@ async function runCodingAgent(agentId, options = {}) {
|
|
|
24655
24661
|
cwd: dir,
|
|
24656
24662
|
model: def.model || cfg.model,
|
|
24657
24663
|
resumeId: result.sessionId,
|
|
24664
|
+
instructionsFile: INSTRUCTIONS_FILE,
|
|
24658
24665
|
mcpServers: tools && Object.keys(tools).length ? tools : void 0,
|
|
24659
24666
|
...sessionEnv ? { env: sessionEnv } : {},
|
|
24660
24667
|
...def.networkAccessEnabled !== void 0 ? { networkAccessEnabled: def.networkAccessEnabled } : {},
|
|
@@ -28795,6 +28802,7 @@ export {
|
|
|
28795
28802
|
CleanupService,
|
|
28796
28803
|
DEFAULT_AGENT_CONFIG,
|
|
28797
28804
|
DEFAULT_FMT_CONFIG,
|
|
28805
|
+
INSTRUCTIONS_FILE,
|
|
28798
28806
|
LLM,
|
|
28799
28807
|
MainAgent,
|
|
28800
28808
|
MissingRequestContextError,
|