@sema-agent/core 7.11.2 → 7.12.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 (57) hide show
  1. package/CHANGELOG.md +42 -13
  2. package/dist/core/auto-mode-arming.d.ts +10 -14
  3. package/dist/core/auto-mode-arming.js +3 -9
  4. package/dist/core/auto-mode-defaults.d.ts +0 -2
  5. package/dist/core/auto-mode-defaults.js +0 -1
  6. package/dist/core/auto-mode-rebuild.d.ts +6 -13
  7. package/dist/core/auto-mode-rebuild.js +0 -2
  8. package/dist/core/auto-mode.d.ts +30 -89
  9. package/dist/core/auto-mode.js +12 -59
  10. package/dist/core/checkpoint-store.d.ts +1 -3
  11. package/dist/core/gate-fold.js +1 -9
  12. package/dist/core/gate-lanes.js +15 -9
  13. package/dist/core/hooks.d.ts +6 -0
  14. package/dist/core/runner/contracts.d.ts +41 -9
  15. package/dist/core/runner/denial-limit-arms.d.ts +10 -13
  16. package/dist/core/runner/denial-limit-arms.js +9 -7
  17. package/dist/core/runner/gate-exit.js +9 -1
  18. package/dist/core/runner/prepare-caps-and-workflow.d.ts +1 -1
  19. package/dist/core/runner/prepare-caps-and-workflow.js +0 -5
  20. package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
  21. package/dist/core/runner/prepare-suspend-saga.js +2 -10
  22. package/dist/core/runner/prepare-task.js +1 -1
  23. package/dist/core/runner/prepare-wiring-manifest.d.ts +1 -1
  24. package/dist/core/runner/prepare-wiring-manifest.js +1 -8
  25. package/dist/core/runner/run-attachment-seats.d.ts +4 -2
  26. package/dist/core/runner/run-attachment-seats.js +2 -2
  27. package/dist/core/runner/run-identity-wiring.d.ts +14 -33
  28. package/dist/core/runner/run-identity-wiring.js +4 -3
  29. package/dist/core/runner/run-leg.d.ts +106 -0
  30. package/dist/core/runner/run-leg.js +462 -0
  31. package/dist/core/runner/run-notification-lane.d.ts +55 -0
  32. package/dist/core/runner/run-notification-lane.js +128 -0
  33. package/dist/core/runner/run-reasoning-seat.d.ts +5 -5
  34. package/dist/core/runner/run-reasoning-seat.js +7 -7
  35. package/dist/core/runner/run-settle-and-teardown.d.ts +109 -0
  36. package/dist/core/runner/run-settle-and-teardown.js +324 -0
  37. package/dist/core/runner/run-terminal-adoption.d.ts +99 -0
  38. package/dist/core/runner/run-terminal-adoption.js +120 -0
  39. package/dist/core/runner/runtask.d.ts +14 -3
  40. package/dist/core/runner/runtask.js +55 -1010
  41. package/dist/core/runner-deps.d.ts +4 -14
  42. package/dist/core/store-contracts/workflow-journal-store-contract.d.ts +7 -0
  43. package/dist/core/store-contracts/workflow-journal-store-contract.js +85 -0
  44. package/dist/core/tool-policy.d.ts +37 -93
  45. package/dist/core/tool-policy.js +1 -11
  46. package/dist/core/trace.d.ts +6 -7
  47. package/dist/core/wiring-manifest.d.ts +5 -22
  48. package/dist/core/wiring-manifest.js +3 -11
  49. package/dist/core/workflow-journal-store.d.ts +35 -4
  50. package/dist/core/workflow-journal-store.js +19 -2
  51. package/dist/index.d.ts +3 -2
  52. package/dist/index.js +3 -2
  53. package/dist/orchestration/workflow.js +2 -0
  54. package/dist/stores/file/workflow-journal-store.d.ts +7 -10
  55. package/dist/stores/file/workflow-journal-store.js +2 -4
  56. package/package.json +1 -1
  57. package/test/export-surface.snapshot.json +10 -10
@@ -1,15 +1,12 @@
1
1
  import { type WorkflowJournalEntry, type WorkflowJournalStore, type ResumeClaimArgs } from "../../core/workflow-journal-store.js";
2
2
  /**
3
- * SVC-2 — the shared size bound for a journaled workflow-agent result, so ALL backends DEGRADE IDENTICALLY on
4
- * an oversize TaskResult (no dialect divergence). Inlined from service's `workflow-journal-limits` on
5
- * onboarding — the 5 MiB figure aligns with TiDB's ~6 MiB per-row txn-entry-size-limit (a row
6
- * over it is REJECTED with "entry too large"); a LOAD-BEARING `append` that hit that would THROW and kill the
7
- * whole workflow. PostgreSQL TEXT has no such low limit, so without a shared guard the same large result would
8
- * journal fine on PG but fail the workflow on TiDB. All backends instead skip-journal a result whose serialized
9
- * size exceeds {@link MAX_JOURNAL_RESULT_BYTES} (a no-op, never an insert/throw): the agent's ordinal is simply
10
- * not cached, so a resume re-runs that one agent live. Resume is an optimization — a too-big-to-cache result is
11
- * a graceful degrade, not a failure. Measured in BYTES (UTF-8) — a multibyte result can be larger than its
12
- * `.length` in chars.
3
+ * SVC-2 — the shared size bound for a journaled workflow-agent entry, so ALL backends answer an oversize
4
+ * TaskResult with the SAME refusal (no dialect divergence). Inlined from service's `workflow-journal-limits` on
5
+ * onboarding — the 5 MiB figure aligns with TiDB's ~6 MiB per-row txn-entry-size-limit (a row over it is
6
+ * REJECTED with "entry too large"). PostgreSQL TEXT has no such low limit, so without a shared bound the same
7
+ * large entry would journal on PG and fail on TiDB; the shared bound makes every backend refuse at the same
8
+ * byte and with the same code (`workflow.journal_oversize`) before the row reaches the medium. Measured in
9
+ * BYTES (UTF-8) a multibyte result can be larger than its `.length` in chars.
13
10
  */
14
11
  export { MAX_JOURNAL_RESULT_BYTES, oversizeJournalResult } from "../../core/workflow-journal-store.js";
15
12
  /**
@@ -5,7 +5,7 @@ import { callKeyOrdinal } from "../../core/workflow-journal-store.js";
5
5
  import { AppendLog } from "./fs-atomic.js";
6
6
  import { canonicalStoreKey, sanitizePathComponent, writeThenLink } from "./fs-atomic.js";
7
7
  import { assertAdoptionBootGate } from "./adoption/marker.js";
8
- import { oversizeJournalResult } from "../../core/workflow-journal-store.js";
8
+ import { assertJournalEntryFits } from "../../core/workflow-journal-store.js";
9
9
  export { MAX_JOURNAL_RESULT_BYTES, oversizeJournalResult } from "../../core/workflow-journal-store.js";
10
10
  function entryOf(rec) {
11
11
  if (rec.parked !== undefined)
@@ -92,9 +92,7 @@ export class FileWorkflowJournalStore {
92
92
  return scope === undefined ? undefined : { scope, byOrdinal };
93
93
  }
94
94
  async append(runId, scope, entry) {
95
- const serialized = JSON.stringify(entry.parked !== undefined ? entry.parked : entry.result);
96
- if (oversizeJournalResult(serialized))
97
- return;
95
+ assertJournalEntryFits(entry);
98
96
  const committed = this.scopes.get(runId) ?? this.replay(runId)?.scope;
99
97
  if (committed !== undefined && committed !== scope) {
100
98
  throw new Error(`workflow journal: runId ${runId} already recorded under a different scope`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/core",
3
- "version": "7.11.2",
3
+ "version": "7.12.0",
4
4
  "description": "Stateless, task-oriented AI agent core",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",
@@ -33,7 +33,6 @@
33
33
  "AUTO_MODE_ARMING_RECIPE_VERSION": "variable",
34
34
  "AUTO_MODE_ARM_REASONS": "variable",
35
35
  "AUTO_MODE_BASE_PROMPT": "variable",
36
- "AUTO_MODE_BREAKER_CAUSES": "variable",
37
36
  "AUTO_MODE_CLASSIFIER_MAX_TOKENS": "variable",
38
37
  "AUTO_MODE_DEFAULTS_SENTINEL": "variable",
39
38
  "AUTO_MODE_DENIAL_AUTO_DENY_DEFAULT_MS": "variable",
@@ -90,9 +89,6 @@
90
89
  "AutoModeArmingFace": "interface",
91
90
  "AutoModeArmingFold": "type",
92
91
  "AutoModeArmingRecipe": "interface",
93
- "AutoModeBreakerCause": "type",
94
- "AutoModeBreakerLedger": "class",
95
- "AutoModeBreakerTrip": "interface",
96
92
  "AutoModeClassified": "interface",
97
93
  "AutoModeClassifierCompletion": "type",
98
94
  "AutoModeClassifyFn": "type",
@@ -156,6 +152,7 @@
156
152
  "CHALLENGES_FILE": "variable",
157
153
  "CHALLENGE_LEDGER_MAX_EVENTS": "variable",
158
154
  "CIRCUIT_OPEN_MARKER": "variable",
155
+ "CLASSIFIER_PARSE_FAILURE_DENY_MESSAGE": "variable",
159
156
  "COARSE_SHELL_TOOLS": "variable",
160
157
  "CODE_AGENT_PROMPT": "variable",
161
158
  "CODE_REVIEW_PROMPT": "variable",
@@ -1491,6 +1488,7 @@
1491
1488
  "WorkflowItemStatus": "type",
1492
1489
  "WorkflowJournalEntry": "type",
1493
1490
  "WorkflowJournalIncompatibleError": "class",
1491
+ "WorkflowJournalOversizeError": "class",
1494
1492
  "WorkflowJournalStore": "interface",
1495
1493
  "WorkflowLimits": "interface",
1496
1494
  "WorkflowMaxAgentsError": "class",
@@ -1549,6 +1547,7 @@
1549
1547
  "assembleCodeTools": "function",
1550
1548
  "assertAdoptionBootGate": "function",
1551
1549
  "assertDeleteDeltaCarriesNoAdd": "function",
1550
+ "assertJournalEntryFits": "function",
1552
1551
  "assertJsonMetadata": "function",
1553
1552
  "assertMemoryBackendSearchEquivalence": "function",
1554
1553
  "assertOracleIsolation": "function",
@@ -1618,6 +1617,7 @@
1618
1617
  "checkpointVersionOf": "function",
1619
1618
  "clampHopChain": "function",
1620
1619
  "classifierMayAnswer": "function",
1620
+ "classifierUnavailableDenyMessage": "function",
1621
1621
  "classifyCompoundReadonly": "function",
1622
1622
  "classifyCompoundReadonlyDetailed": "function",
1623
1623
  "classifyHttp": "function",
@@ -1857,7 +1857,6 @@
1857
1857
  "inspectDegenerate": "function",
1858
1858
  "isAliasModelId": "function",
1859
1859
  "isAskOrigin": "function",
1860
- "isAutoModeBreakerCause": "function",
1861
1860
  "isAutoModeUnavailableCause": "function",
1862
1861
  "isCanonicalPeerAddress": "function",
1863
1862
  "isCrossSessionInboundSetting": "function",
@@ -2269,6 +2268,7 @@
2269
2268
  "withRetry": "function",
2270
2269
  "witnessAdoptionConfig": "function",
2271
2270
  "workflowAgentCallKey": "function",
2271
+ "workflowJournalStoreContract": "function",
2272
2272
  "workflowRunStoreContract": "function",
2273
2273
  "workflowScriptReadsClockOrRandom": "function",
2274
2274
  "workflowWhenToUseText": "function",
@@ -2309,7 +2309,6 @@
2309
2309
  "AUTO_MODE_ARMING_RECIPE_VERSION": "advanced",
2310
2310
  "AUTO_MODE_ARM_REASONS": "advanced",
2311
2311
  "AUTO_MODE_BASE_PROMPT": "advanced",
2312
- "AUTO_MODE_BREAKER_CAUSES": "advanced",
2313
2312
  "AUTO_MODE_CLASSIFIER_MAX_TOKENS": "advanced",
2314
2313
  "AUTO_MODE_DEFAULTS_SENTINEL": "advanced",
2315
2314
  "AUTO_MODE_DENIAL_AUTO_DENY_DEFAULT_MS": "advanced",
@@ -2366,9 +2365,6 @@
2366
2365
  "AutoModeArmingFace": "advanced",
2367
2366
  "AutoModeArmingFold": "advanced",
2368
2367
  "AutoModeArmingRecipe": "advanced",
2369
- "AutoModeBreakerCause": "advanced",
2370
- "AutoModeBreakerLedger": "advanced",
2371
- "AutoModeBreakerTrip": "advanced",
2372
2368
  "AutoModeClassified": "advanced",
2373
2369
  "AutoModeClassifierCompletion": "advanced",
2374
2370
  "AutoModeClassifyFn": "advanced",
@@ -2432,6 +2428,7 @@
2432
2428
  "CHALLENGES_FILE": "advanced",
2433
2429
  "CHALLENGE_LEDGER_MAX_EVENTS": "advanced",
2434
2430
  "CIRCUIT_OPEN_MARKER": "advanced",
2431
+ "CLASSIFIER_PARSE_FAILURE_DENY_MESSAGE": "advanced",
2435
2432
  "COARSE_SHELL_TOOLS": "stable",
2436
2433
  "CODE_AGENT_PROMPT": "advanced",
2437
2434
  "CODE_REVIEW_PROMPT": "advanced",
@@ -3767,6 +3764,7 @@
3767
3764
  "WorkflowItemStatus": "advanced",
3768
3765
  "WorkflowJournalEntry": "advanced",
3769
3766
  "WorkflowJournalIncompatibleError": "advanced",
3767
+ "WorkflowJournalOversizeError": "advanced",
3770
3768
  "WorkflowJournalStore": "advanced",
3771
3769
  "WorkflowLimits": "advanced",
3772
3770
  "WorkflowMaxAgentsError": "advanced",
@@ -3825,6 +3823,7 @@
3825
3823
  "assembleCodeTools": "advanced",
3826
3824
  "assertAdoptionBootGate": "advanced",
3827
3825
  "assertDeleteDeltaCarriesNoAdd": "advanced",
3826
+ "assertJournalEntryFits": "advanced",
3828
3827
  "assertJsonMetadata": "advanced",
3829
3828
  "assertMemoryBackendSearchEquivalence": "advanced",
3830
3829
  "assertOracleIsolation": "advanced",
@@ -3894,6 +3893,7 @@
3894
3893
  "checkpointVersionOf": "advanced",
3895
3894
  "clampHopChain": "advanced",
3896
3895
  "classifierMayAnswer": "advanced",
3896
+ "classifierUnavailableDenyMessage": "advanced",
3897
3897
  "classifyCompoundReadonly": "advanced",
3898
3898
  "classifyCompoundReadonlyDetailed": "advanced",
3899
3899
  "classifyHttp": "advanced",
@@ -4133,7 +4133,6 @@
4133
4133
  "inspectDegenerate": "advanced",
4134
4134
  "isAliasModelId": "advanced",
4135
4135
  "isAskOrigin": "advanced",
4136
- "isAutoModeBreakerCause": "advanced",
4137
4136
  "isAutoModeUnavailableCause": "advanced",
4138
4137
  "isCanonicalPeerAddress": "advanced",
4139
4138
  "isCrossSessionInboundSetting": "advanced",
@@ -4545,6 +4544,7 @@
4545
4544
  "withRetry": "advanced",
4546
4545
  "witnessAdoptionConfig": "advanced",
4547
4546
  "workflowAgentCallKey": "advanced",
4547
+ "workflowJournalStoreContract": "advanced",
4548
4548
  "workflowRunStoreContract": "advanced",
4549
4549
  "workflowScriptReadsClockOrRandom": "advanced",
4550
4550
  "workflowWhenToUseText": "advanced",