@atlaswork/atlascode 0.1.135 → 0.1.136

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "product": "atlascode",
3
- "version": "0.1.135",
3
+ "version": "0.1.136",
4
4
  "runtimeSha256": "9bbb766ae76e5a73f1155a83bd6eda493644fb228b9308e0f45938fb49f43451",
5
5
  "executionSha256": "b14e2ea5946c9e086d65d2debe0de98b0afec83228d887958bcb16a6e867710d"
6
6
  }
package/dist/cli.js CHANGED
@@ -92468,6 +92468,10 @@ async function getInputPrompt(prompt, inputFormat) {
92468
92468
  if (timedOut) {
92469
92469
  process.stderr.write("Warning: no stdin data received in 3s, proceeding without it. " + `If piping from a slow command, redirect stdin explicitly: < /dev/null to skip, or wait longer.
92470
92470
  `);
92471
+ process.stdin.pause();
92472
+ if (typeof process.stdin.unref === "function") {
92473
+ process.stdin.unref();
92474
+ }
92471
92475
  }
92472
92476
  return [prompt, data].filter(Boolean).join(`
92473
92477
  `);
@@ -93757,12 +93761,72 @@ async function connectMcpStartup(args) {
93757
93761
  const mcpResults = await connectAll();
93758
93762
  const mcpOk = mcpResults.filter((r) => r.status === "fulfilled").length;
93759
93763
  logForDebugging2(mcpConnectLine(mcpOk, mcpResults.length - mcpOk));
93764
+ for (const conn of manager.list()) {
93765
+ if (conn.type !== "failed")
93766
+ continue;
93767
+ if (conn.blockedByPolicy) {
93768
+ const reason = conn.error?.replace(/^MCP server ".*" blocked by enterprise policy: /, "") ?? "enterprise policy";
93769
+ process.stderr.write(`warning: MCP server '${conn.name}' blocked by policy (${reason}) — its tools are unavailable
93770
+ `);
93771
+ } else {
93772
+ process.stderr.write(`warning: MCP server '${conn.name}' failed to start (${conn.error ?? "connection failed"}) — its tools are unavailable
93773
+ `);
93774
+ }
93775
+ }
93760
93776
  }
93761
93777
  const mcpConnections = await buildMcpEngineConnectionsLocal(manager);
93762
93778
  const mcpTools = createMcpTools(mcpConnections);
93763
93779
  syncMcpClientRegistryLocal(manager);
93764
93780
  return { mcpConnections, mcpTools, nonBlocking };
93765
93781
  }
93782
+ function parseHeadlessAgentsJson(agentsJson) {
93783
+ let parsed;
93784
+ try {
93785
+ parsed = JSON.parse(agentsJson);
93786
+ } catch (error) {
93787
+ process.stderr.write(`Error: invalid --agents JSON: ${error instanceof Error ? error.message : String(error)}
93788
+ `);
93789
+ process.exit(1);
93790
+ }
93791
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
93792
+ process.stderr.write(`Error: --agents must be a JSON object mapping agent names to {description, prompt}
93793
+ `);
93794
+ process.exit(1);
93795
+ }
93796
+ const definitions = [];
93797
+ for (const [name, value] of Object.entries(parsed)) {
93798
+ const def = value ?? {};
93799
+ const description = def.description ?? def.whenToUse;
93800
+ if (typeof description !== "string" || typeof def.prompt !== "string" || def.prompt.length === 0) {
93801
+ process.stderr.write(`Error: --agents entry '${name}' must have string 'description' and non-empty 'prompt' fields
93802
+ `);
93803
+ process.exit(1);
93804
+ }
93805
+ const prompt = def.prompt;
93806
+ definitions.push({
93807
+ agentType: name,
93808
+ source: "user",
93809
+ whenToUse: description,
93810
+ getSystemPrompt: () => prompt
93811
+ });
93812
+ }
93813
+ return definitions;
93814
+ }
93815
+ async function resolveHeadlessAgentPrompt(options) {
93816
+ const cliAgents = options.agents !== undefined ? parseHeadlessAgentsJson(options.agents) : [];
93817
+ const agentName = options.agent ?? getInitialSettings().agent;
93818
+ if (!agentName)
93819
+ return;
93820
+ const found = cliAgents.find((a) => a.agentType === agentName) ?? getBuiltInAgents().find((a) => a.agentType === agentName);
93821
+ if (!found) {
93822
+ const available = [...getBuiltInAgents(), ...cliAgents].map((a) => a.agentType).join(", ");
93823
+ process.stderr.write(`Error: agent '${agentName}' not found (available agents: ${available || "(none)"})
93824
+ `);
93825
+ process.exit(1);
93826
+ }
93827
+ const prompt = await found.getSystemPrompt({});
93828
+ return prompt.length > 0 ? prompt : undefined;
93829
+ }
93766
93830
  function validateUuidLocal(value) {
93767
93831
  return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
93768
93832
  }
@@ -94122,6 +94186,7 @@ async function runHeadless(inputPrompt, options) {
94122
94186
  const role = options.model ? strictModelRef?.kind === "role" ? strictModelRef.role : modelToRole(options.model) : resolveDefaultRole(settings.settings.defaultRole);
94123
94187
  const roleModel = getRoleModel(role);
94124
94188
  logForDebugging2(modelLine(role, options.model ?? roleModel));
94189
+ const headlessAgentPrompt = await resolveHeadlessAgentPrompt(options);
94125
94190
  const bundle = await createAgentLoopDeps({
94126
94191
  allowedToolsCli: options.allowedTools ?? [],
94127
94192
  disallowedToolsCli: options.disallowedTools ?? [],
@@ -94138,7 +94203,10 @@ async function runHeadless(inputPrompt, options) {
94138
94203
  role,
94139
94204
  sessionModel: strictModelRef?.kind === "role" ? undefined : options.model,
94140
94205
  disablePersistence: options.disablePersistence,
94141
- systemPrompt: resolveHeadlessSystemPrompt(options),
94206
+ systemPrompt: headlessAgentPrompt ? asSystemPrompt([
94207
+ headlessAgentPrompt,
94208
+ ...options.appendSystemPrompt ? [options.appendSystemPrompt] : []
94209
+ ]) : resolveHeadlessSystemPrompt(options),
94142
94210
  thinkingConfig: options.thinkingConfig,
94143
94211
  responseFormat: options.jsonSchema ? toResponseFormat({ type: "json_schema", schema: options.jsonSchema }) : undefined,
94144
94212
  effortValue: options.effort,
@@ -94624,7 +94692,7 @@ async function loadResumedMessages(options) {
94624
94692
  await processResumedConversation({
94625
94693
  messages: conversation,
94626
94694
  sessionId: resumedId
94627
- }, { forkSession: false, sessionIdOverride: resumedId });
94695
+ }, { forkSession: options.forkSession ?? false, sessionIdOverride: resumedId });
94628
94696
  return conversation;
94629
94697
  }
94630
94698
  var init_print = __esm(() => {
@@ -94638,6 +94706,8 @@ var init_print = __esm(() => {
94638
94706
  init_streamJsonStdoutGuard();
94639
94707
  init_approvalChannel();
94640
94708
  init_headlessPrompt();
94709
+ init_engine();
94710
+ init_shared();
94641
94711
  init_debugSink();
94642
94712
  init_hooksWiring();
94643
94713
  init_headlessSessionEnd();
@@ -95709,6 +95779,8 @@ function buildHeadlessOptions(options) {
95709
95779
  addDirs: options.addDir,
95710
95780
  replayUserMessages: options.replayUserMessages === true ? true : undefined,
95711
95781
  agent: options.agent,
95782
+ forkSession: options.forkSession === true ? true : undefined,
95783
+ agents: options.agents,
95712
95784
  disablePersistence: options.sessionPersistence === false ? true : undefined,
95713
95785
  jsonSchema: parseJsonSchemaOption(options.jsonSchema),
95714
95786
  systemPrompt: readPromptFileInline(options.systemPrompt, options.systemPromptFile, "System prompt"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaswork/atlascode",
3
- "version": "0.1.135",
3
+ "version": "0.1.136",
4
4
  "description": "AtlasCode — Coding Agent for the domestic computing ecosystem (Ascend NPU + domestic LLM backends)",
5
5
  "homepage": "https://www.atlaswork.cn/",
6
6
  "bin": {