nolo-cli 0.156.0 → 0.157.0

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 (48) hide show
  1. package/{_executeModel-3FMHTHSS.js → _executeModel-ZIQHOREX.js} +13 -13
  2. package/{agentDeleteCommand-VRHLJZKX.js → agentDeleteCommand-LQSOJEXY.js} +11 -11
  3. package/{agentEmailCommands-YGBQXOL3.js → agentEmailCommands-HTPKXONW.js} +13 -13
  4. package/{agentMachineCommands-FBAWZYHI.js → agentMachineCommands-T7DAZG77.js} +1 -1
  5. package/{agentRecordCommands-KAK2G56H.js → agentRecordCommands-HSW3RJ4H.js} +12 -12
  6. package/{agentRunCommand-62P3AGJA.js → agentRunCommand-TIRJ57DK.js} +13 -13
  7. package/{agentRunControl-XBSNHHZE.js → agentRunControl-QWFFIAQY.js} +3 -1
  8. package/{agentSlice-IZFU3WWH.js → agentSlice-JNM3HF3V.js} +1 -1
  9. package/{chunk-JIAZK434.js → chunk-4226O6F7.js} +2 -2
  10. package/{chunk-HRZW3SQN.js → chunk-5EDQTOUR.js} +1 -1
  11. package/{chunk-K3N2DWLT.js → chunk-6Y3ETA2Y.js} +2 -2
  12. package/{chunk-4FDDVVCE.js → chunk-B3ZIFOFI.js} +2 -2
  13. package/{chunk-U5U4WAFS.js → chunk-FHG46N5C.js} +36 -3
  14. package/{chunk-7YQQXP42.js → chunk-GGUTTH6C.js} +2 -2
  15. package/{chunk-FTHF2P2I.js → chunk-IKOKYBYJ.js} +1 -1
  16. package/{chunk-6QIBWOPT.js → chunk-K6Y5T4GE.js} +2 -2
  17. package/{chunk-CI6YDDL2.js → chunk-KESKU5BG.js} +2 -2
  18. package/{chunk-CNWKLQRL.js → chunk-KSTEXKL6.js} +70 -36
  19. package/{chunk-SNAWGDXT.js → chunk-LPO6AMQU.js} +526 -69
  20. package/{chunk-UUPXTEZA.js → chunk-MLEANT7D.js} +1 -1
  21. package/{chunk-7PDNSQZC.js → chunk-MMSQTZCJ.js} +2 -2
  22. package/{chunk-QFL42TMV.js → chunk-MR3ITQEV.js} +102 -20
  23. package/{chunk-PNACBSRF.js → chunk-NLFTBC6S.js} +194 -31
  24. package/{chunk-Q5LVXPGT.js → chunk-OLUKIUX6.js} +2 -2
  25. package/{chunk-EDJND3FK.js → chunk-R7GCGOGZ.js} +3 -3
  26. package/{chunk-V67W64OY.js → chunk-UVYSBQ2M.js} +7 -7
  27. package/{chunk-2QQ7D3P5.js → chunk-XZIW3Q5B.js} +8 -8
  28. package/{chunk-36IWXF25.js → chunk-YN5DT4JS.js} +5 -5
  29. package/{chunk-GXZZOTDM.js → chunk-ZKVS36H3.js} +4545 -3343
  30. package/{commandRegistry-2DDDET7G.js → commandRegistry-DR2RPWK6.js} +26 -26
  31. package/{contentThunks-5DNEHJ2Z.js → contentThunks-CSJDJDEJ.js} +3 -3
  32. package/{createAgentAutomationAction-4SUS2EFX.js → createAgentAutomationAction-ISEUEQSY.js} +3 -3
  33. package/{createDialogAction-JSFXX6JE.js → createDialogAction-HUCFOZY3.js} +4 -4
  34. package/{createPageAction-37HHOXZ2.js → createPageAction-DT5CYXCL.js} +4 -4
  35. package/{dialogCommands-ZJRMCP4S.js → dialogCommands-3W6AIUXT.js} +2 -2
  36. package/{dialogSlice-2Z66AWEW.js → dialogSlice-WJEEPG4W.js} +2 -2
  37. package/{docStore-XMTUF3GX.js → docStore-7JPYT25V.js} +1 -1
  38. package/{handleSendMessageAction-4VFVXTF2.js → handleSendMessageAction-BV5FMID4.js} +7 -7
  39. package/index.js +3 -3
  40. package/{localRuntimeAdapter-KKIVRYVN.js → localRuntimeAdapter-6FBEJJ4D.js} +11 -11
  41. package/{machineCommands-UHQVCOD3.js → machineCommands-WCAFDI5N.js} +12 -12
  42. package/{machineWsRunDispatch-TX4X7TOJ.js → machineWsRunDispatch-ZF6BBQ3X.js} +12 -12
  43. package/package.json +1 -1
  44. package/{readlineWorkspace-BFVB2ON5.js → readlineWorkspace-I5MHMEUE.js} +14 -14
  45. package/{runAgentClientLoop-HHLHNMBE.js → runAgentClientLoop-TSNSRQEP.js} +11 -11
  46. package/{streamAgentChatTurn-KNPOLET7.js → streamAgentChatTurn-RJLDV4WZ.js} +13 -13
  47. package/{tools-ULA7XJQT.js → tools-X6QNIYFJ.js} +8 -8
  48. package/{updateDialogTitleAction-VUIVBDAS.js → updateDialogTitleAction-6LURCTMG.js} +3 -3
@@ -42,7 +42,7 @@ import {
42
42
  } from "./chunk-I42VC5KR.js";
43
43
  import {
44
44
  resolveRunsDir
45
- } from "./chunk-SNAWGDXT.js";
45
+ } from "./chunk-LPO6AMQU.js";
46
46
  import {
47
47
  getDefaultCliLocalRuntimeDb
48
48
  } from "./chunk-GAGGEA7D.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-JIAZK434.js";
4
+ } from "./chunk-4226O6F7.js";
5
5
  import {
6
6
  updateTokensAction
7
- } from "./chunk-2QQ7D3P5.js";
7
+ } from "./chunk-XZIW3Q5B.js";
8
8
  import {
9
9
  applyUpdateTokensFulfilled
10
10
  } from "./chunk-OWYYDMGJ.js";
@@ -20,7 +20,7 @@ import {
20
20
  toolRunUpdated,
21
21
  uiCardFallback,
22
22
  waitForAbortableDelay
23
- } from "./chunk-6QIBWOPT.js";
23
+ } from "./chunk-K6Y5T4GE.js";
24
24
  import {
25
25
  isGatewayHttpStatus
26
26
  } from "./chunk-NF64D32W.js";
@@ -52,7 +52,7 @@ import {
52
52
  } from "./chunk-3L5MSPWX.js";
53
53
  import {
54
54
  markdownToSlate
55
- } from "./chunk-CNWKLQRL.js";
55
+ } from "./chunk-KSTEXKL6.js";
56
56
  import {
57
57
  extractMentionsFromSlate
58
58
  } from "./chunk-AGIM7IMJ.js";
@@ -64,7 +64,7 @@ import {
64
64
  } from "./chunk-VF4K2QE6.js";
65
65
  import {
66
66
  createDocState
67
- } from "./chunk-K3N2DWLT.js";
67
+ } from "./chunk-6Y3ETA2Y.js";
68
68
  import {
69
69
  addMemberSpace,
70
70
  fetchAuthoritativeRemoteSpace,
@@ -79,7 +79,7 @@ import {
79
79
  } from "./chunk-BAWAKW7X.js";
80
80
  import {
81
81
  createDialogAction
82
- } from "./chunk-4FDDVVCE.js";
82
+ } from "./chunk-B3ZIFOFI.js";
83
83
  import {
84
84
  setDialogExtraReferencesAction
85
85
  } from "./chunk-IF7V3CBU.js";
@@ -102,7 +102,7 @@ import {
102
102
  updateContentCategory,
103
103
  updateContentTitle,
104
104
  writeStoredCollapsedCategories
105
- } from "./chunk-FTHF2P2I.js";
105
+ } from "./chunk-IKOKYBYJ.js";
106
106
  import {
107
107
  buildDatabaseFileContentUrl,
108
108
  deleteDialog,
@@ -115,7 +115,7 @@ import {
115
115
  selectMsgById,
116
116
  uiAskChoiceFunc,
117
117
  uiAskChoiceFunctionSchema
118
- } from "./chunk-2QQ7D3P5.js";
118
+ } from "./chunk-XZIW3Q5B.js";
119
119
  import {
120
120
  buildMediaToolConfirmation,
121
121
  normalizeMediaConfirmExecutionRevision
@@ -126,7 +126,7 @@ import {
126
126
  runLlm,
127
127
  streamAgentChatTurn,
128
128
  updateAgent
129
- } from "./chunk-EDJND3FK.js";
129
+ } from "./chunk-R7GCGOGZ.js";
130
130
  import {
131
131
  getCurrentSpaceId,
132
132
  getCurrentSpaceIdRaw,
@@ -3882,7 +3882,7 @@ async function deleteDialogsFunc(args, thunkApi) {
3882
3882
  const deletedDialogIds = [];
3883
3883
  const deletedDialogKeys = [];
3884
3884
  const failures = [];
3885
- const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-2Z66AWEW.js");
3885
+ const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-WJEEPG4W.js");
3886
3886
  for (const target of targets) {
3887
3887
  try {
3888
3888
  await thunkApi.dispatch(deleteDialog2(target.dbKey)).unwrap();
@@ -14818,9 +14818,29 @@ function buildRuntimeCatalog(deps) {
14818
14818
  reason: dockerReadiness.reason ?? "not-configured",
14819
14819
  ...dockerReadiness.details ? { details: dockerReadiness.details } : {}
14820
14820
  };
14821
+ const isInstaboxBound = deps.isInstaboxBound ? Boolean(deps.isInstaboxBound(ctx.owner)) : false;
14822
+ const instaboxReady = Boolean(isInstaboxBound && deps.instaboxReadiness?.ready === true);
14823
+ const instaboxKey = key(ctx.scope, ctx.owner, "instabox");
14824
+ const instaboxSummary = instaboxReady ? {
14825
+ runtimeKey: instaboxKey,
14826
+ kind: "instabox",
14827
+ name: "Instabox",
14828
+ status: "ready",
14829
+ selectable: true,
14830
+ ...deps.instaboxReadiness?.quotaSnapshot ? { quotaSnapshot: deps.instaboxReadiness.quotaSnapshot } : {}
14831
+ } : {
14832
+ runtimeKey: instaboxKey,
14833
+ kind: "instabox",
14834
+ name: "Instabox",
14835
+ status: "unavailable",
14836
+ selectable: false,
14837
+ reason: isInstaboxBound ? deps.instaboxReadiness?.reason ?? "quota-unverifiable" : "not-configured",
14838
+ ...isInstaboxBound && !deps.instaboxReadiness ? { details: "Instabox credentials configured but readiness not probed" } : deps.instaboxReadiness?.details ? { details: deps.instaboxReadiness.details } : {}
14839
+ };
14821
14840
  runtimes.push(
14822
14841
  summary("local", "Local (client only)", false, "unsupported-local"),
14823
14842
  dockerSummary,
14843
+ instaboxSummary,
14824
14844
  summary("cloudflare", "Cloudflare", false, "not-configured")
14825
14845
  );
14826
14846
  return { runtimes, selectableCount: runtimes.filter((runtime) => runtime.selectable).length };
@@ -14847,6 +14867,7 @@ function formatRuntimeSummaryCard(runtimes) {
14847
14867
  return `Available Runtimes:
14848
14868
  ${lines.join("\n")}`;
14849
14869
  }
14870
+ var serverHooks;
14850
14871
  async function resolveTrustedDockerReadiness(thunkApi, trustedContext) {
14851
14872
  const source = trustedContext?.dockerReadinessSource ?? thunkApi?.extra?.dockerReadinessSource;
14852
14873
  if (source && typeof source.get === "function") {
@@ -14867,19 +14888,66 @@ async function resolveTrustedDockerReadiness(thunkApi, trustedContext) {
14867
14888
  dockerQuotaSnapshot: trustedContext?.dockerQuotaSnapshot ?? thunkApi?.extra?.dockerQuotaSnapshot
14868
14889
  });
14869
14890
  }
14870
- async function loadDockerBindingIsBoundFallback() {
14871
- try {
14872
- const { getDockerBindingAuthorizer } = await import("../../../server/handlers/agentRun/dockerWorkloadLifecycle");
14873
- return (caller) => Boolean(getDockerBindingAuthorizer().isBound?.(caller));
14874
- } catch {
14875
- return void 0;
14891
+ function loadDockerBindingIsBoundFallback() {
14892
+ if (serverHooks?.getDockerBindingAuthorizer) {
14893
+ try {
14894
+ const authorizer = serverHooks.getDockerBindingAuthorizer();
14895
+ return (caller) => Boolean(authorizer?.isBound?.(caller));
14896
+ } catch {
14897
+ return void 0;
14898
+ }
14899
+ }
14900
+ return void 0;
14901
+ }
14902
+ async function loadInstaboxBoundFallback(callerUserId) {
14903
+ if (!callerUserId) return false;
14904
+ if (serverHooks?.isInstaboxBound) {
14905
+ try {
14906
+ return await serverHooks.isInstaboxBound(callerUserId);
14907
+ } catch {
14908
+ return false;
14909
+ }
14910
+ }
14911
+ return false;
14912
+ }
14913
+ async function resolveTrustedInstaboxReadiness(callerUserId, thunkApi, trustedContext, isInstaboxBound) {
14914
+ const source = trustedContext?.instaboxReadinessSource ?? thunkApi?.extra?.instaboxReadinessSource;
14915
+ if (source && typeof source.get === "function" && callerUserId) {
14916
+ try {
14917
+ return await source.get(callerUserId);
14918
+ } catch {
14919
+ return {
14920
+ ready: false,
14921
+ reason: "quota-unverifiable",
14922
+ details: "Instabox readiness source probe failed"
14923
+ };
14924
+ }
14876
14925
  }
14926
+ const injected = trustedContext?.instaboxReadiness ?? thunkApi?.extra?.instaboxReadiness;
14927
+ if (injected) return injected;
14928
+ if (callerUserId && isInstaboxBound?.(callerUserId)) {
14929
+ if (serverHooks?.getInstaboxReadiness) {
14930
+ try {
14931
+ return await serverHooks.getInstaboxReadiness(callerUserId);
14932
+ } catch {
14933
+ return void 0;
14934
+ }
14935
+ }
14936
+ }
14937
+ return void 0;
14877
14938
  }
14878
14939
  function resolveTrustedCallerUserId(thunkApi, trustedContext) {
14879
- const bound = trustedContext?.callerUserId;
14880
- if (bound !== void 0 && bound !== null) return bound;
14881
- const fromStore = selectIdentityUserId(thunkApi?.getState?.());
14882
- if (fromStore) return fromStore;
14940
+ if (trustedContext && "callerUserId" in trustedContext) {
14941
+ const bound = trustedContext.callerUserId;
14942
+ return typeof bound === "string" ? bound : "";
14943
+ }
14944
+ if (typeof thunkApi?.getState === "function") {
14945
+ const state2 = thunkApi.getState();
14946
+ if (state2 != null) {
14947
+ const fromStore = selectIdentityUserId(state2);
14948
+ if (fromStore) return fromStore;
14949
+ }
14950
+ }
14883
14951
  const fromExtra = thunkApi?.extra?.userId;
14884
14952
  return typeof fromExtra === "string" ? fromExtra : void 0;
14885
14953
  }
@@ -14896,6 +14964,18 @@ async function listRuntimesToolFunc(_args, thunkApi, trustedContext) {
14896
14964
  const connectorSurface = trustedContext?.connectorSurface ?? "cli";
14897
14965
  const dockerReadiness = await resolveTrustedDockerReadiness(thunkApi, trustedContext);
14898
14966
  const isDockerBound = trustedContext?.isDockerBound ?? thunkApi?.extra?.isDockerBound ?? (trustedContext?.dockerSelectable === true ? () => true : void 0) ?? (trustedContext?.dockerReadinessSource ? () => true : void 0) ?? await loadDockerBindingIsBoundFallback();
14967
+ const explicitInstaboxBound = trustedContext?.isInstaboxBound ?? thunkApi?.extra?.isInstaboxBound;
14968
+ let isInstaboxBound = explicitInstaboxBound;
14969
+ if (!isInstaboxBound && callerUserId) {
14970
+ const bound = await loadInstaboxBoundFallback(callerUserId);
14971
+ isInstaboxBound = (caller) => caller === callerUserId ? bound : false;
14972
+ }
14973
+ const instaboxReadiness = await resolveTrustedInstaboxReadiness(
14974
+ callerUserId,
14975
+ thunkApi,
14976
+ trustedContext,
14977
+ isInstaboxBound
14978
+ );
14899
14979
  if (!callerUserId || !callerUserId.trim()) {
14900
14980
  return {
14901
14981
  rawData: {
@@ -14915,7 +14995,9 @@ async function listRuntimesToolFunc(_args, thunkApi, trustedContext) {
14915
14995
  machineRegistry,
14916
14996
  connectorConnections,
14917
14997
  dockerReadiness,
14918
- isDockerBound
14998
+ isDockerBound,
14999
+ isInstaboxBound,
15000
+ instaboxReadiness
14919
15001
  });
14920
15002
  return {
14921
15003
  rawData: {
@@ -18481,7 +18563,7 @@ async function updateDocFunc(args, thunkApi) {
18481
18563
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
18482
18564
  };
18483
18565
  await dispatch(write({ data: updatedPageData, customKey: id })).unwrap();
18484
- const { getDocState, applyExternalDocUpdate } = await import("./docStore-XMTUF3GX.js");
18566
+ const { getDocState, applyExternalDocUpdate } = await import("./docStore-7JPYT25V.js");
18485
18567
  if (getDocState().pageKey === id) {
18486
18568
  applyExternalDocUpdate({
18487
18569
  slateData: finalSlateData,
@@ -9,16 +9,19 @@ import {
9
9
  resolveRawAgentInput,
10
10
  resolveServerUrl,
11
11
  writeUsage
12
- } from "./chunk-U5U4WAFS.js";
12
+ } from "./chunk-FHG46N5C.js";
13
13
  import {
14
14
  getReadableCliDb
15
15
  } from "./chunk-62TBKWTV.js";
16
16
  import {
17
+ INSTABOX_RUN_CONFIG_ENV,
17
18
  createCliLocalRuntimeAdapter,
18
19
  detectCurrentMachineId,
20
+ hashInstaboxDeliveryManifest,
19
21
  isBuiltinNoloAgentRef,
20
22
  isCliProviderAgentConfig,
21
23
  isDockerRuntimeKey,
24
+ isInstaboxBillingPolicy,
22
25
  isLiveAgentRunObservation,
23
26
  isMachineBoundLocalhostCustomProvider,
24
27
  isSubtaskRun,
@@ -26,8 +29,9 @@ import {
26
29
  resolveAuthToken as resolveAuthToken2,
27
30
  resolveBoundMachineId,
28
31
  resolveFileWriteGateEnabled,
29
- resolveLocalUserId
30
- } from "./chunk-GXZZOTDM.js";
32
+ resolveLocalUserId,
33
+ validateInstaboxWorkspaceSelection
34
+ } from "./chunk-ZKVS36H3.js";
31
35
  import {
32
36
  clearCredentialAvailability,
33
37
  readCredentialEntry,
@@ -75,14 +79,14 @@ import {
75
79
  } from "./chunk-BMQ2MJUK.js";
76
80
  import {
77
81
  resolveCliLocalRuntimeKeyCapability
78
- } from "./chunk-QFL42TMV.js";
82
+ } from "./chunk-MR3ITQEV.js";
79
83
  import {
80
84
  isTransientFetchError
81
85
  } from "./chunk-KFHREHUQ.js";
82
86
  import {
83
87
  parseUiCard,
84
88
  uiCardFallback
85
- } from "./chunk-6QIBWOPT.js";
89
+ } from "./chunk-K6Y5T4GE.js";
86
90
  import {
87
91
  isGatewayHttpStatus
88
92
  } from "./chunk-NF64D32W.js";
@@ -91,7 +95,7 @@ import {
91
95
  chooseMemoryOwners,
92
96
  loadMemoryCandidatesFromDb,
93
97
  resolveAgentMemoryPolicy
94
- } from "./chunk-4FDDVVCE.js";
98
+ } from "./chunk-B3ZIFOFI.js";
95
99
  import {
96
100
  API_REPORTED_COST_MULTIPLIER,
97
101
  estimateMessagesTokens,
@@ -99,7 +103,7 @@ import {
99
103
  resolveAgentContextWindow,
100
104
  resolveOccupancy,
101
105
  resolveOccupancyWindow
102
- } from "./chunk-2QQ7D3P5.js";
106
+ } from "./chunk-XZIW3Q5B.js";
103
107
  import {
104
108
  buildSkillDiscoveryContextLayer
105
109
  } from "./chunk-AU7AXHUL.js";
@@ -178,10 +182,11 @@ import {
178
182
  recordRunResultHeaderMeta,
179
183
  resolveResultServerMeta,
180
184
  resolveRunQueuePath,
185
+ resolveRunsDir,
181
186
  serverOriginForDialog,
182
187
  settleRunTerminalAuthoritatively,
183
188
  spawnLocalBackgroundRun
184
- } from "./chunk-SNAWGDXT.js";
189
+ } from "./chunk-LPO6AMQU.js";
185
190
  import {
186
191
  formatAgentListCard,
187
192
  formatFinishedRunCard,
@@ -238,6 +243,148 @@ import {
238
243
  asTrimmedLowercaseString
239
244
  } from "./chunk-QSJ3HFEF.js";
240
245
 
246
+ // packages/cli/client/instaboxRunConfigWrite.ts
247
+ import { randomUUID } from "node:crypto";
248
+ import { lstatSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
249
+ import { isAbsolute, join, normalize, resolve } from "node:path";
250
+ var InstaboxRunConfigWriteError = class extends Error {
251
+ code;
252
+ constructor(code, message) {
253
+ super(`instabox_run_config_write:${code}: ${message}`);
254
+ this.name = "InstaboxRunConfigWriteError";
255
+ this.code = `instabox_run_config_write:${code}`;
256
+ }
257
+ };
258
+ var fail = (code, msg) => {
259
+ throw new InstaboxRunConfigWriteError(code, msg);
260
+ };
261
+ function writeInstaboxRunConfig(options) {
262
+ const { workspaceMode, artifactDir, manifestPath, allowRemoteRelease } = options;
263
+ if (workspaceMode !== "empty" && workspaceMode !== "snapshot") {
264
+ fail("invalid_workspace_mode", 'workspaceMode \u5FC5\u987B\u662F "empty" \u6216 "snapshot"');
265
+ }
266
+ const trimmedArtifactDir = artifactDir?.trim();
267
+ if (!trimmedArtifactDir) {
268
+ fail("missing_artifact_dir", "artifactDir \u5FC5\u987B\u662F\u975E\u7A7A\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u672A\u914D\u7F6E\u6216\u9ED8\u8BA4\u5747\u88AB\u62D2\u7EDD");
269
+ }
270
+ if (!isAbsolute(trimmedArtifactDir) || trimmedArtifactDir.includes("\0") || trimmedArtifactDir.split("/").includes("..")) {
271
+ fail("invalid_artifact_dir", `artifactDir \u5FC5\u987B\u4E3A\u5408\u6CD5\u7684\u7EDD\u5BF9\u8DEF\u5F84\u4E14\u4E0D\u80FD\u5305\u542B .. \u6216\u7A7A\u5B57\u7B26: "${trimmedArtifactDir}"`);
272
+ }
273
+ const approvalId = `appr-${randomUUID()}`;
274
+ const bindingId = `bind-${randomUUID()}`;
275
+ const freeCreateEvidenceId = `fce-${randomUUID()}`;
276
+ const workspaceAuthorizationId = `wauth-${randomUUID()}`;
277
+ const recoverySupportId = `rcv-${randomUUID()}`;
278
+ let manifest = null;
279
+ let manifestSha256 = null;
280
+ let allowedPaths = [];
281
+ if (workspaceMode === "snapshot") {
282
+ const rawPath = manifestPath ? manifestPath.trim() : "";
283
+ if (!rawPath) {
284
+ fail("missing_manifest_path", 'workspaceMode \u4E3A "snapshot" \u65F6\u5FC5\u987B\u63D0\u4F9B manifest \u6587\u4EF6\u8DEF\u5F84');
285
+ }
286
+ const resolvedManifestPath = resolve(rawPath);
287
+ let rawText = "";
288
+ try {
289
+ const reader = options.readTextFile ?? ((p) => readFileSync(p, "utf8"));
290
+ rawText = reader(resolvedManifestPath);
291
+ } catch (err) {
292
+ fail(
293
+ "manifest_read_failed",
294
+ `\u8BFB\u53D6 manifest \u6587\u4EF6\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`
295
+ );
296
+ }
297
+ let parsedManifest;
298
+ try {
299
+ parsedManifest = JSON.parse(rawText);
300
+ } catch (err) {
301
+ fail(
302
+ "invalid_manifest_json",
303
+ `manifest \u6587\u4EF6 JSON \u89E3\u6790\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`
304
+ );
305
+ }
306
+ try {
307
+ manifestSha256 = hashInstaboxDeliveryManifest(parsedManifest);
308
+ validateInstaboxWorkspaceSelection({
309
+ workspaceMode: "approved-snapshot",
310
+ manifest: parsedManifest,
311
+ approval: {
312
+ id: approvalId,
313
+ manifestSha256
314
+ }
315
+ });
316
+ } catch (err) {
317
+ fail(
318
+ "invalid_manifest_selection",
319
+ `manifest \u6821\u9A8C\u672A\u901A\u8FC7: ${err instanceof Error ? err.message : String(err)}`
320
+ );
321
+ }
322
+ manifest = parsedManifest;
323
+ allowedPaths = parsedManifest.files.map((f) => f.path);
324
+ } else {
325
+ if (manifestPath && manifestPath.trim()) {
326
+ fail("unexpected_manifest", 'workspaceMode \u4E3A "empty" \u65F6\u4E0D\u5F97\u63D0\u4F9B manifest');
327
+ }
328
+ }
329
+ const rawBillingPolicy = options.billingPolicy ?? (options.allowPaid ? "allow-paid" : "free-only");
330
+ if (!isInstaboxBillingPolicy(rawBillingPolicy)) {
331
+ fail("invalid_billing_policy", `billingPolicy \u5FC5\u987B\u4E3A "free-only" \u6216 "allow-paid"\uFF0C\u6536\u5230 "${rawBillingPolicy}"`);
332
+ }
333
+ const billingPolicy = rawBillingPolicy;
334
+ const env = options.env ?? process.env;
335
+ const isPaid = options.isPaidAccount === true || options.account?.isPaid === true || options.account?.kind === "paid" || options.account?.accountKind === "paid" || env?.INSTABOX_ACCOUNT_KIND === "paid" || env?.INSTABOX_ACCOUNT_TYPE === "paid" || env?.INSTABOX_PAID_ACCOUNT === "true" || env?.INSTABOX_PAID_ACCOUNT === "1";
336
+ if (isPaid && billingPolicy !== "allow-paid") {
337
+ fail("paid_account_disallowed", "\u4ED8\u8D39 Instabox \u8D26\u53F7\u9700\u663E\u5F0F --instabox-allow-paid");
338
+ }
339
+ const config = {
340
+ bindingId,
341
+ freeCreateEvidenceId,
342
+ workspaceAuthorizationId,
343
+ recoverySupportId,
344
+ workspaceMode: workspaceMode === "snapshot" ? "approved-snapshot" : "empty",
345
+ billingPolicy,
346
+ approvalId,
347
+ artifactRoot: trimmedArtifactDir,
348
+ allowRemoteRelease: Boolean(allowRemoteRelease),
349
+ allowedPaths
350
+ };
351
+ if (workspaceMode === "snapshot" && manifest && manifestSha256) {
352
+ config.manifest = manifest;
353
+ config.manifestSha256 = manifestSha256;
354
+ }
355
+ const runsDir = options.runsDir ?? resolveRunsDir(env);
356
+ const normalizedRunsDir = normalize(resolve(runsDir));
357
+ try {
358
+ mkdirSync(normalizedRunsDir, { recursive: true, mode: 448 });
359
+ } catch (err) {
360
+ fail("mkdir_failed", `\u521B\u5EFA runs \u76EE\u5F55\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
361
+ }
362
+ const fileName = `instabox-run-${randomUUID()}.json`;
363
+ const targetPath = join(normalizedRunsDir, fileName);
364
+ try {
365
+ writeFileSync(targetPath, JSON.stringify(config, null, 2), {
366
+ flag: "wx",
367
+ mode: 384
368
+ });
369
+ } catch (err) {
370
+ fail("file_write_failed", `\u72EC\u5360\u521B\u5EFA\u53D7\u63A7\u914D\u7F6E\u6587\u4EF6\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
371
+ }
372
+ try {
373
+ const stats = lstatSync(targetPath);
374
+ if (stats.isSymbolicLink() || !stats.isFile()) {
375
+ fail("symlink_rejected", `\u914D\u7F6E\u6587\u4EF6\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5\u6216\u975E\u5E38\u89C4\u6587\u4EF6: ${targetPath}`);
376
+ }
377
+ } catch (err) {
378
+ if (err instanceof InstaboxRunConfigWriteError) throw err;
379
+ fail("file_stat_failed", `\u68C0\u9A8C\u914D\u7F6E\u6587\u4EF6\u72B6\u6001\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
380
+ }
381
+ process.env[INSTABOX_RUN_CONFIG_ENV] = targetPath;
382
+ if (options.env) {
383
+ options.env[INSTABOX_RUN_CONFIG_ENV] = targetPath;
384
+ }
385
+ return { configPath: targetPath, config };
386
+ }
387
+
241
388
  // packages/agent-runtime/modelLayerOverride.ts
242
389
  var MODEL_LAYER_KEYS = [
243
390
  "provider",
@@ -12728,7 +12875,7 @@ import * as nodeFs from "node:fs";
12728
12875
  var CLI_AUTO_ROUTE_AGENT_KEY = BUILTIN_NOLO_AGENT_KEY;
12729
12876
 
12730
12877
  // packages/agent-runtime/hostEnvironment.ts
12731
- import { existsSync, readFileSync } from "node:fs";
12878
+ import { existsSync, readFileSync as readFileSync2 } from "node:fs";
12732
12879
  import os from "node:os";
12733
12880
  function parseLinuxOsRelease(content) {
12734
12881
  let prettyName;
@@ -12767,9 +12914,9 @@ function probeHostEnvironment(options) {
12767
12914
  if (osReleaseText === void 0) {
12768
12915
  try {
12769
12916
  if (existsSync("/etc/os-release")) {
12770
- osReleaseText = readFileSync("/etc/os-release", "utf8");
12917
+ osReleaseText = readFileSync2("/etc/os-release", "utf8");
12771
12918
  } else if (existsSync("/usr/lib/os-release")) {
12772
- osReleaseText = readFileSync("/usr/lib/os-release", "utf8");
12919
+ osReleaseText = readFileSync2("/usr/lib/os-release", "utf8");
12773
12920
  }
12774
12921
  } catch {
12775
12922
  }
@@ -12835,16 +12982,16 @@ function buildHostEnvironmentLayer(options) {
12835
12982
  }
12836
12983
 
12837
12984
  // packages/agent-runtime/agentsMd.ts
12838
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
12839
- import { join } from "node:path";
12985
+ import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:fs";
12986
+ import { join as join2 } from "node:path";
12840
12987
  var AGENTS_MD_MAX_BYTES = 8192;
12841
12988
  var AGENTS_MD_CANDIDATES = ["AGENTS.md", "CLAUDE.md"];
12842
12989
  function readAgentsMdLayerFromDisk(cwd) {
12843
12990
  for (const name of AGENTS_MD_CANDIDATES) {
12844
- const filePath = join(cwd, name);
12991
+ const filePath = join2(cwd, name);
12845
12992
  if (!existsSync2(filePath)) continue;
12846
12993
  try {
12847
- let content = readFileSync2(filePath, "utf8").trim();
12994
+ let content = readFileSync3(filePath, "utf8").trim();
12848
12995
  if (!content) continue;
12849
12996
  if (Buffer.byteLength(content, "utf8") > AGENTS_MD_MAX_BYTES) {
12850
12997
  content = Buffer.from(content, "utf8").subarray(0, AGENTS_MD_MAX_BYTES).toString("utf8") + "\n\n<!-- AGENTS.md truncated -->";
@@ -12914,17 +13061,17 @@ function runDoDCommands(commands, cwd, deps = {}) {
12914
13061
  }
12915
13062
 
12916
13063
  // packages/cli/agentRunPrompts.ts
12917
- import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync, statSync as statSync2 } from "node:fs";
12918
- import { dirname, extname, isAbsolute, join as join2, relative as relativePath, resolve, sep } from "node:path";
13064
+ import { existsSync as existsSync3, readFileSync as readFileSync4, readdirSync, statSync as statSync2 } from "node:fs";
13065
+ import { dirname, extname, isAbsolute as isAbsolute2, join as join3, relative as relativePath, resolve as resolve2, sep } from "node:path";
12919
13066
  function workflowRefToCandidatePath(cwd, ref) {
12920
13067
  const normalized = ref.trim();
12921
13068
  if (!normalized) return "";
12922
13069
  if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
12923
- const directPath = resolve(cwd, normalized);
13070
+ const directPath = resolve2(cwd, normalized);
12924
13071
  if (existsSync3(directPath)) return directPath;
12925
13072
  }
12926
13073
  const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
12927
- return resolve(cwd, "docs", "workflows", `${fileName}.md`);
13074
+ return resolve2(cwd, "docs", "workflows", `${fileName}.md`);
12928
13075
  }
12929
13076
  var SKILL_SEARCH_DIRS = [
12930
13077
  ".agents/skills"
@@ -12933,22 +13080,22 @@ function skillRefToCandidatePath(cwd, ref) {
12933
13080
  const normalized = ref.trim();
12934
13081
  if (!normalized) return "";
12935
13082
  if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
12936
- const directPath = resolve(cwd, normalized);
13083
+ const directPath = resolve2(cwd, normalized);
12937
13084
  if (existsSync3(directPath)) return directPath;
12938
13085
  }
12939
13086
  const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
12940
13087
  for (const dir of SKILL_SEARCH_DIRS) {
12941
- const skillMdPath = resolve(cwd, dir, fileName, "SKILL.md");
13088
+ const skillMdPath = resolve2(cwd, dir, fileName, "SKILL.md");
12942
13089
  if (existsSync3(skillMdPath)) return skillMdPath;
12943
13090
  }
12944
- return resolve(cwd, ".agents", "skills", fileName, "SKILL.md");
13091
+ return resolve2(cwd, ".agents", "skills", fileName, "SKILL.md");
12945
13092
  }
12946
13093
  async function resolveWorkflowReference(ref, cwd = process.cwd()) {
12947
13094
  const path2 = workflowRefToCandidatePath(cwd, ref);
12948
13095
  if (!path2 || !existsSync3(path2)) {
12949
13096
  throw new Error(`Workflow reference not found: ${ref}`);
12950
13097
  }
12951
- const markdown = readFileSync3(path2, "utf8");
13098
+ const markdown = readFileSync4(path2, "utf8");
12952
13099
  const parsed = parseSkillDocProtocol(markdown);
12953
13100
  return {
12954
13101
  ref,
@@ -12958,15 +13105,15 @@ async function resolveWorkflowReference(ref, cwd = process.cwd()) {
12958
13105
  }
12959
13106
  function inlineRelativeRefs(body, skillDir) {
12960
13107
  const refPattern = /\[([^\]]+)\]\((\.\/[^)]+|[^)]+\/[^)]+)\)/g;
12961
- const normalizedSkillDir = resolve(skillDir) + sep;
13108
+ const normalizedSkillDir = resolve2(skillDir) + sep;
12962
13109
  return body.replace(refPattern, (match, label, relPath) => {
12963
13110
  const cleaned = relPath.trim();
12964
13111
  if (!cleaned.startsWith("./") && !cleaned.startsWith("../")) return match;
12965
- const absPath = resolve(skillDir, cleaned);
13112
+ const absPath = resolve2(skillDir, cleaned);
12966
13113
  const relative = relativePath(normalizedSkillDir, absPath);
12967
- if (relative.startsWith("..") || isAbsolute(relative)) return match;
13114
+ if (relative.startsWith("..") || isAbsolute2(relative)) return match;
12968
13115
  if (!existsSync3(absPath) || !absPath.endsWith(".md")) return match;
12969
- const refContent = readFileSync3(absPath, "utf8");
13116
+ const refContent = readFileSync4(absPath, "utf8");
12970
13117
  return `
12971
13118
 
12972
13119
  ### ${label}
@@ -12977,7 +13124,7 @@ ${refContent}
12977
13124
  });
12978
13125
  }
12979
13126
  function listSkillScripts(skillDir) {
12980
- const scriptsDir = join2(skillDir, "scripts");
13127
+ const scriptsDir = join3(skillDir, "scripts");
12981
13128
  if (!existsSync3(scriptsDir) || !statSync2(scriptsDir).isDirectory()) return null;
12982
13129
  const entries = readdirSync(scriptsDir).filter((e) => !e.startsWith("."));
12983
13130
  if (entries.length === 0) return null;
@@ -13008,7 +13155,7 @@ async function resolveSkillReference(ref, options = {}) {
13008
13155
  if (!path2 || !existsSync3(path2)) {
13009
13156
  throw new Error(`Skill reference not found: ${ref}`);
13010
13157
  }
13011
- markdown = readFileSync3(path2, "utf8");
13158
+ markdown = readFileSync4(path2, "utf8");
13012
13159
  filePath = path2;
13013
13160
  skillDir = dirname(path2);
13014
13161
  }
@@ -13112,9 +13259,9 @@ function prependSubjectDialogMarker(message, subjectDialogKey) {
13112
13259
  }
13113
13260
  function normalizeCliImageInput(input) {
13114
13261
  if (/^(https?:|data:|file:)/i.test(input)) return input;
13115
- const absolutePath = resolve(input);
13262
+ const absolutePath = resolve2(input);
13116
13263
  if (!existsSync3(absolutePath)) return input;
13117
- const base64 = readFileSync3(absolutePath).toString("base64");
13264
+ const base64 = readFileSync4(absolutePath).toString("base64");
13118
13265
  return `data:${imageMimeTypeForPath(absolutePath)};base64,${base64}`;
13119
13266
  }
13120
13267
  function imageMimeTypeForPath(path2) {
@@ -15658,6 +15805,22 @@ async function runAgentRunCommand(args, deps) {
15658
15805
  if (!localRuntimeCwd && (parsed.runtimeMode === "local" || hostRuntimeLocal)) {
15659
15806
  localRuntimeCwd = process.cwd();
15660
15807
  }
15808
+ if (parsed.runtimeKey === "instabox") {
15809
+ try {
15810
+ writeInstaboxRunConfig({
15811
+ workspaceMode: parsed.instaboxWorkspace,
15812
+ artifactDir: parsed.instaboxArtifactDir,
15813
+ manifestPath: parsed.instaboxManifestPath,
15814
+ allowRemoteRelease: parsed.instaboxAllowRemoteRelease,
15815
+ allowPaid: parsed.instaboxAllowPaid,
15816
+ env
15817
+ });
15818
+ } catch (err) {
15819
+ output.write(`[nolo] instabox \u914D\u7F6E\u751F\u6210\u5931\u8D25: ${toErrorMessage(err)}
15820
+ `);
15821
+ return 1;
15822
+ }
15823
+ }
15661
15824
  const runEnv = buildLocalRunEnv({
15662
15825
  env,
15663
15826
  allowShell: parsed.allowShell
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  toolRegistry
3
- } from "./chunk-QFL42TMV.js";
3
+ } from "./chunk-MR3ITQEV.js";
4
4
  import {
5
5
  runtime_default
6
- } from "./chunk-2QQ7D3P5.js";
6
+ } from "./chunk-XZIW3Q5B.js";
7
7
  import {
8
8
  canonicalizeToolNames
9
9
  } from "./chunk-5EBLANFT.js";
@@ -308,7 +308,7 @@ var slice = createSliceWithThunks({
308
308
  const overrides = {};
309
309
  if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
310
310
  if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
311
- const { _executeModel } = await import("./_executeModel-3FMHTHSS.js");
311
+ const { _executeModel } = await import("./_executeModel-ZIQHOREX.js");
312
312
  return _executeModel(
313
313
  {
314
314
  isStreaming: args.isStreaming ?? false,
@@ -329,7 +329,7 @@ var slice = createSliceWithThunks({
329
329
  * - 循环直到无工具调用或触发其他运行时停止条件
330
330
  */
331
331
  runAgent: create.asyncThunk(async (args, thunkApi) => {
332
- const { runAgentClientLoop } = await import("./runAgentClientLoop-HHLHNMBE.js");
332
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-TSNSRQEP.js");
333
333
  const { content: loopContent, toolCallCount } = await runAgentClientLoop(
334
334
  {
335
335
  agentKey: args.agentKey,
@@ -345,7 +345,7 @@ var slice = createSliceWithThunks({
345
345
  * 聊天轮次流式 Agent 调用
346
346
  */
347
347
  streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
348
- const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-KNPOLET7.js");
348
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-RJLDV4WZ.js");
349
349
  return streamAgentChatTurnHandler(args, thunkApi);
350
350
  }),
351
351
  /**