@thinkingai/ae-cli 6.0.60 → 6.0.61

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.
Files changed (82) hide show
  1. package/README.md +4 -1
  2. package/README.zh.md +6 -1
  3. package/bin/runtime-capabilities.json +1 -1
  4. package/dist/{ai-monitor-FCXSLHAP.js → ai-monitor-NUKSJPLE.js} +10 -9
  5. package/dist/ai-monitor.js +14 -13
  6. package/dist/{auth-ATK2SLEV.js → auth-MVAEBGBP.js} +18 -10
  7. package/dist/{automation-FLCPFMN4.js → automation-6L6IAYRK.js} +6 -7
  8. package/dist/{capability-6KTSOI7L.js → capability-74N7AN5X.js} +10 -9
  9. package/dist/{chunk-OAWPT7VP.js → chunk-2I5SZ5DS.js} +2 -2
  10. package/dist/{chunk-5E7MTTFN.js → chunk-7WBCSJL6.js} +23 -9
  11. package/dist/{chunk-4PSTYEG5.js → chunk-AMURHMS3.js} +11 -7
  12. package/dist/{chunk-6M7ZEDT2.js → chunk-BQFLABJQ.js} +11 -7
  13. package/dist/{chunk-KTJXD27G.js → chunk-COOMXFUG.js} +3 -3
  14. package/dist/{chunk-CF6JTT2U.js → chunk-EFGUBGA6.js} +1 -1
  15. package/dist/{chunk-BEYLCUZX.js → chunk-H35VDOAE.js} +3 -3
  16. package/dist/{chunk-F2VFZUGG.js → chunk-HIMOBNEY.js} +2 -2
  17. package/dist/{chunk-JEUXDY3B.js → chunk-HQED4YB4.js} +1 -1
  18. package/dist/{chunk-AXTO4FTM.js → chunk-HRFYYEXR.js} +3 -3
  19. package/dist/{chunk-2ETRY2CU.js → chunk-JZY6WWAP.js} +9 -8
  20. package/dist/{chunk-2F64AZYH.js → chunk-KA5WKR5P.js} +2 -2
  21. package/dist/{chunk-P7QDCWJ6.js → chunk-LFJ7N36I.js} +5 -1
  22. package/dist/{chunk-SDKW6LYE.js → chunk-LPKIMGIU.js} +3 -3
  23. package/dist/chunk-NNK3JBH4.js +60 -0
  24. package/dist/{chunk-VJUXKVRE.js → chunk-OTZ4JQDU.js} +2 -2
  25. package/dist/{chunk-HTZ2MLYA.js → chunk-PLNS5J33.js} +11 -5
  26. package/dist/chunk-PUSFEC6B.js +29 -0
  27. package/dist/{chunk-Z3Q2AEIN.js → chunk-R2SVAO4G.js} +14 -2
  28. package/dist/{chunk-HSZAIPUX.js → chunk-RB26WNLM.js} +7 -5
  29. package/dist/{chunk-VRMGHQKE.js → chunk-SVNED423.js} +11 -11
  30. package/dist/{chunk-HVMCPKOZ.js → chunk-THTROEGD.js} +1 -1
  31. package/dist/{chunk-QVRIDN42.js → chunk-UCMO4LKL.js} +2 -2
  32. package/dist/{chunk-5M5LBRR3.js → chunk-VLOGOM7N.js} +13 -7
  33. package/dist/{chunk-LOR4IA26.js → chunk-XPARQSYS.js} +165 -186
  34. package/dist/{chunk-72NJKS7O.js → chunk-XZDKAR4N.js} +4 -4
  35. package/dist/{community-report-client-TJVCLZ3K.js → community-report-client-ULRNXLQV.js} +1 -1
  36. package/dist/{compat-check-XD2U7PZ2.js → compat-check-W4XC27RG.js} +5 -4
  37. package/dist/{config-U3GDWU6E.js → config-264GB6C7.js} +7 -6
  38. package/dist/{context-YAQG6YQC.js → context-SOQDFZIB.js} +8 -6
  39. package/dist/{data-integration-QE37EQ3A.js → data-integration-UNJ7EPW2.js} +6 -6
  40. package/dist/{evaluation-2JSF4V47.js → evaluation-Q3AIGFOG.js} +5 -5
  41. package/dist/index.js +46 -42
  42. package/dist/{local-data-upload-client-KCMG6J62.js → local-data-upload-client-YTWMAAGE.js} +1 -1
  43. package/dist/{memory-WEB27VI6.js → memory-ZLTTULZK.js} +6 -7
  44. package/dist/{metadata-7FYE4234.js → metadata-EN2IWCDI.js} +10 -9
  45. package/dist/{model-T7H7Q6BG.js → model-NAKQWK4W.js} +4 -5
  46. package/dist/{personal-semantic-preference-O6VXM74A.js → personal-semantic-preference-UGN67KTN.js} +45 -14
  47. package/dist/{project-semantic-2GGFJWW6.js → project-semantic-5OP3YPZD.js} +9 -8
  48. package/dist/{sync-ULBB7WO5.js → sync-LDJQZRQH.js} +9 -9
  49. package/dist/{te-agent-6RMF7LUV.js → te-agent-WNNAD4AJ.js} +303 -17
  50. package/dist/{te-analysis-HSYC7GNV.js → te-analysis-KIMH6AGU.js} +25 -20
  51. package/dist/{te-community-FLKZGQKB.js → te-community-P7NNBVCS.js} +13 -11
  52. package/dist/{te-dataops-OQQGTCUA.js → te-dataops-ZRKSG4R7.js} +13 -11
  53. package/dist/{te-engage-RIEBHL5T.js → te-engage-PVBVNRSU.js} +9 -8
  54. package/dist/{te-kb-4HG2FMHJ.js → te-kb-W7PRC7QN.js} +68 -17
  55. package/dist/{te-system-AL4B4XZL.js → te-system-F4ZU2HRQ.js} +6 -7
  56. package/dist/{te-team-5O4UVUWE.js → te-team-5ONMRGKF.js} +9 -8
  57. package/dist/{things-TSJ64GBT.js → things-PFENSIF4.js} +9 -8
  58. package/dist/{update-Q5LURAWV.js → update-EUZ4GNND.js} +8 -6
  59. package/dist/{workspace-FF2HXJGR.js → workspace-Z7L33OBQ.js} +6 -7
  60. package/package.json +5 -2
  61. package/skills/ae-agent/SKILL.md +19 -5
  62. package/skills/ae-agent/references/a2a.md +103 -0
  63. package/skills/ae-agent/references/command_index.md +11 -0
  64. package/skills/ae-analysis/SKILL.md +35 -23
  65. package/skills/ae-analysis/references/analysis_data_retrieval.md +1 -1
  66. package/skills/ae-analysis/references/asset_authentication_export.md +1 -1
  67. package/skills/ae-analysis/references/asset_authentication_update.md +6 -2
  68. package/skills/ae-analysis/references/bad_case_review.md +4 -4
  69. package/skills/ae-analysis/references/command_index.md +7 -7
  70. package/skills/ae-analysis/references/governance_recommendation_export.md +2 -2
  71. package/skills/ae-analysis/references/personal_semantic_preference_add.md +9 -1
  72. package/skills/ae-analysis/references/personal_semantic_preference_delete.md +2 -0
  73. package/skills/ae-analysis/references/personal_semantic_preference_get.md +2 -0
  74. package/skills/ae-analysis/references/personal_semantic_preference_list.md +10 -2
  75. package/skills/ae-analysis/references/personal_semantic_preference_update.md +8 -0
  76. package/skills/ae-analysis/references/project_owner_update.md +5 -1
  77. package/skills/ae-analysis/references/scenario_evaluation.md +17 -1
  78. package/skills/ae-analysis/references/scenario_list.md +5 -6
  79. package/skills/ae-capability/SKILL.md +8 -4
  80. package/skills/ae-kb/SKILL.md +4 -2
  81. package/skills/ae-kb/references/publication.md +45 -0
  82. package/dist/chunk-Y74WTIKJ.js +0 -10
@@ -6,15 +6,15 @@ import {
6
6
  readOutputMetadata,
7
7
  unwrapOutputData,
8
8
  withOutputMetadata
9
- } from "./chunk-VJUXKVRE.js";
9
+ } from "./chunk-OTZ4JQDU.js";
10
10
  import {
11
11
  CapabilityGatewayError,
12
12
  fetchCapabilityGateway,
13
13
  requestCapabilityGateway
14
- } from "./chunk-2ETRY2CU.js";
14
+ } from "./chunk-JZY6WWAP.js";
15
15
  import {
16
16
  PermissionError
17
- } from "./chunk-Z3Q2AEIN.js";
17
+ } from "./chunk-R2SVAO4G.js";
18
18
 
19
19
  // src/core/analysis-async-artifact.ts
20
20
  import { randomBytes } from "crypto";
@@ -0,0 +1,60 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import {
3
+ getLocalCliPackageInfo
4
+ } from "./chunk-PUSFEC6B.js";
5
+ import {
6
+ getAeSandboxDetectionReason
7
+ } from "./chunk-AMURHMS3.js";
8
+ import {
9
+ logger
10
+ } from "./chunk-R2SVAO4G.js";
11
+
12
+ // src/core/source-logged-fetch.ts
13
+ import { randomUUID } from "crypto";
14
+ var CLI_REQUEST_ID_HEADER = "X-TA-CLI-Request-Id";
15
+ var localPackage = getLocalCliPackageInfo();
16
+ var MAX_LOG_VALUE_LENGTH = 256;
17
+ function bounded(value) {
18
+ return value.length > MAX_LOG_VALUE_LENGTH ? `${value.slice(0, MAX_LOG_VALUE_LENGTH)}...[truncated]` : value;
19
+ }
20
+ function sourceLoggedFetch(url, init) {
21
+ const requestId = randomUUID();
22
+ let headers;
23
+ if (init.headers instanceof Headers) {
24
+ headers = new Headers(init.headers);
25
+ headers.set(CLI_REQUEST_ID_HEADER, requestId);
26
+ } else if (Array.isArray(init.headers)) {
27
+ headers = [
28
+ ...init.headers.filter(([name]) => name.toLowerCase() !== CLI_REQUEST_ID_HEADER.toLowerCase()),
29
+ [CLI_REQUEST_ID_HEADER, requestId]
30
+ ];
31
+ } else {
32
+ headers = Object.fromEntries(Object.entries(init.headers ?? {}).filter(([name]) => name.toLowerCase() !== CLI_REQUEST_ID_HEADER.toLowerCase()));
33
+ headers[CLI_REQUEST_ID_HEADER] = requestId;
34
+ }
35
+ const request = { ...init, headers };
36
+ try {
37
+ const target = new URL(url);
38
+ const actualHeaders = new Headers(headers);
39
+ const source = actualHeaders.get("X-Source");
40
+ const sandboxDetection = getAeSandboxDetectionReason();
41
+ logger.info(`CLI_SOURCE_SEND ${JSON.stringify({
42
+ request_id: requestId,
43
+ method: init.method ?? "GET",
44
+ host: bounded(target.host),
45
+ path: bounded(target.pathname),
46
+ source: source === null ? null : bounded(source),
47
+ source_state: source === null ? "missing" : source === "" ? "empty" : source.includes(",") ? "multiple" : "present",
48
+ cli_package: localPackage.name,
49
+ cli_version: localPackage.version,
50
+ sandbox_detected: sandboxDetection !== "not_detected",
51
+ sandbox_detection: sandboxDetection
52
+ })}`);
53
+ } catch {
54
+ }
55
+ return fetch(url, request);
56
+ }
57
+
58
+ export {
59
+ sourceLoggedFetch
60
+ };
@@ -2,11 +2,11 @@ import { createRequire as __createRequire } from 'node:module'; const require =
2
2
  import {
3
3
  getPendingHostCompatNotice,
4
4
  getPendingUpdateNotice
5
- } from "./chunk-LOR4IA26.js";
5
+ } from "./chunk-XPARQSYS.js";
6
6
  import {
7
7
  logger,
8
8
  redactExternalCliToken
9
- } from "./chunk-Z3Q2AEIN.js";
9
+ } from "./chunk-R2SVAO4G.js";
10
10
 
11
11
  // src/framework/output.ts
12
12
  import Table from "cli-table3";
@@ -6,14 +6,19 @@ import {
6
6
  readSandboxCliTokenEntry,
7
7
  safeJsonParse,
8
8
  safeReadJsonFile
9
- } from "./chunk-4PSTYEG5.js";
9
+ } from "./chunk-AMURHMS3.js";
10
10
  import {
11
11
  PermissionError,
12
12
  externalCliTokenRequestOptions,
13
13
  logger,
14
14
  normalizeUrl,
15
15
  readExternalCliToken
16
- } from "./chunk-Z3Q2AEIN.js";
16
+ } from "./chunk-R2SVAO4G.js";
17
+
18
+ // src/core/internal-call-source.ts
19
+ function internalCallSourceHeaders() {
20
+ return {};
21
+ }
17
22
 
18
23
  // src/core/secure-store.ts
19
24
  import crypto from "crypto";
@@ -658,7 +663,7 @@ async function generateCliToken(hostUrl, accessToken) {
658
663
  const url = `${hostUrl.replace(/\/+$/, "")}${CLI_TOKEN_GENERATE_PATH}`;
659
664
  const resp = await fetch(url, {
660
665
  method: "GET",
661
- headers: { Authorization: `bearer ${accessToken}` }
666
+ headers: { Authorization: `bearer ${accessToken}`, ...internalCallSourceHeaders() }
662
667
  });
663
668
  if (!resp.ok) {
664
669
  if (resp.status === 403) {
@@ -699,7 +704,7 @@ async function validateCliTokenOnServer(hostUrl, cliToken) {
699
704
  try {
700
705
  resp = await fetch(url, {
701
706
  method: "GET",
702
- headers: { Accept: "application/json", "cli-token": cliToken },
707
+ headers: { Accept: "application/json", "cli-token": cliToken, ...internalCallSourceHeaders() },
703
708
  ...externalCliTokenRequestOptions(url)
704
709
  });
705
710
  } catch (error) {
@@ -743,7 +748,7 @@ async function renewCliTokenOnServer(hostUrl, cliToken, external = false, signal
743
748
  if (!external) url.searchParams.set("cli-token", cliToken);
744
749
  const resp = await fetch(url.toString(), {
745
750
  method: "GET",
746
- headers: { Accept: "application/json", ...external ? { "cli-token": cliToken } : {} },
751
+ headers: { Accept: "application/json", ...external ? { "cli-token": cliToken } : {}, ...internalCallSourceHeaders() },
747
752
  ...externalCliTokenRequestOptions(url.toString()),
748
753
  signal
749
754
  });
@@ -865,6 +870,7 @@ async function mintCliToken(hostUrl, accessToken) {
865
870
  }
866
871
 
867
872
  export {
873
+ internalCallSourceHeaders,
868
874
  assertCredentialsReadable,
869
875
  getActiveCredential,
870
876
  listCredentials,
@@ -0,0 +1,29 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+
3
+ // src/core/package-info.ts
4
+ import fs from "fs";
5
+ import path from "path";
6
+ import { fileURLToPath } from "url";
7
+ function getLocalCliPackageInfo() {
8
+ let dir = path.dirname(fileURLToPath(import.meta.url));
9
+ for (let i = 0; i < 8; i += 1) {
10
+ const candidate = path.join(dir, "package.json");
11
+ try {
12
+ if (fs.existsSync(candidate)) {
13
+ const pkg = JSON.parse(fs.readFileSync(candidate, "utf8"));
14
+ if (pkg.name && pkg.version && String(pkg.name).includes("ae-cli")) {
15
+ return { name: pkg.name, version: pkg.version, root: dir };
16
+ }
17
+ }
18
+ } catch {
19
+ }
20
+ const parent = path.dirname(dir);
21
+ if (parent === dir) break;
22
+ dir = parent;
23
+ }
24
+ return { name: "@tant/ae-cli", version: "0.0.0", root: "" };
25
+ }
26
+
27
+ export {
28
+ getLocalCliPackageInfo
29
+ };
@@ -232,15 +232,27 @@ function readExternalCliToken(hostOverride) {
232
232
  let data;
233
233
  try {
234
234
  const stat = fs2.statSync(file);
235
- if (!stat.isFile() || stat.size > 64 * 1024) throw new Error();
235
+ if (!stat.isFile() || stat.size > 96 * 1024) throw new Error();
236
236
  data = JSON.parse(fs2.readFileSync(file, "utf8"));
237
237
  } catch {
238
- throw new ExternalCliTokenError("The external CLI token file must be a readable JSON file no larger than 64 KiB.");
238
+ throw new ExternalCliTokenError("The external CLI token file must be a readable JSON file no larger than 96 KiB.");
239
239
  }
240
240
  if (!data || typeof data !== "object" || Array.isArray(data)) {
241
241
  throw new ExternalCliTokenError("The external CLI token file must contain an object with url and token.");
242
242
  }
243
+ if (data.blocked !== void 0) {
244
+ const code = ["PI_CLI_NOT_READY", "PI_CLI_AUTH_REQUIRED", "PI_CLI_PERMISSION_DENIED", "PI_CLI_TIMEOUT"].includes(data.blocked) ? data.blocked : "PI_CLI_NOT_READY";
245
+ throw new ExternalCliTokenError("The runtime could not prepare CLI credentials for this execution.", code);
246
+ }
243
247
  entry = credential(data.url, data.token ?? data["cli-token"], "file-cli-token");
248
+ if (data.taskContext !== void 0) {
249
+ const context = data.taskContext;
250
+ if (!context || typeof context !== "object" || Array.isArray(context) || context.version !== 1 || typeof context.grant !== "string" || context.grant.length > 65536 || !/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(context.grant) || ["executionId", "sandboxId", "companyId"].some((key) => typeof context[key] !== "string" || !/^[^\s\x00-\x1f\x7f]{1,191}$/.test(context[key]))) {
251
+ throw new ExternalCliTokenError("The runtime CLI context is invalid.");
252
+ }
253
+ entry.taskContext = { version: 1, grant: context.grant, executionId: context.executionId, sandboxId: context.sandboxId, companyId: context.companyId };
254
+ diagnosticSecrets.add(context.grant);
255
+ }
244
256
  } else if (process.env.AE_CLI_TOKEN !== void 0) {
245
257
  entry = credential(process.env.AE_CLI_TOKEN_HOST, process.env.AE_CLI_TOKEN, "environment-cli-token");
246
258
  } else if (process.env.AE_CLI_TOKEN_HOST !== void 0) {
@@ -2,22 +2,24 @@ import { createRequire as __createRequire } from 'node:module'; const require =
2
2
  import {
3
3
  canManageGlobalSkills,
4
4
  fetchCliConfig,
5
- getLocalCliPackageInfo,
6
5
  isBusinessSkillContextCurrent,
7
6
  rememberBusinessConfig,
8
7
  reserveBusinessSkillContext,
9
8
  syncBusinessSkills
10
- } from "./chunk-LOR4IA26.js";
9
+ } from "./chunk-XPARQSYS.js";
10
+ import {
11
+ getLocalCliPackageInfo
12
+ } from "./chunk-PUSFEC6B.js";
11
13
  import {
12
14
  peekCliToken
13
- } from "./chunk-HTZ2MLYA.js";
15
+ } from "./chunk-PLNS5J33.js";
14
16
  import {
15
17
  getActiveHost,
16
18
  getConfigDir
17
- } from "./chunk-4PSTYEG5.js";
19
+ } from "./chunk-AMURHMS3.js";
18
20
  import {
19
21
  normalizeUrl
20
- } from "./chunk-Z3Q2AEIN.js";
22
+ } from "./chunk-R2SVAO4G.js";
21
23
 
22
24
  // src/core/environment-refresh.ts
23
25
  import crypto from "crypto";
@@ -2,36 +2,36 @@ import { createRequire as __createRequire } from 'node:module'; const require =
2
2
  import {
3
3
  confirmHighRiskWrite,
4
4
  requiresConfirmation
5
- } from "./chunk-CF6JTT2U.js";
5
+ } from "./chunk-EFGUBGA6.js";
6
6
  import {
7
7
  TeAgentApiError,
8
8
  TeAgentCredentialsError
9
- } from "./chunk-5M5LBRR3.js";
9
+ } from "./chunk-VLOGOM7N.js";
10
10
  import {
11
11
  EvalApiError
12
- } from "./chunk-P7QDCWJ6.js";
12
+ } from "./chunk-LFJ7N36I.js";
13
13
  import {
14
14
  printError,
15
15
  printOutput
16
- } from "./chunk-VJUXKVRE.js";
16
+ } from "./chunk-OTZ4JQDU.js";
17
17
  import {
18
18
  CapabilityGatewayError
19
- } from "./chunk-2ETRY2CU.js";
19
+ } from "./chunk-JZY6WWAP.js";
20
20
  import {
21
21
  BusinessDisabledError,
22
22
  assertBusinessEnabled,
23
23
  businessForCommand,
24
24
  formatCapabilityMissCompatHint,
25
25
  readCurrentBusinessConfig
26
- } from "./chunk-LOR4IA26.js";
26
+ } from "./chunk-XPARQSYS.js";
27
27
  import {
28
28
  CredentialStoreUnreadableError,
29
29
  SecureStoreAuthError
30
- } from "./chunk-HTZ2MLYA.js";
30
+ } from "./chunk-PLNS5J33.js";
31
31
  import {
32
32
  getActiveHost,
33
33
  safeJsonParse
34
- } from "./chunk-4PSTYEG5.js";
34
+ } from "./chunk-AMURHMS3.js";
35
35
  import {
36
36
  CliApiError,
37
37
  CliValidationError,
@@ -41,7 +41,7 @@ import {
41
41
  PermissionError,
42
42
  logger,
43
43
  readKbExecutionContext
44
- } from "./chunk-Z3Q2AEIN.js";
44
+ } from "./chunk-R2SVAO4G.js";
45
45
 
46
46
  // src/framework/business-filter.ts
47
47
  import { Help } from "commander";
@@ -448,14 +448,14 @@ function createRuntimeContext(cmd, opts, globalOpts) {
448
448
  let _communityReportModule = null;
449
449
  async function getCommunityReportClient() {
450
450
  if (!_communityReportModule) {
451
- _communityReportModule = await import("./community-report-client-TJVCLZ3K.js");
451
+ _communityReportModule = await import("./community-report-client-ULRNXLQV.js");
452
452
  }
453
453
  return _communityReportModule;
454
454
  }
455
455
  let _localDataUploadModule = null;
456
456
  async function getLocalDataUploadClient() {
457
457
  if (!_localDataUploadModule) {
458
- _localDataUploadModule = await import("./local-data-upload-client-KCMG6J62.js");
458
+ _localDataUploadModule = await import("./local-data-upload-client-YTWMAAGE.js");
459
459
  }
460
460
  return _localDataUploadModule;
461
461
  }
@@ -3,7 +3,7 @@ import {
3
3
  getAgentApi,
4
4
  patchAgentApi,
5
5
  postAgentApi
6
- } from "./chunk-F2VFZUGG.js";
6
+ } from "./chunk-HIMOBNEY.js";
7
7
 
8
8
  // src/commands/memory/cli-client.ts
9
9
  var DEFAULT_TE_CLAUDE_BASE_PATH = "/agent";
@@ -5,11 +5,11 @@ import {
5
5
  require_node,
6
6
  require_process_nextick_args,
7
7
  require_util
8
- } from "./chunk-JEUXDY3B.js";
8
+ } from "./chunk-HQED4YB4.js";
9
9
  import {
10
10
  __commonJS,
11
11
  __require
12
- } from "./chunk-Z3Q2AEIN.js";
12
+ } from "./chunk-R2SVAO4G.js";
13
13
 
14
14
  // node_modules/jszip/node_modules/readable-stream/lib/internal/streams/stream.js
15
15
  var require_stream = __commonJS({
@@ -1,20 +1,18 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
+ getCliToken,
3
4
  internalCallSourceHeaders
4
- } from "./chunk-Y74WTIKJ.js";
5
- import {
6
- getCliToken
7
- } from "./chunk-HTZ2MLYA.js";
5
+ } from "./chunk-PLNS5J33.js";
8
6
  import {
9
7
  getActiveHost,
10
8
  getSandboxRuntimeRoot
11
- } from "./chunk-4PSTYEG5.js";
9
+ } from "./chunk-AMURHMS3.js";
12
10
  import {
13
11
  PermissionError,
14
12
  externalCliTokenRequestOptions,
15
13
  isApiErrorType,
16
14
  readExternalCliToken
17
- } from "./chunk-Z3Q2AEIN.js";
15
+ } from "./chunk-R2SVAO4G.js";
18
16
 
19
17
  // src/core/te-agent-credentials.ts
20
18
  import { readFileSync } from "fs";
@@ -202,7 +200,7 @@ function teClaudeBaseFromActiveHost(hostOverride) {
202
200
  async function signRequest(method, path2, hostOverride, includeJsonContentType = true, authMode = "auto") {
203
201
  const external = readExternalCliToken(hostOverride);
204
202
  const configuredHost = hostOverride || getActiveHost();
205
- const sandboxOnly = !hostOverride && (/* @__PURE__ */ new Set([
203
+ const sandboxEndpoint = (/* @__PURE__ */ new Set([
206
204
  "/api/sandbox/models",
207
205
  "/api/sandbox/models/select",
208
206
  "/api/sandbox/sync/push",
@@ -210,9 +208,11 @@ async function signRequest(method, path2, hostOverride, includeJsonContentType =
210
208
  "/api/sandbox/sync/pull",
211
209
  "/api/sandbox/sync/pull/candidates"
212
210
  ])).has(path2.split("?")[0]);
211
+ const sandboxOnly = !hostOverride && sandboxEndpoint;
213
212
  const sandboxCred = external || configuredHost && !sandboxOnly ? null : tryLoadTeAgentSandboxCredentials();
214
213
  if (authMode === "auto" && !hostOverride && sandboxCred && sandboxCred.sandboxId && sandboxCred.sandboxSecretKey) {
215
214
  const headers = {
215
+ ...internalCallSourceHeaders(),
216
216
  "X-Sandbox-Id": sandboxCred.sandboxId,
217
217
  "X-Sandbox-Secret-Key": sandboxCred.sandboxSecretKey
218
218
  };
@@ -239,6 +239,12 @@ async function signRequest(method, path2, hostOverride, includeJsonContentType =
239
239
  url: `${baseUrl.replace(/\/$/, "")}${path2}`,
240
240
  headers: {
241
241
  "cli-token": cliToken,
242
+ ...sandboxEndpoint && external?.taskContext ? {
243
+ "X-Task-CLI-Grant": external.taskContext.grant,
244
+ "X-Task-CLI-Execution": external.taskContext.executionId,
245
+ "X-Task-CLI-Company": external.taskContext.companyId,
246
+ "X-Task-CLI-Sandbox": external.taskContext.sandboxId
247
+ } : {},
242
248
  ...internalCallSourceHeaders(),
243
249
  ...contentTypeHeader
244
250
  },