@sema-agent/core 5.22.0 → 5.23.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 (52) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/agents/subagent.js +3 -2
  3. package/dist/core/governance-codes.js +3 -0
  4. package/dist/core/hooks.d.ts +62 -1
  5. package/dist/core/hooks.js +90 -12
  6. package/dist/core/memory-engine/engine.d.ts +28 -1
  7. package/dist/core/memory-engine/engine.js +62 -3
  8. package/dist/core/memory-engine/index.d.ts +1 -1
  9. package/dist/core/memory-engine/index.js +1 -1
  10. package/dist/core/memory-engine/layout.d.ts +69 -3
  11. package/dist/core/memory-engine/layout.js +75 -6
  12. package/dist/core/permission-rule-consent.js +2 -1
  13. package/dist/core/permission-rule-org.d.ts +36 -2
  14. package/dist/core/permission-rule-org.js +23 -0
  15. package/dist/core/permission-rule-store.js +2 -1
  16. package/dist/core/permission-rule-sync.d.ts +8 -0
  17. package/dist/core/permission-rule-sync.js +35 -6
  18. package/dist/core/runner/prepare-task.d.ts +10 -2
  19. package/dist/core/runner/prepare-task.js +111 -5
  20. package/dist/core/runner/runtask.js +19 -0
  21. package/dist/core/tool-policy.d.ts +37 -4
  22. package/dist/core/tool-policy.js +32 -4
  23. package/dist/core/tool-result-store.d.ts +9 -1
  24. package/dist/core/tool-result-store.js +2 -1
  25. package/dist/core/trace.d.ts +47 -0
  26. package/dist/core/types.d.ts +38 -0
  27. package/dist/core/wiring-manifest.d.ts +16 -1
  28. package/dist/core/wiring-manifest.js +7 -1
  29. package/dist/index.d.ts +5 -3
  30. package/dist/index.js +4 -2
  31. package/dist/orchestration/goal.d.ts +10 -0
  32. package/dist/orchestration/goal.js +6 -5
  33. package/dist/stores/file/adoption/adopt.d.ts +146 -0
  34. package/dist/stores/file/adoption/adopt.js +616 -0
  35. package/dist/stores/file/adoption/marker.d.ts +194 -0
  36. package/dist/stores/file/adoption/marker.js +198 -0
  37. package/dist/stores/file/background-agent-store.js +2 -0
  38. package/dist/stores/file/checkpoint-store.js +2 -0
  39. package/dist/stores/file/file-snapshot-store.js +2 -0
  40. package/dist/stores/file/index.d.ts +2 -0
  41. package/dist/stores/file/index.js +4 -0
  42. package/dist/stores/file/mailbox-store.js +2 -0
  43. package/dist/stores/file/memory-store.js +2 -0
  44. package/dist/stores/file/session-policy-store.js +2 -0
  45. package/dist/stores/file/session-store.js +2 -0
  46. package/dist/stores/file/task-list-store.js +2 -0
  47. package/dist/stores/file/tool-result-store.js +2 -0
  48. package/dist/stores/file/usage-window-store.js +2 -0
  49. package/dist/stores/file/workflow-journal-store.js +2 -0
  50. package/dist/stores/file/workflow-run-store.js +2 -0
  51. package/dist/tools/fs/bash-readonly-classifier.js +59 -10
  52. package/package.json +3 -2
@@ -238,11 +238,51 @@ function isGrepClusterFileStdin(tok) {
238
238
  }
239
239
  return false;
240
240
  }
241
- function isCutSeparatedDelimiterOption(tok) {
242
- if (tok.includes("="))
241
+ const SEPARATED_VALUE_OPTIONS = {
242
+ head: { short: "cn", long: ["bytes", "lines"] },
243
+ tail: { short: "cns", long: ["bytes", "lines", "sleep-interval", "pid", "max-unchanged-stats"] },
244
+ cut: { short: "bcdf", long: ["bytes", "characters", "delimiter", "fields", "output-delimiter"] },
245
+ grep: {
246
+ ownsValueButNotSkippable: "ef",
247
+ short: "mABCdD",
248
+ long: [
249
+ "max-count",
250
+ "after-context",
251
+ "before-context",
252
+ "context",
253
+ "devices",
254
+ "directories",
255
+ "label",
256
+ "binary-files",
257
+ "group-separator",
258
+ "include",
259
+ "exclude",
260
+ "exclude-dir",
261
+ ],
262
+ },
263
+ };
264
+ function takesSeparatedValue(name, tok) {
265
+ const model = SEPARATED_VALUE_OPTIONS[name];
266
+ if (model === undefined)
243
267
  return false;
244
- const name = longOptionNameOf(tok);
245
- return name !== undefined && (isLongOptionAbbrevOf(name, "delimiter") || isLongOptionAbbrevOf(name, "output-delimiter"));
268
+ if (tok.startsWith("--")) {
269
+ if (tok.includes("="))
270
+ return false;
271
+ const long = longOptionNameOf(tok);
272
+ return long !== undefined && model.long.some((full) => isLongOptionAbbrevOf(long, full));
273
+ }
274
+ if (!/^-[A-Za-z0-9]/.test(tok))
275
+ return false;
276
+ for (let i = 1; i < tok.length; i++) {
277
+ const ch = tok[i];
278
+ if ((model.ownsValueButNotSkippable ?? "").includes(ch))
279
+ return false;
280
+ if (model.short.includes(ch))
281
+ return i === tok.length - 1;
282
+ if (!/[A-Za-z0-9]/.test(ch))
283
+ return false;
284
+ }
285
+ return false;
246
286
  }
247
287
  function isGrepFileStdinLongOption(tok) {
248
288
  const eq = tok.indexOf("=");
@@ -478,19 +518,28 @@ export function classifyCompoundReadonlyDetailed(command, allow, boundary) {
478
518
  let sawNonFlagOperand = false;
479
519
  let hasStdinDash = false;
480
520
  let operandCount = 0;
521
+ let endOfOptions = false;
481
522
  if (name !== "tr") {
482
523
  for (let k = 0; k < restArgs.length; k++) {
483
524
  const t = restArgs[k];
484
- if (name === "cut" && (t === "-d" || isCutSeparatedDelimiterOption(t))) {
525
+ if (endOfOptions) {
526
+ }
527
+ else if (t === "--") {
528
+ endOfOptions = true;
529
+ continue;
530
+ }
531
+ else if (takesSeparatedValue(name, t)) {
485
532
  k++;
486
533
  continue;
487
534
  }
488
- if (name === "grep" && (isGrepClusterFileStdin(t) || isGrepFileStdinLongOption(t))) {
489
- hasStdinDash = true;
490
- break;
535
+ else {
536
+ if (name === "grep" && (isGrepClusterFileStdin(t) || isGrepFileStdinLongOption(t))) {
537
+ hasStdinDash = true;
538
+ break;
539
+ }
540
+ if (t.startsWith("-") && t !== "-")
541
+ continue;
491
542
  }
492
- if (t.startsWith("-") && t !== "-")
493
- continue;
494
543
  const isGrepPatternPosition = name === "grep" && !grepPatternSuppliedByFlag && !sawNonFlagOperand;
495
544
  sawNonFlagOperand = true;
496
545
  operandCount++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/core",
3
- "version": "5.22.0",
3
+ "version": "5.23.0",
4
4
  "description": "Stateless, task-oriented AI agent core",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",
@@ -63,7 +63,8 @@
63
63
  "gate:domain-lexicon": "node scripts/verify-domain-lexicon.mjs",
64
64
  "gate:single-mint": "node scripts/verify-single-mint.mjs",
65
65
  "gate:nuia": "node scripts/verify-nuia-baseline.mjs",
66
- "gate:field-liveness": "node scripts/verify-field-liveness.mjs"
66
+ "gate:field-liveness": "node scripts/verify-field-liveness.mjs",
67
+ "gate:error-surface": "node scripts/verify-error-surface.mjs"
67
68
  },
68
69
  "dependencies": {
69
70
  "@modelcontextprotocol/sdk": "1.30.0",