workspacecord 1.1.3 → 1.1.4

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 (25) hide show
  1. package/dist/{archive-manager-RW36JGUV.js → archive-manager-FJU7YEEH.js} +4 -4
  2. package/dist/{attachment-cli-MF7XZ4WT.js → attachment-cli-AT4HXAGU.js} +2 -2
  3. package/dist/{chunk-ZO62NAYX.js → chunk-5EMN2IL5.js} +1 -1
  4. package/dist/{chunk-BFINJJYL.js → chunk-66B64WL3.js} +1 -1
  5. package/dist/{chunk-QWPKAUSV.js → chunk-C4L34VJK.js} +8287 -7421
  6. package/dist/{chunk-WON3DPE4.js → chunk-JR4B4L7I.js} +213 -4
  7. package/dist/{chunk-IVXCJA5I.js → chunk-MJ5JKFGS.js} +9 -0
  8. package/dist/{chunk-7GTUWAQR.js → chunk-NNTMVOTM.js} +876 -315
  9. package/dist/{chunk-WP6YJVAE.js → chunk-PWMEOBXG.js} +4 -4
  10. package/dist/{chunk-AGB4GP4G.js → chunk-SNPFYUQ3.js} +441 -654
  11. package/dist/{chunk-4KQ7OSK7.js → chunk-SV7EHL3B.js} +3 -3
  12. package/dist/cli-framework-YF3LPLMT.js +18 -0
  13. package/dist/cli.js +10 -10
  14. package/dist/{codex-launcher-ZBQ5VL6L.js → codex-launcher-CLGG4CVY.js} +1 -1
  15. package/dist/{codex-provider-Q4Z6UKO6.js → codex-provider-VLOS5QB6.js} +18 -4
  16. package/dist/{config-cli-7JEV3WYY.js → config-cli-7G5YWKJU.js} +2 -2
  17. package/dist/{panel-adapter-U75WXDLB.js → panel-adapter-CLI4WDII.js} +4 -4
  18. package/dist/{project-cli-ZXMHOFUJ.js → project-cli-ALKDLRMZ.js} +2 -2
  19. package/dist/{project-registry-ED6P5ZTM.js → project-registry-ZO3KSS25.js} +2 -2
  20. package/dist/sdk-C3D6X4EB.js +55 -0
  21. package/dist/{session-local-registration-MISPPGXF.js → session-local-registration-RL2A3QZB.js} +3 -3
  22. package/dist/{setup-ZFVMMNT2.js → setup-GP3MML2R.js} +1 -1
  23. package/package.json +3 -3
  24. package/dist/cli-framework-7E5MKPMM.js +0 -18
  25. package/dist/sdk-V7A7IF7F.js +0 -43
@@ -15,7 +15,7 @@ import {
15
15
  parseSessionPersistData,
16
16
  resolvePath,
17
17
  sanitizeName
18
- } from "./chunk-IVXCJA5I.js";
18
+ } from "./chunk-MJ5JKFGS.js";
19
19
 
20
20
  // ../../node_modules/.pnpm/xstate@5.30.0/node_modules/xstate/dev/dist/xstate-dev.esm.js
21
21
  function getGlobal() {
@@ -3257,7 +3257,12 @@ function toProjection(state) {
3257
3257
  updatedAt: state.updatedAt,
3258
3258
  turn: state.turn,
3259
3259
  phase: state.phase,
3260
- humanResolved: state.humanResolved
3260
+ humanResolved: state.humanResolved,
3261
+ todoList: state.todoList,
3262
+ todoUpdatedAt: state.todoUpdatedAt,
3263
+ recentPermissionDenials: state.recentPermissionDenials,
3264
+ batchApprovalMode: state.batchApprovalMode,
3265
+ pendingApprovals: state.pendingApprovals
3261
3266
  };
3262
3267
  }
3263
3268
  function toPanelProjection(state) {
@@ -3433,6 +3438,8 @@ function resolveHumanResolved(event, current) {
3433
3438
  }
3434
3439
 
3435
3440
  // ../state/src/xstate-session-machine.ts
3441
+ var MAX_RECENT_DENIALS = 5;
3442
+ var MAX_PENDING_APPROVALS = 100;
3436
3443
  var LIFECYCLE_TRANSITIONS = {
3437
3444
  initializing: ["active", "waiting_human", "paused", "completed", "error"],
3438
3445
  active: ["waiting_human", "paused", "completed", "error"],
@@ -3479,6 +3486,22 @@ var sessionMachine = setup({
3479
3486
  if ("humanResolved" in event && event.humanResolved !== void 0) {
3480
3487
  updates.humanResolved = event.humanResolved;
3481
3488
  }
3489
+ if ("todoList" in event && event.todoList !== void 0) {
3490
+ updates.todoList = event.todoList;
3491
+ updates.todoUpdatedAt = event.updatedAt;
3492
+ }
3493
+ if ("todoUpdatedAt" in event && event.todoUpdatedAt !== void 0) {
3494
+ updates.todoUpdatedAt = event.todoUpdatedAt;
3495
+ }
3496
+ if ("recentPermissionDenials" in event && event.recentPermissionDenials !== void 0) {
3497
+ updates.recentPermissionDenials = event.recentPermissionDenials;
3498
+ }
3499
+ if ("batchApprovalMode" in event && event.batchApprovalMode !== void 0) {
3500
+ updates.batchApprovalMode = event.batchApprovalMode;
3501
+ }
3502
+ if ("pendingApprovals" in event && event.pendingApprovals !== void 0) {
3503
+ updates.pendingApprovals = event.pendingApprovals;
3504
+ }
3482
3505
  return { ...context, ...updates };
3483
3506
  }),
3484
3507
  markAutoIdle: assign(({ context, event }) => ({
@@ -3488,11 +3511,81 @@ var sessionMachine = setup({
3488
3511
  stateSource: "formal",
3489
3512
  confidence: "high",
3490
3513
  updatedAt: event.type === "AUTO_IDLE" ? event.updatedAt : Date.now()
3491
- }))
3514
+ })),
3515
+ applyTodoList: assign(({ context, event }) => {
3516
+ if (event.type !== "TODO_UPDATED") return context;
3517
+ return {
3518
+ ...context,
3519
+ todoList: event.items,
3520
+ todoUpdatedAt: event.updatedAt,
3521
+ updatedAt: event.updatedAt
3522
+ };
3523
+ }),
3524
+ pushPermissionDenial: assign(({ context, event }) => {
3525
+ if (event.type !== "PERMISSION_DENIED") return context;
3526
+ const previous = context.recentPermissionDenials ?? [];
3527
+ const next = [
3528
+ { toolName: event.toolName, reason: event.reason, timestamp: event.updatedAt },
3529
+ ...previous
3530
+ ].slice(0, MAX_RECENT_DENIALS);
3531
+ return {
3532
+ ...context,
3533
+ recentPermissionDenials: next,
3534
+ updatedAt: event.updatedAt
3535
+ };
3536
+ }),
3537
+ applyBatchApprovalSet: assign(({ context, event }) => {
3538
+ if (event.type !== "BATCH_APPROVAL_SET") return context;
3539
+ const pending = event.enabled ? [...event.pendingApprovals ?? context.pendingApprovals ?? []] : [];
3540
+ return {
3541
+ ...context,
3542
+ batchApprovalMode: event.enabled,
3543
+ pendingApprovals: pending,
3544
+ updatedAt: event.updatedAt
3545
+ };
3546
+ }),
3547
+ enqueuePendingApproval: assign(({ context, event }) => {
3548
+ if (event.type !== "BATCH_APPROVAL_ENQUEUE") return context;
3549
+ const previous = context.pendingApprovals ?? [];
3550
+ return {
3551
+ ...context,
3552
+ pendingApprovals: [...previous, event.approval].slice(-MAX_PENDING_APPROVALS),
3553
+ updatedAt: event.updatedAt
3554
+ };
3555
+ }),
3556
+ clearPendingApprovals: assign(({ context, event }) => {
3557
+ if (event.type !== "BATCH_APPROVAL_CLEAR") return context;
3558
+ return {
3559
+ ...context,
3560
+ pendingApprovals: [],
3561
+ updatedAt: event.updatedAt
3562
+ };
3563
+ }),
3564
+ removePendingApproval: assign(({ context, event }) => {
3565
+ if (event.type !== "BATCH_APPROVAL_REMOVE") return context;
3566
+ const previous = context.pendingApprovals ?? [];
3567
+ const next = previous.filter((e) => e.gateId !== event.gateId);
3568
+ if (next.length === previous.length) return context;
3569
+ return {
3570
+ ...context,
3571
+ pendingApprovals: next,
3572
+ updatedAt: event.updatedAt
3573
+ };
3574
+ })
3492
3575
  }
3493
3576
  }).createMachine({
3494
3577
  id: "session",
3495
3578
  type: "parallel",
3579
+ // 顶层事件:TODO_UPDATED / PERMISSION_DENIED / BATCH_APPROVAL_* 只更新 context,
3580
+ // 不改变 lifecycle 或 execution 子状态,因此放在顶层而不是某个子节点。
3581
+ on: {
3582
+ TODO_UPDATED: { actions: "applyTodoList" },
3583
+ PERMISSION_DENIED: { actions: "pushPermissionDenial" },
3584
+ BATCH_APPROVAL_SET: { actions: "applyBatchApprovalSet" },
3585
+ BATCH_APPROVAL_ENQUEUE: { actions: "enqueuePendingApproval" },
3586
+ BATCH_APPROVAL_CLEAR: { actions: "clearPendingApprovals" },
3587
+ BATCH_APPROVAL_REMOVE: { actions: "removePendingApproval" }
3588
+ },
3496
3589
  context: {
3497
3590
  gate: null,
3498
3591
  displayState: "idle",
@@ -3501,7 +3594,12 @@ var sessionMachine = setup({
3501
3594
  updatedAt: 0,
3502
3595
  turn: 0,
3503
3596
  phase: STATE_LABELS.idle,
3504
- humanResolved: false
3597
+ humanResolved: false,
3598
+ todoList: void 0,
3599
+ todoUpdatedAt: void 0,
3600
+ recentPermissionDenials: void 0,
3601
+ batchApprovalMode: false,
3602
+ pendingApprovals: void 0
3505
3603
  },
3506
3604
  states: {
3507
3605
  lifecycle: {
@@ -3835,7 +3933,66 @@ var StateMachine2 = class {
3835
3933
  );
3836
3934
  return toProjection(settled.success ? settled.state : baseState);
3837
3935
  }
3936
+ /**
3937
+ * Context-only updaters. These dispatch to the XState actor and rely on
3938
+ * subscribe() to mirror the new context into entry.snapshot synchronously.
3939
+ * No manual snapshot mutation — keeps a single source of truth.
3940
+ */
3941
+ applyTodoUpdate(sessionId, items) {
3942
+ const entry = this.ensureSession(sessionId);
3943
+ entry.actor.send({ type: "TODO_UPDATED", items, updatedAt: Date.now() });
3944
+ return toProjection(entry.snapshot);
3945
+ }
3946
+ applyPermissionDenial(sessionId, toolName, reason) {
3947
+ const entry = this.ensureSession(sessionId);
3948
+ entry.actor.send({ type: "PERMISSION_DENIED", toolName, reason, updatedAt: Date.now() });
3949
+ return toProjection(entry.snapshot);
3950
+ }
3951
+ setBatchApprovalMode(sessionId, enabled, pendingApprovals) {
3952
+ const entry = this.ensureSession(sessionId);
3953
+ entry.actor.send({
3954
+ type: "BATCH_APPROVAL_SET",
3955
+ enabled,
3956
+ pendingApprovals,
3957
+ updatedAt: Date.now()
3958
+ });
3959
+ return toProjection(entry.snapshot);
3960
+ }
3961
+ enqueuePendingApproval(sessionId, approval) {
3962
+ const entry = this.ensureSession(sessionId);
3963
+ entry.actor.send({ type: "BATCH_APPROVAL_ENQUEUE", approval, updatedAt: Date.now() });
3964
+ return toProjection(entry.snapshot);
3965
+ }
3966
+ clearPendingApprovals(sessionId) {
3967
+ const entry = this.ensureSession(sessionId);
3968
+ entry.actor.send({ type: "BATCH_APPROVAL_CLEAR", updatedAt: Date.now() });
3969
+ return toProjection(entry.snapshot);
3970
+ }
3971
+ /**
3972
+ * Drop one pending approval by its gateId without touching the rest of the
3973
+ * queue. Used by the abort handler to keep state consistent when a single
3974
+ * deferred tool call is cancelled out-of-band (provider-side abort).
3975
+ */
3976
+ removePendingApproval(sessionId, gateId) {
3977
+ const entry = this.ensureSession(sessionId);
3978
+ entry.actor.send({ type: "BATCH_APPROVAL_REMOVE", gateId, updatedAt: Date.now() });
3979
+ return toProjection(entry.snapshot);
3980
+ }
3838
3981
  applyPlatformEvent(event) {
3982
+ if (event.type === "todo_updated") {
3983
+ const items = event.metadata?.items ?? [];
3984
+ return this.applyTodoUpdate(event.sessionId, items);
3985
+ }
3986
+ if (event.type === "permission_denied") {
3987
+ const toolName = typeof event.metadata?.toolName === "string" ? event.metadata.toolName : "tool";
3988
+ const reason = typeof event.metadata?.reason === "string" ? event.metadata.reason : "";
3989
+ return this.applyPermissionDenial(event.sessionId, toolName, reason);
3990
+ }
3991
+ if (event.type === "batch_approval_changed") {
3992
+ const enabled = Boolean(event.metadata?.enabled);
3993
+ const pending = event.metadata?.pendingApprovals;
3994
+ return this.setBatchApprovalMode(event.sessionId, enabled, pending);
3995
+ }
3839
3996
  const current = this.getState(event.sessionId);
3840
3997
  const mapped = mapEventToTransition(event, current, {
3841
3998
  shouldTransition: this.shouldTransition.bind(this),
@@ -4665,6 +4822,50 @@ function getOutputPort() {
4665
4822
  return outputPort;
4666
4823
  }
4667
4824
 
4825
+ // ../engine/src/output/batch-approval-store.ts
4826
+ var MAX_BATCH_APPROVAL_STORE_SIZE = 100;
4827
+ var store = /* @__PURE__ */ new Map();
4828
+ function enqueueBatchApproval(sessionId, entry) {
4829
+ if (!store.has(sessionId)) store.set(sessionId, []);
4830
+ const queue = store.get(sessionId);
4831
+ if (queue.length >= MAX_BATCH_APPROVAL_STORE_SIZE) {
4832
+ return "overflow";
4833
+ }
4834
+ queue.push(entry);
4835
+ return "enqueued";
4836
+ }
4837
+ function removeBatchApproval(sessionId, gateId) {
4838
+ const queue = store.get(sessionId);
4839
+ if (!queue) return false;
4840
+ const idx = queue.findIndex((e) => e.gateId === gateId);
4841
+ if (idx === -1) return false;
4842
+ queue.splice(idx, 1);
4843
+ if (queue.length === 0) store.delete(sessionId);
4844
+ return true;
4845
+ }
4846
+ function drainBatchApprovals(sessionId, action) {
4847
+ const queue = store.get(sessionId);
4848
+ if (!queue || queue.length === 0) return 0;
4849
+ const count = queue.length;
4850
+ for (const entry of queue) {
4851
+ try {
4852
+ entry.resolve(action);
4853
+ } catch (err) {
4854
+ console.warn(
4855
+ `[batch-approval-store] failed to resolve ${entry.gateId}: ${err.message}`
4856
+ );
4857
+ }
4858
+ }
4859
+ store.delete(sessionId);
4860
+ return count;
4861
+ }
4862
+ function getBatchApprovalCount(sessionId) {
4863
+ return store.get(sessionId)?.length ?? 0;
4864
+ }
4865
+ function clearBatchApprovalStore(sessionId) {
4866
+ drainBatchApprovals(sessionId, "reject");
4867
+ }
4868
+
4668
4869
  // ../engine/src/session-registry.ts
4669
4870
  function createDefaultWorkflowState() {
4670
4871
  return {
@@ -4925,6 +5126,8 @@ async function endSession(id) {
4925
5126
  }
4926
5127
  sessionControllers.delete(session.id);
4927
5128
  sessionAbortReasons.delete(session.id);
5129
+ clearBatchApprovalStore(session.id);
5130
+ stateMachine.clearPendingApprovals(session.id);
4928
5131
  const channelId = session.channelId;
4929
5132
  const categoryId = session.categoryId;
4930
5133
  await sessionRepo.delete(id);
@@ -5004,6 +5207,8 @@ function abortSessionWithReason(sessionId, reason) {
5004
5207
  controller.abort();
5005
5208
  sessionControllers.delete(session.id);
5006
5209
  }
5210
+ clearBatchApprovalStore(session.id);
5211
+ stateMachine.clearPendingApprovals(session.id);
5007
5212
  if (session.isGenerating) {
5008
5213
  session.isGenerating = false;
5009
5214
  sessionRepo.reindex(sessionId);
@@ -5057,6 +5262,10 @@ export {
5057
5262
  toPlatformEvent,
5058
5263
  mapPlatformEventToState,
5059
5264
  gateService,
5265
+ enqueueBatchApproval,
5266
+ removeBatchApproval,
5267
+ drainBatchApprovals,
5268
+ getBatchApprovalCount,
5060
5269
  resolveEffectiveClaudePermissionMode,
5061
5270
  resolveEffectiveCodexOptions,
5062
5271
  getSessionPermissionSummary,
@@ -6321,6 +6321,15 @@ var config = {
6321
6321
  codexNetworkAccessEnabled: optionalBool("CODEX_NETWORK_ACCESS_ENABLED", true),
6322
6322
  codexWebSearchMode: optionalEnum("CODEX_WEB_SEARCH", "live", ["disabled", "cached", "live"]),
6323
6323
  codexReasoningEffort: optionalEnum("CODEX_REASONING_EFFORT", "", ["", "minimal", "low", "medium", "high", "xhigh"]),
6324
+ /**
6325
+ * Reasoning effort applied to Monitor-mode evaluation passes (across both providers).
6326
+ * - Codex: forwarded to `modelReasoningEffort` on the monitor thread.
6327
+ * - Claude: if set to 'high' or 'xhigh', switches the monitor to `monitorClaudeModel` (default: claude-opus-4-7).
6328
+ * Empty string = inherit from the worker settings.
6329
+ */
6330
+ monitorReasoningEffort: optionalEnum("MONITOR_REASONING_EFFORT", "high", ["", "minimal", "low", "medium", "high", "xhigh"]),
6331
+ /** Claude model used for monitor passes when `monitorReasoningEffort` is high/xhigh. */
6332
+ monitorClaudeModel: optional("MONITOR_CLAUDE_MODEL", "claude-opus-4-7"),
6324
6333
  codexBaseUrl: optional("CODEX_BASE_URL", ""),
6325
6334
  codexApiKey: optional("CODEX_API_KEY", ""),
6326
6335
  codexPath: optional("CODEX_PATH", ""),