akm-cli 0.9.7 → 0.9.8-beta.1

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 (117) hide show
  1. package/CHANGELOG.md +218 -0
  2. package/dist/commands/env/env.js +2 -21
  3. package/dist/commands/health/checks.js +0 -25
  4. package/dist/commands/health/improve-metrics.js +8 -34
  5. package/dist/commands/health/windows.js +0 -4
  6. package/dist/commands/health.js +1 -35
  7. package/dist/commands/improve/consolidate/eligibility.js +11 -5
  8. package/dist/commands/improve/extract.js +36 -32
  9. package/dist/commands/improve/memory/memory-belief.js +15 -5
  10. package/dist/commands/improve/memory/memory-contradiction-detect.js +16 -25
  11. package/dist/commands/improve/memory/memory-improve.js +7 -19
  12. package/dist/commands/improve/preparation.js +52 -36
  13. package/dist/commands/improve/reflect.js +13 -17
  14. package/dist/commands/lint/base-linter.js +42 -2
  15. package/dist/commands/lint/index.js +4 -5
  16. package/dist/commands/migrate/config-extra-params.js +61 -0
  17. package/dist/commands/migrate/dead-residue.js +113 -0
  18. package/dist/commands/migrate/stale-txn.js +49 -0
  19. package/dist/commands/migrate-cli.js +42 -1
  20. package/dist/commands/proposal/proposal.js +1 -21
  21. package/dist/commands/proposal/repository.js +0 -4
  22. package/dist/commands/proposal/validators/proposal-quality-validators.js +0 -6
  23. package/dist/commands/read/curate.js +4 -18
  24. package/dist/commands/read/show.js +2 -1
  25. package/dist/commands/sources/installed-stashes.js +5 -1
  26. package/dist/commands/sources/self-update.js +38 -1
  27. package/dist/commands/sources/sources-cli.js +17 -1
  28. package/dist/commands/tasks/tasks.js +0 -8
  29. package/dist/commands/url-checker.js +20 -28
  30. package/dist/core/adapter/adapters/agent-skills-adapter.js +2 -6
  31. package/dist/core/adapter/adapters/akm-adapter.js +2 -3
  32. package/dist/core/adapter/adapters/akm-lint.js +2 -20
  33. package/dist/core/adapter/adapters/akm-task-adapter.js +2 -6
  34. package/dist/core/adapter/adapters/akm-workflow-adapter.js +2 -6
  35. package/dist/core/adapter/adapters/dotenv-adapter.js +2 -22
  36. package/dist/core/adapter/adapters/generic-files-adapter.js +3 -9
  37. package/dist/core/adapter/adapters/llm-wiki-adapter.js +2 -6
  38. package/dist/core/adapter/adapters/okf-adapter.js +7 -18
  39. package/dist/core/adapter/adapters/shared.js +2 -0
  40. package/dist/core/adapter/adapters/tool-dir-shared.js +3 -9
  41. package/dist/core/adapter/adapters/website-snapshot-adapter.js +2 -6
  42. package/dist/core/adapter/validate-context.js +1 -3
  43. package/dist/core/asset/asset-placement.js +1 -3
  44. package/dist/core/asset/frontmatter.js +96 -0
  45. package/dist/core/common.js +66 -2
  46. package/dist/core/config/config-walker.js +6 -10
  47. package/dist/core/config/config.js +11 -8
  48. package/dist/core/extra-params.js +17 -13
  49. package/dist/core/improve-result.js +1 -3
  50. package/dist/core/json-schema.js +9 -11
  51. package/dist/core/state/migrations.js +52 -2
  52. package/dist/core/state-db.js +2 -1
  53. package/dist/execution/executable-identity.js +1 -3
  54. package/dist/execution/guarded-source.js +1 -6
  55. package/dist/indexer/bundle-identity-guard.js +6 -1
  56. package/dist/indexer/db/graph-db.js +139 -154
  57. package/dist/indexer/ensure-index.js +11 -19
  58. package/dist/indexer/graph/graph-boost.js +23 -34
  59. package/dist/indexer/graph/graph-extraction.js +12 -2
  60. package/dist/indexer/indexer.js +1 -1
  61. package/dist/indexer/lookup/adapter-concept-owner.js +12 -9
  62. package/dist/indexer/passes/memory-inference.js +7 -2
  63. package/dist/indexer/scan/drain-dir.js +2 -4
  64. package/dist/indexer/search/db-search.js +3 -3
  65. package/dist/indexer/search/fts-query.js +10 -15
  66. package/dist/indexer/search/search-source.js +0 -13
  67. package/dist/indexer/usage/usage-events.js +9 -1
  68. package/dist/indexer/walk/walker.js +11 -6
  69. package/dist/integrations/harnesses/claude/result-extractor.js +30 -15
  70. package/dist/integrations/harnesses/codex/result-extractor.js +43 -6
  71. package/dist/integrations/harnesses/copilot/result-extractor.js +39 -12
  72. package/dist/integrations/harnesses/gemini/result-extractor.js +40 -12
  73. package/dist/integrations/harnesses/index.js +0 -4
  74. package/dist/integrations/harnesses/openhands/result-extractor.js +51 -19
  75. package/dist/integrations/harnesses/pi/result-extractor.js +45 -12
  76. package/dist/integrations/lockfile.js +0 -14
  77. package/dist/integrations/session-logs/index.js +0 -81
  78. package/dist/llm/client.js +0 -12
  79. package/dist/llm/memory-infer.js +1 -3
  80. package/dist/llm/usage-telemetry.js +1 -3
  81. package/dist/registry/create-provider-registry.js +4 -0
  82. package/dist/registry/factory.js +4 -0
  83. package/dist/registry/resolve.js +23 -8
  84. package/dist/runtime.js +0 -12
  85. package/dist/scripts/akm-migrate-node.js +142 -244
  86. package/dist/scripts/akm-migrate.js +142 -244
  87. package/dist/setup/setup.js +6 -12
  88. package/dist/sources/providers/git-install.js +7 -2
  89. package/dist/sources/providers/tar-utils.js +1 -7
  90. package/dist/sources/snapshot-fetchers/content-extract.js +0 -17
  91. package/dist/storage/managed-db.js +20 -7
  92. package/dist/storage/repositories/events-repository.js +0 -81
  93. package/dist/storage/repositories/index-entries-repository.js +0 -17
  94. package/dist/storage/repositories/index-fts-repository.js +24 -30
  95. package/dist/storage/repositories/index-utility-repository.js +0 -57
  96. package/dist/storage/repositories/index-vec-repository.js +25 -27
  97. package/dist/storage/repositories/task-history-repository.js +9 -3
  98. package/dist/tasks/backends/launchd.js +8 -18
  99. package/dist/tasks/run/task-history.js +21 -31
  100. package/dist/tasks/scheduler-sync.js +1 -6
  101. package/dist/tasks/source/bounded-document.js +1 -14
  102. package/dist/workflows/exec/child-workflow.js +1 -1
  103. package/dist/workflows/exec/native-executor.js +2 -2
  104. package/dist/workflows/exec/step-work.js +5 -17
  105. package/dist/workflows/exec/worktree.js +40 -6
  106. package/dist/workflows/freeze/task-bindings.js +2 -4
  107. package/dist/workflows/ir/compile.js +3 -14
  108. package/dist/workflows/ir/schema-v4.js +4 -6
  109. package/dist/workflows/ir/schema.js +2 -5
  110. package/dist/workflows/parser.js +23 -26
  111. package/dist/workflows/source-files.js +8 -13
  112. package/dist/workflows/source-ir/schema.js +1 -19
  113. package/docs/migration/v0.9.0-troubleshooting.md +12 -2
  114. package/docs/reference/cli.md +2 -0
  115. package/docs/reference/workflow-schema.md +24 -0
  116. package/package.json +2 -5
  117. package/dist/workflows/source-ir/compare.js +0 -17
@@ -9453,6 +9453,12 @@ function stripJsonComments(text) {
9453
9453
  }
9454
9454
  return result;
9455
9455
  }
9456
+ function toPosix(input) {
9457
+ return input.replace(/\\/g, "/");
9458
+ }
9459
+ function compareCodePoints(left, right) {
9460
+ return left < right ? -1 : left > right ? 1 : 0;
9461
+ }
9456
9462
  function isContainedRelativePath(value) {
9457
9463
  if (value === "" || value.startsWith("/") || value.startsWith("\\") || value.startsWith("~"))
9458
9464
  return false;
@@ -9505,6 +9511,40 @@ function asNonEmptyString(value) {
9505
9511
  const trimmed = value.trim();
9506
9512
  return trimmed.length > 0 ? trimmed : undefined;
9507
9513
  }
9514
+ var ENV_ASSIGN_LINE_RE = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=/;
9515
+ function scanEnvKeyNames(text) {
9516
+ const keys = [];
9517
+ const seen = new Set;
9518
+ for (const line of text.split(/\r?\n/)) {
9519
+ const m = line.match(ENV_ASSIGN_LINE_RE);
9520
+ if (!m)
9521
+ continue;
9522
+ const key = m[1];
9523
+ if (!key)
9524
+ continue;
9525
+ if (seen.has(key))
9526
+ continue;
9527
+ seen.add(key);
9528
+ keys.push(key);
9529
+ }
9530
+ return keys;
9531
+ }
9532
+ function wellFormedUnicode(value) {
9533
+ for (let index = 0;index < value.length; index += 1) {
9534
+ const code = value.charCodeAt(index);
9535
+ if (code >= 55296 && code <= 56319) {
9536
+ const next = value.charCodeAt(index + 1);
9537
+ if (!(next >= 56320 && next <= 57343))
9538
+ return false;
9539
+ index += 1;
9540
+ } else if (code >= 56320 && code <= 57343)
9541
+ return false;
9542
+ }
9543
+ return true;
9544
+ }
9545
+ function isRecord(value) {
9546
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9547
+ }
9508
9548
  function isProcessAlive(pid) {
9509
9549
  if (typeof pid !== "number" || !Number.isInteger(pid) || pid <= 0)
9510
9550
  return false;
@@ -11547,9 +11587,6 @@ function isKnownType(type) {
11547
11587
  var DEPRECATED_REJECTED_TYPES = new Set(["tool", "vault"]);
11548
11588
 
11549
11589
  // src/core/asset/asset-placement.ts
11550
- function toPosix(input) {
11551
- return input.replace(/\\/g, "/");
11552
- }
11553
11590
  var workflowSpec = {
11554
11591
  isRelevantFile: (fileName) => WORKFLOW_EXTENSIONS.includes(path5.extname(fileName).toLowerCase()),
11555
11592
  toCanonicalName: (typeRoot, filePath) => {
@@ -12650,6 +12687,7 @@ function readTags(value) {
12650
12687
  const tags = value.filter((tag) => typeof tag === "string" && tag.trim().length > 0);
12651
12688
  return tags.length > 0 ? tags : undefined;
12652
12689
  }
12690
+ var RESERVED_FILES = new Set(["index.md", "log.md"]);
12653
12691
  function checkMissingUpdated(data, frontmatterText) {
12654
12692
  return frontmatterText !== null && !("updated" in data);
12655
12693
  }
@@ -12787,12 +12825,8 @@ var NAME_MAX = 64;
12787
12825
  var DESCRIPTION_MAX = 1024;
12788
12826
  var RESERVED_NAME_WORDS = ["anthropic", "claude"];
12789
12827
  var NAME_RE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
12790
- var MAX_CONTENT_CHARS = 1e5;
12791
- function toPosix2(p) {
12792
- return p.replace(/\\/g, "/");
12793
- }
12794
12828
  function skillPackage(relPath) {
12795
- const posix = toPosix2(relPath);
12829
+ const posix = toPosix(relPath);
12796
12830
  const segs = posix.split("/").filter((s) => s.length > 0);
12797
12831
  if (segs.length < 2 || segs[segs.length - 1] !== SKILL_MANIFEST)
12798
12832
  return null;
@@ -12821,7 +12855,7 @@ function recognize(c, file) {
12821
12855
  adapterId: "agent-skills",
12822
12856
  type: "skill",
12823
12857
  name,
12824
- content: body.length > MAX_CONTENT_CHARS ? body.slice(0, MAX_CONTENT_CHARS) : body
12858
+ content: body
12825
12859
  };
12826
12860
  if (description !== undefined)
12827
12861
  doc.description = description;
@@ -12909,7 +12943,7 @@ async function validate(_c, changes, ctx) {
12909
12943
  if (seenDirs.has(pkg.conceptId))
12910
12944
  continue;
12911
12945
  seenDirs.add(pkg.conceptId);
12912
- diagnostics.push(...skillFieldDiagnostics(toPosix2(change.path), pkg.dirName, parseFrontmatter(raw).data));
12946
+ diagnostics.push(...skillFieldDiagnostics(toPosix(change.path), pkg.dirName, parseFrontmatter(raw).data));
12913
12947
  }
12914
12948
  diagnostics.push(...await missingManifestDiagnostics(ctx));
12915
12949
  return diagnostics;
@@ -14768,24 +14802,6 @@ import path14 from "path";
14768
14802
 
14769
14803
  // src/commands/env/env.ts
14770
14804
  var import_dotenv = __toESM(require_main(), 1);
14771
- var ASSIGN_RE = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=/;
14772
- function scanEnvKeyNames(text) {
14773
- const keys = [];
14774
- const seen = new Set;
14775
- for (const line of text.split(/\r?\n/)) {
14776
- const m = line.match(ASSIGN_RE);
14777
- if (!m)
14778
- continue;
14779
- const key = m[1];
14780
- if (!key)
14781
- continue;
14782
- if (seen.has(key))
14783
- continue;
14784
- seen.add(key);
14785
- keys.push(key);
14786
- }
14787
- return keys;
14788
- }
14789
14805
 
14790
14806
  // src/commands/lint/env-key-rules.ts
14791
14807
  var DANGEROUS_ENV_KEYS = new Set([
@@ -14923,19 +14939,6 @@ function own2(value, key) {
14923
14939
  function utf8Bytes2(value) {
14924
14940
  return new TextEncoder().encode(value).byteLength;
14925
14941
  }
14926
- function wellFormedUnicode(value) {
14927
- for (let index = 0;index < value.length; index += 1) {
14928
- const code = value.charCodeAt(index);
14929
- if (code >= 55296 && code <= 56319) {
14930
- const next = value.charCodeAt(index + 1);
14931
- if (!(next >= 56320 && next <= 57343))
14932
- return false;
14933
- index += 1;
14934
- } else if (code >= 56320 && code <= 57343)
14935
- return false;
14936
- }
14937
- return true;
14938
- }
14939
14942
  function sourceError(ctx, fieldPath, detail) {
14940
14943
  const dotted = fieldPath.length === 0 ? "$" : fieldPath.reduce((display, segment) => typeof segment === "number" ? `${display}[${segment}]` : display.length > 0 ? `${display}.${segment}` : segment, "");
14941
14944
  const line = ctx.lineAt?.(fieldPath);
@@ -15347,9 +15350,6 @@ function pointerFor(path10) {
15347
15350
  function pushIssue(issues, path10, keyword, kind, message) {
15348
15351
  issues.push({ path: [...path10], pointer: pointerFor(path10), keyword, kind, message });
15349
15352
  }
15350
- function isPlainObject(value) {
15351
- return typeof value === "object" && value !== null && !Array.isArray(value);
15352
- }
15353
15353
  function isSupportedEnumValue(value) {
15354
15354
  return value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value);
15355
15355
  }
@@ -15399,7 +15399,7 @@ function checkDefinitionNode(schema, path10, issues, depth) {
15399
15399
  continue;
15400
15400
  }
15401
15401
  branches.forEach((branch, index) => {
15402
- if (isPlainObject(branch)) {
15402
+ if (isRecord(branch)) {
15403
15403
  checkDefinitionNode(branch, [...path10, keyword, index], issues, depth + 1);
15404
15404
  } else {
15405
15405
  pushIssue(issues, [...path10, keyword, index], keyword, "malformed", `"${keyword}[${index}]" must be a schema object`);
@@ -15407,7 +15407,7 @@ function checkDefinitionNode(schema, path10, issues, depth) {
15407
15407
  });
15408
15408
  }
15409
15409
  if (schema.not !== undefined) {
15410
- if (isPlainObject(schema.not)) {
15410
+ if (isRecord(schema.not)) {
15411
15411
  checkDefinitionNode(schema.not, [...path10, "not"], issues, depth + 1);
15412
15412
  } else {
15413
15413
  pushIssue(issues, [...path10, "not"], "not", "malformed", `"not" must be a schema object`);
@@ -15419,11 +15419,11 @@ function checkDefinitionNode(schema, path10, issues, depth) {
15419
15419
  }
15420
15420
  }
15421
15421
  if (schema.properties !== undefined) {
15422
- if (!isPlainObject(schema.properties)) {
15422
+ if (!isRecord(schema.properties)) {
15423
15423
  pushIssue(issues, [...path10, "properties"], "properties", "malformed", `"properties" must be an object mapping property names to schemas`);
15424
15424
  } else {
15425
15425
  for (const [key, propSchema] of Object.entries(schema.properties)) {
15426
- if (isPlainObject(propSchema)) {
15426
+ if (isRecord(propSchema)) {
15427
15427
  checkDefinitionNode(propSchema, [...path10, "properties", key], issues, depth + 1);
15428
15428
  } else {
15429
15429
  pushIssue(issues, [...path10, "properties", key], "properties", "malformed", `property ${JSON.stringify(key)} must be a schema object`);
@@ -15432,7 +15432,7 @@ function checkDefinitionNode(schema, path10, issues, depth) {
15432
15432
  }
15433
15433
  }
15434
15434
  if (schema.items !== undefined) {
15435
- if (isPlainObject(schema.items)) {
15435
+ if (isRecord(schema.items)) {
15436
15436
  checkDefinitionNode(schema.items, [...path10, "items"], issues, depth + 1);
15437
15437
  } else if (Array.isArray(schema.items)) {
15438
15438
  pushIssue(issues, [...path10, "items"], "items", "unsupported", `tuple-form "items" (an array of schemas) is not enforced by the workflow schema subset \u2014 use a single schema object`);
@@ -15441,7 +15441,7 @@ function checkDefinitionNode(schema, path10, issues, depth) {
15441
15441
  }
15442
15442
  }
15443
15443
  if (schema.additionalProperties !== undefined && typeof schema.additionalProperties !== "boolean") {
15444
- if (isPlainObject(schema.additionalProperties)) {
15444
+ if (isRecord(schema.additionalProperties)) {
15445
15445
  pushIssue(issues, [...path10, "additionalProperties"], "additionalProperties", "unsupported", `schema-form "additionalProperties" is not enforced by the workflow schema subset \u2014 only "additionalProperties: false" is`);
15446
15446
  } else {
15447
15447
  pushIssue(issues, [...path10, "additionalProperties"], "additionalProperties", "malformed", `"additionalProperties" must be a boolean (only "false" is enforced)`);
@@ -15490,7 +15490,7 @@ function combinatorBranches(schema, keyword) {
15490
15490
  const raw = schema[keyword];
15491
15491
  if (!Array.isArray(raw))
15492
15492
  return [];
15493
- return raw.filter(isPlainObject);
15493
+ return raw.filter(isRecord);
15494
15494
  }
15495
15495
  function summarizeBranchFailures(failures) {
15496
15496
  const shown = failures.slice(0, 3).map((f) => `${f.index + 1}: ${f.errors[0] ?? "no match"}`);
@@ -15522,7 +15522,7 @@ function validateCombinators(value, schema, path10, ctx) {
15522
15522
  }
15523
15523
  }
15524
15524
  const not = schema.not;
15525
- if (isPlainObject(not) && branchErrors(value, not, path10, ctx).length === 0) {
15525
+ if (isRecord(not) && branchErrors(value, not, path10, ctx).length === 0) {
15526
15526
  ctx.errors.push(`${path10}: value must not match the "not" schema`);
15527
15527
  }
15528
15528
  }
@@ -16278,20 +16278,17 @@ function formatExtraParamsIssue(label, issue) {
16278
16278
  const suffix = issue.path.map((part) => typeof part === "number" ? `[${part}]` : `.${part}`).join("");
16279
16279
  return `${label}${suffix} ${issue.message}`;
16280
16280
  }
16281
- function isPlainObject2(value) {
16282
- return typeof value === "object" && value !== null && !Array.isArray(value);
16283
- }
16284
16281
  function liftLegacyEngineExtraParams(raw) {
16285
16282
  const lifted = [];
16286
16283
  const conflicts = [];
16287
16284
  const rawEngines = raw.engines;
16288
- if (!isPlainObject2(rawEngines)) {
16285
+ if (!isRecord(rawEngines)) {
16289
16286
  return { config: raw, lifted, conflicts };
16290
16287
  }
16291
16288
  const engines = {};
16292
16289
  let anyEngineChanged = false;
16293
16290
  for (const [name, engineValue] of Object.entries(rawEngines)) {
16294
- if (!isPlainObject2(engineValue) || !isPlainObject2(engineValue.extraParams)) {
16291
+ if (!isRecord(engineValue) || !isRecord(engineValue.extraParams)) {
16295
16292
  engines[name] = engineValue;
16296
16293
  continue;
16297
16294
  }
@@ -17811,11 +17808,6 @@ function sourceStepRef(source) {
17811
17808
  // src/workflows/source-ir/schema.ts
17812
17809
  import { types as utilTypes2 } from "util";
17813
17810
 
17814
- // src/workflows/source-ir/compare.ts
17815
- function compareWorkflowSourceCodePoints(left, right) {
17816
- return left < right ? -1 : left > right ? 1 : 0;
17817
- }
17818
-
17819
17811
  // src/workflows/source-ir/semantics.ts
17820
17812
  import fs7 from "fs";
17821
17813
  import path12 from "path";
@@ -18454,9 +18446,6 @@ function validateStep(value, jobId, index, stepIds, options) {
18454
18446
  extensions(step.extensions, `step ${id} extensions`);
18455
18447
  span(step.source, `step ${id} source`);
18456
18448
  }
18457
- function compareCodePoints(left, right) {
18458
- return compareWorkflowSourceCodePoints(left, right);
18459
- }
18460
18449
  function validateExec(value, location, options) {
18461
18450
  if (value === undefined)
18462
18451
  return;
@@ -18762,7 +18751,7 @@ function snapshotValue(value, depth, location, state) {
18762
18751
  return value;
18763
18752
  }
18764
18753
  if (typeof value === "string") {
18765
- if (!wellFormedUnicode2(value))
18754
+ if (!wellFormedUnicode(value))
18766
18755
  fail2(`${location} must contain well-formed Unicode`);
18767
18756
  countJsonBytes(state, JSON.stringify(value));
18768
18757
  return value;
@@ -18826,7 +18815,7 @@ function snapshotObject(value, depth, location, state) {
18826
18815
  for (const [index, key] of ownKeys.entries()) {
18827
18816
  if (typeof key === "symbol")
18828
18817
  fail2(`${location} contains symbol keys`);
18829
- if (!wellFormedUnicode2(key))
18818
+ if (!wellFormedUnicode(key))
18830
18819
  fail2(`${location} contains an ill-formed key`);
18831
18820
  if (UNSAFE_KEYS.has(key))
18832
18821
  fail2(`${location} contains unsafe key ${key}`);
@@ -18855,20 +18844,6 @@ function countJsonBytes(state, token) {
18855
18844
  if (state.bytes > WORKFLOW_SOURCE_IR_MAX_BYTES)
18856
18845
  fail2("source IR exceeds the byte limit");
18857
18846
  }
18858
- function wellFormedUnicode2(value) {
18859
- for (let index = 0;index < value.length; index++) {
18860
- const code = value.charCodeAt(index);
18861
- if (code >= 55296 && code <= 56319) {
18862
- const next = value.charCodeAt(index + 1);
18863
- if (!(next >= 56320 && next <= 57343))
18864
- return false;
18865
- index++;
18866
- } else if (code >= 56320 && code <= 57343) {
18867
- return false;
18868
- }
18869
- }
18870
- return true;
18871
- }
18872
18847
  function record(value, location) {
18873
18848
  if (value === null || typeof value !== "object" || Array.isArray(value))
18874
18849
  fail2(`${location} must be an object`);
@@ -19013,14 +18988,11 @@ function compileWorkflowPlan(input, title, resolvedUnits = new Map) {
19013
18988
  }
19014
18989
  function sortedOutputs(outputs) {
19015
18990
  const sorted = {};
19016
- for (const name of Object.keys(outputs).sort(compareCodePoints2)) {
18991
+ for (const name of Object.keys(outputs).sort(compareCodePoints)) {
19017
18992
  sorted[name] = outputs[name];
19018
18993
  }
19019
18994
  return sorted;
19020
18995
  }
19021
- function compareCodePoints2(left, right) {
19022
- return left < right ? -1 : left > right ? 1 : 0;
19023
- }
19024
18996
  function compileStep(step, sequenceIndex, defaults, resolved) {
19025
18997
  const gate = {
19026
18998
  kind: "gate",
@@ -19147,12 +19119,6 @@ function collectWorkflowWarnings(input) {
19147
19119
  message: `Step "${step.id}" declares \`gate.max_loops: ${maxLoops}\` on an \`exec\` step \u2014 it runs its command ` + `ONCE. A gate loop re-executes the step so it can address the judge's feedback, and a frozen argv cannot ` + `read that feedback; looping would only repeat the command's side effects. The gate still evaluates and ` + `can still fail the step.`
19148
19120
  });
19149
19121
  }
19150
- if ((step.map || step.route === undefined) && step.output === undefined) {
19151
- warnings.push({
19152
- line: step.source.start,
19153
- message: `Step "${step.id}" declares no \`output:\` schema \u2014 its unit results are carried as an untyped ` + `artifact (permitted). Add an \`output:\` JSON Schema to type and validate the step artifact.`
19154
- });
19155
- }
19156
19122
  if (declaredParams) {
19157
19123
  const declaredList = [...declaredParams].join(", ");
19158
19124
  const scan = (text, label) => {
@@ -19366,7 +19332,7 @@ function parseWorkflow(markdown, source) {
19366
19332
  };
19367
19333
  if (root === null || root === undefined)
19368
19334
  root = {};
19369
- if (!isPlainRecord(root)) {
19335
+ if (!isRecord(root)) {
19370
19336
  return {
19371
19337
  ok: false,
19372
19338
  errors: [{ line: 2, message: `Workflow frontmatter must be a YAML mapping (key: value pairs).` }]
@@ -19547,7 +19513,7 @@ function checkEnvelopeFields(ctx, root, fmEndLine) {
19547
19513
  checkActorStamp(ctx, root.verified, ["verified"], `"verified"`);
19548
19514
  }
19549
19515
  }
19550
- if (root.provenance !== undefined && !isPlainRecord(root.provenance)) {
19516
+ if (root.provenance !== undefined && !isRecord(root.provenance)) {
19551
19517
  ctx.err(["provenance"], `Workflow frontmatter "provenance" must be a mapping.`);
19552
19518
  }
19553
19519
  if (root.status !== undefined && (typeof root.status !== "string" || !LIFECYCLE_STATUSES.has(root.status))) {
@@ -19560,7 +19526,7 @@ function checkEnvelopeFields(ctx, root, fmEndLine) {
19560
19526
  function checkActorStamp(ctx, value, path13, label) {
19561
19527
  if (value === undefined)
19562
19528
  return;
19563
- if (!isPlainRecord(value)) {
19529
+ if (!isRecord(value)) {
19564
19530
  ctx.err(path13, `Workflow frontmatter ${label} must be a mapping with a non-empty "by".`);
19565
19531
  return;
19566
19532
  }
@@ -19591,7 +19557,7 @@ function checkXrefs2(ctx, value, fmEndLine) {
19591
19557
  function parseParams(ctx, raw) {
19592
19558
  if (raw === undefined)
19593
19559
  return;
19594
- if (!isPlainRecord(raw)) {
19560
+ if (!isRecord(raw)) {
19595
19561
  ctx.err(["params"], `"params" must be a mapping of param name to a JSON Schema object (e.g. changed_files: { type: array }).`);
19596
19562
  return;
19597
19563
  }
@@ -19601,7 +19567,7 @@ function parseParams(ctx, raw) {
19601
19567
  ctx.err(["params", paramName], `Param name "${paramName}" is invalid. Use letters, digits, and underscores, starting with a letter or underscore, so "params.${paramName}" can address it.`);
19602
19568
  continue;
19603
19569
  }
19604
- if (!isPlainRecord(value)) {
19570
+ if (!isRecord(value)) {
19605
19571
  ctx.err(["params", paramName], `Param "${paramName}" must be a JSON Schema object (e.g. { type: string }).`);
19606
19572
  continue;
19607
19573
  }
@@ -19616,7 +19582,7 @@ function parseParams(ctx, raw) {
19616
19582
  function parseOutputs(ctx, raw) {
19617
19583
  if (raw === undefined)
19618
19584
  return;
19619
- if (!isPlainRecord(raw)) {
19585
+ if (!isRecord(raw)) {
19620
19586
  ctx.err(["outputs"], `"outputs" must be a mapping of output name to { from, schema? } (e.g. report: { from: steps.summarize.output }).`);
19621
19587
  return;
19622
19588
  }
@@ -19627,7 +19593,7 @@ function parseOutputs(ctx, raw) {
19627
19593
  ctx.err(path13, `Output name "${outputName}" is invalid. Use letters, digits, and underscores, starting with a letter or ` + `underscore, so "steps.<child>.output.${outputName}" can address it.`);
19628
19594
  continue;
19629
19595
  }
19630
- if (!isPlainRecord(value)) {
19596
+ if (!isRecord(value)) {
19631
19597
  ctx.err(path13, `Output "${outputName}" must be a mapping with "from" (and optional "schema").`);
19632
19598
  continue;
19633
19599
  }
@@ -19647,7 +19613,7 @@ function parseOutputs(ctx, raw) {
19647
19613
  }
19648
19614
  const entry = { from: value.from };
19649
19615
  if (value.schema !== undefined) {
19650
- if (!isPlainRecord(value.schema)) {
19616
+ if (!isRecord(value.schema)) {
19651
19617
  ctx.err([...path13, "schema"], `Output "${outputName}" "schema" must be a JSON Schema object.`);
19652
19618
  } else {
19653
19619
  if (jsonBytes(value.schema) > WORKFLOW_MAX_SCHEMA_BYTES) {
@@ -19665,7 +19631,7 @@ function parseDefaults(ctx, raw) {
19665
19631
  if (raw === undefined)
19666
19632
  return;
19667
19633
  const path13 = ["defaults"];
19668
- if (!isPlainRecord(raw)) {
19634
+ if (!isRecord(raw)) {
19669
19635
  ctx.err(path13, `"defaults" must be a mapping with any of: ${DEFAULTS_KEYS.join(", ")}.`);
19670
19636
  return;
19671
19637
  }
@@ -19697,7 +19663,7 @@ function parseBudget(ctx, raw) {
19697
19663
  if (raw === undefined)
19698
19664
  return;
19699
19665
  const path13 = ["budget"];
19700
- if (!isPlainRecord(raw)) {
19666
+ if (!isRecord(raw)) {
19701
19667
  ctx.err(path13, `"budget" must be a mapping with any of: ${BUDGET_KEYS.join(", ")}.`);
19702
19668
  return;
19703
19669
  }
@@ -19726,7 +19692,7 @@ function parseSteps(ctx, raw) {
19726
19692
  }
19727
19693
  const idIndex = new Map;
19728
19694
  raw.forEach((rawStep, index) => {
19729
- if (isPlainRecord(rawStep) && typeof rawStep.id === "string" && !idIndex.has(rawStep.id)) {
19695
+ if (isRecord(rawStep) && typeof rawStep.id === "string" && !idIndex.has(rawStep.id)) {
19730
19696
  idIndex.set(rawStep.id, index);
19731
19697
  }
19732
19698
  });
@@ -19735,7 +19701,7 @@ function parseSteps(ctx, raw) {
19735
19701
  const routeChecks = [];
19736
19702
  raw.forEach((rawStep, index) => {
19737
19703
  const path13 = ["steps", index];
19738
- if (!isPlainRecord(rawStep)) {
19704
+ if (!isRecord(rawStep)) {
19739
19705
  ctx.err(path13, `Step ${index + 1} must be a mapping with an "id".`);
19740
19706
  return;
19741
19707
  }
@@ -19809,7 +19775,7 @@ function parseSteps(ctx, raw) {
19809
19775
  return steps;
19810
19776
  }
19811
19777
  function parseUnit(ctx, raw, path13, stepLabel) {
19812
- if (!isPlainRecord(raw)) {
19778
+ if (!isRecord(raw)) {
19813
19779
  ctx.err(path13, `${stepLabel} "unit" must be a mapping (a dispatch-override bag).`);
19814
19780
  return;
19815
19781
  }
@@ -19870,7 +19836,7 @@ function parseUnit(ctx, raw, path13, stepLabel) {
19870
19836
  return unit;
19871
19837
  }
19872
19838
  function parseExec(ctx, raw, path13, stepLabel) {
19873
- if (!isPlainRecord(raw)) {
19839
+ if (!isRecord(raw)) {
19874
19840
  ctx.err(path13, `${stepLabel} "exec" must be a mapping with a "command" argv list.`);
19875
19841
  return;
19876
19842
  }
@@ -19954,7 +19920,7 @@ function parseExecCwd(ctx, raw, path13, stepLabel) {
19954
19920
  return value;
19955
19921
  }
19956
19922
  function parseMap(ctx, raw, path13, stepLabel) {
19957
- if (!isPlainRecord(raw)) {
19923
+ if (!isRecord(raw)) {
19958
19924
  ctx.err(path13, `${stepLabel} "map" must be a mapping with an "over" key.`);
19959
19925
  return;
19960
19926
  }
@@ -19986,7 +19952,7 @@ function parseMap(ctx, raw, path13, stepLabel) {
19986
19952
  return map;
19987
19953
  }
19988
19954
  function parseRoute(ctx, raw, path13, stepLabel, stepIndex, routeChecks) {
19989
- if (!isPlainRecord(raw)) {
19955
+ if (!isRecord(raw)) {
19990
19956
  ctx.err(path13, `${stepLabel} "route" must be a mapping with "input" and "when" keys.`);
19991
19957
  return;
19992
19958
  }
@@ -20006,7 +19972,7 @@ function parseRoute(ctx, raw, path13, stepLabel, stepIndex, routeChecks) {
20006
19972
  const seenMatches = new Map;
20007
19973
  raw.when.forEach((branch, i) => {
20008
19974
  const branchPath = [...whenPath, i];
20009
- if (!isPlainRecord(branch)) {
19975
+ if (!isRecord(branch)) {
20010
19976
  ctx.err(branchPath, `${stepLabel} "when[${i}]" must be a mapping: { match, step }.`);
20011
19977
  return;
20012
19978
  }
@@ -20077,7 +20043,7 @@ function parseInputs(ctx, raw, path13, stepLabel) {
20077
20043
  return out.length > 0 ? out : undefined;
20078
20044
  }
20079
20045
  function parseGate(ctx, raw, path13, stepLabel) {
20080
- if (!isPlainRecord(raw)) {
20046
+ if (!isRecord(raw)) {
20081
20047
  ctx.err(path13, `${stepLabel} "gate" must be a mapping with any of: ${GATE_KEYS.join(", ")}.`);
20082
20048
  return;
20083
20049
  }
@@ -20107,7 +20073,7 @@ function parseEngineName(ctx, raw, path13, label) {
20107
20073
  function parseRetry(ctx, raw, path13, stepLabel) {
20108
20074
  if (raw === undefined)
20109
20075
  return;
20110
- if (!isPlainRecord(raw)) {
20076
+ if (!isRecord(raw)) {
20111
20077
  ctx.err(path13, `${stepLabel} "retry" must be a mapping: { max: <n>, on: [<failure_reason>, \u2026] }.`);
20112
20078
  return;
20113
20079
  }
@@ -20180,7 +20146,7 @@ function parseEnumField(ctx, raw, path13, label, allowed) {
20180
20146
  function parseLlmOverrides(ctx, raw, path13, label) {
20181
20147
  if (raw === undefined)
20182
20148
  return;
20183
- if (!isPlainRecord(raw)) {
20149
+ if (!isRecord(raw)) {
20184
20150
  ctx.err(path13, `${label} must be a mapping of LLM invocation overrides.`);
20185
20151
  return;
20186
20152
  }
@@ -20214,7 +20180,7 @@ function parseLlmOverrides(ctx, raw, path13, label) {
20214
20180
  ctx.err([...path13, "supports_json_schema"], `${label}.supports_json_schema must be a boolean.`);
20215
20181
  }
20216
20182
  if (raw.extra_params !== undefined) {
20217
- if (!isPlainRecord(raw.extra_params)) {
20183
+ if (!isRecord(raw.extra_params)) {
20218
20184
  ctx.err([...path13, "extra_params"], `${label}.extra_params must be a JSON object.`);
20219
20185
  } else {
20220
20186
  const issues = validateExtraParams(raw.extra_params);
@@ -20252,7 +20218,7 @@ function parseLlmOverrides(ctx, raw, path13, label) {
20252
20218
  function parseSchemaObject(ctx, raw, path13, label) {
20253
20219
  if (raw === undefined)
20254
20220
  return;
20255
- if (!isPlainRecord(raw)) {
20221
+ if (!isRecord(raw)) {
20256
20222
  ctx.err(path13, `${label} must be a JSON Schema object (e.g. { type: object, properties: { \u2026 } }).`);
20257
20223
  return;
20258
20224
  }
@@ -20284,9 +20250,6 @@ function checkUnknownKeys(ctx, obj, path13, allowed, label) {
20284
20250
  }
20285
20251
  }
20286
20252
  }
20287
- function isPlainRecord(value) {
20288
- return typeof value === "object" && value !== null && !Array.isArray(value);
20289
- }
20290
20253
  function describeError(cause) {
20291
20254
  return cause instanceof Error ? cause.message : String(cause);
20292
20255
  }
@@ -21167,22 +21130,6 @@ function nameOrTypeDiagnostics(relPath, data, frontmatter, allowedTypes) {
21167
21130
  }
21168
21131
  return [];
21169
21132
  }
21170
- var ASSIGN_RE2 = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=/;
21171
- function scanKeys(text) {
21172
- const keys2 = [];
21173
- const seen = new Set;
21174
- for (const line of text.split(/\r?\n/)) {
21175
- const m = line.match(ASSIGN_RE2);
21176
- if (!m)
21177
- continue;
21178
- const key = m[1];
21179
- if (seen.has(key))
21180
- continue;
21181
- seen.add(key);
21182
- keys2.push(key);
21183
- }
21184
- return keys2;
21185
- }
21186
21133
  function collectSuppressedKeys(raw) {
21187
21134
  const suppressed = new Set;
21188
21135
  const lines = raw.split(/\r?\n/);
@@ -21206,7 +21153,7 @@ function dangerousEnvKeyDiagnostics(type, relPath, raw) {
21206
21153
  if (!baseNameWithExt.endsWith(".env"))
21207
21154
  return [];
21208
21155
  const ref = conceptIdForStashFile(type, ".", relPath);
21209
- const keys2 = scanKeys(raw);
21156
+ const keys2 = scanEnvKeyNames(raw);
21210
21157
  const suppressed = collectSuppressedKeys(raw);
21211
21158
  const diagnostics = [];
21212
21159
  for (const key of keys2) {
@@ -21656,7 +21603,6 @@ function applyFoldedMetadata(entry, folded) {
21656
21603
  }
21657
21604
 
21658
21605
  // src/core/adapter/adapters/akm-adapter.ts
21659
- var RESERVED_FILES = new Set(["index.md", "log.md"]);
21660
21606
  function isReservedFileName(name) {
21661
21607
  return RESERVED_FILES.has(name.toLowerCase());
21662
21608
  }
@@ -21992,14 +21938,10 @@ import fs9 from "fs";
21992
21938
  import path16 from "path";
21993
21939
  var COMPONENT_ID2 = "main";
21994
21940
  var TASK_EXT = TASK_EXTENSION;
21995
- var MAX_CONTENT_CHARS2 = 1e5;
21996
- function toPosix3(p) {
21997
- return p.replace(/\\/g, "/");
21998
- }
21999
21941
  function recognize3(c, file) {
22000
21942
  if (file.ext !== TASK_EXT)
22001
21943
  return null;
22002
- const conceptId = toPosix3(file.relPath).replace(/\.yml$/i, "");
21944
+ const conceptId = toPosix(file.relPath).replace(/\.yml$/i, "");
22003
21945
  const name = conceptId.split("/").pop() ?? conceptId;
22004
21946
  const raw = file.content();
22005
21947
  return {
@@ -22012,7 +21954,7 @@ function recognize3(c, file) {
22012
21954
  adapterId: "akm-task",
22013
21955
  type: "task",
22014
21956
  name,
22015
- content: raw.length > MAX_CONTENT_CHARS2 ? raw.slice(0, MAX_CONTENT_CHARS2) : raw
21957
+ content: raw
22016
21958
  };
22017
21959
  }
22018
21960
  async function validate3(c, changes, ctx) {
@@ -22026,7 +21968,7 @@ async function validate3(c, changes, ctx) {
22026
21968
  const ext = path16.extname(change.path).toLowerCase();
22027
21969
  if (ext !== TASK_EXT && ext !== TASK_NEAR_MISS_EXTENSION)
22028
21970
  continue;
22029
- const relPath = toPosix3(change.path);
21971
+ const relPath = toPosix(change.path);
22030
21972
  if (ext === TASK_NEAR_MISS_EXTENSION) {
22031
21973
  diagnostics.push({
22032
21974
  file: relPath,
@@ -22056,14 +21998,14 @@ var akmTaskAdapter = {
22056
21998
  recognize: recognize3,
22057
21999
  validate: validate3,
22058
22000
  readCandidates(c, conceptId) {
22059
- const posix = toPosix3(conceptId).replace(/\.ya?ml$/i, "");
22001
+ const posix = toPosix(conceptId).replace(/\.ya?ml$/i, "");
22060
22002
  return [
22061
22003
  { path: path16.join(c.root, `${posix}.yml`), conceptId: posix },
22062
22004
  { path: path16.join(c.root, `${posix}.yaml`), conceptId: posix }
22063
22005
  ];
22064
22006
  },
22065
22007
  placeNew(c, conceptId) {
22066
- const posix = toPosix3(conceptId);
22008
+ const posix = toPosix(conceptId);
22067
22009
  return path16.join(c.root, /\.yml$/i.test(posix) ? posix : `${posix}.yml`);
22068
22010
  },
22069
22011
  directoryList() {
@@ -22099,12 +22041,8 @@ import fs10 from "fs";
22099
22041
  import path17 from "path";
22100
22042
  var COMPONENT_ID3 = "main";
22101
22043
  var WORKFLOW_EXTS = new Set([".md", ".yml"]);
22102
- var MAX_CONTENT_CHARS3 = 1e5;
22103
- function toPosix4(p) {
22104
- return p.replace(/\\/g, "/");
22105
- }
22106
22044
  function conceptIdOf(relPath) {
22107
- return toPosix4(relPath).replace(/\.(?:md|yml)$/i, "");
22045
+ return toPosix(relPath).replace(/\.(?:md|yml)$/i, "");
22108
22046
  }
22109
22047
  function isReservedDocFile(fileName) {
22110
22048
  return fileName.toLowerCase() === "readme.md";
@@ -22138,7 +22076,7 @@ function recognize4(c, file) {
22138
22076
  adapterId: "akm-workflow",
22139
22077
  type: "workflow",
22140
22078
  name,
22141
- content: body.length > MAX_CONTENT_CHARS3 ? body.slice(0, MAX_CONTENT_CHARS3) : body
22079
+ content: body
22142
22080
  };
22143
22081
  if (description !== undefined)
22144
22082
  doc.description = description;
@@ -22157,7 +22095,7 @@ async function validate4(c, changes, ctx) {
22157
22095
  const ext = path17.extname(change.path).toLowerCase();
22158
22096
  if (!WORKFLOW_EXTS.has(ext) || isReservedDocFile(path17.basename(change.path)))
22159
22097
  continue;
22160
- const relPath = toPosix4(change.path);
22098
+ const relPath = toPosix(change.path);
22161
22099
  if (ext === ".yml") {
22162
22100
  diagnostics.push(...workflowYamlSourceDiagnostics(relPath, raw, relPath, c.root).errors);
22163
22101
  continue;
@@ -22207,7 +22145,7 @@ var akmWorkflowAdapter = {
22207
22145
  recognize: recognize4,
22208
22146
  validate: validate4,
22209
22147
  readCandidates(c, conceptId) {
22210
- const posix = toPosix4(conceptId);
22148
+ const posix = toPosix(conceptId);
22211
22149
  const canonical = posix.replace(/\.(?:md|yml)$/i, "");
22212
22150
  return /\.(?:md|yml)$/i.test(posix) ? [{ path: path17.join(c.root, posix), conceptId: canonical }] : [
22213
22151
  { path: path17.join(c.root, `${posix}.md`), conceptId: canonical },
@@ -22215,7 +22153,7 @@ var akmWorkflowAdapter = {
22215
22153
  ];
22216
22154
  },
22217
22155
  placeNew(c, conceptId) {
22218
- const posix = toPosix4(conceptId);
22156
+ const posix = toPosix(conceptId);
22219
22157
  if (/\.(?:md|yml)$/i.test(posix))
22220
22158
  return path17.join(c.root, posix);
22221
22159
  return path17.join(c.root, `${posix}.md`);
@@ -22240,20 +22178,15 @@ import path19 from "path";
22240
22178
 
22241
22179
  // src/core/adapter/adapters/tool-dir-shared.ts
22242
22180
  import path18 from "path";
22243
- var RESERVED_FILES2 = new Set(["index.md", "log.md"]);
22244
- var MAX_CONTENT_CHARS4 = 1e5;
22245
22181
  var CANONICAL_COMMAND_DIR = "commands";
22246
22182
  var CANONICAL_AGENT_DIR = "agents";
22247
22183
  var CANONICAL_SKILL_DIR = "skills";
22248
22184
  var SKILL_MANIFEST2 = "SKILL.md";
22249
- function toPosix5(p) {
22250
- return p.replace(/\\/g, "/");
22251
- }
22252
22185
  function isReserved(base3) {
22253
- return RESERVED_FILES2.has(base3.toLowerCase());
22186
+ return RESERVED_FILES.has(base3.toLowerCase());
22254
22187
  }
22255
22188
  function classify(relPath, layout) {
22256
- const posix = toPosix5(relPath);
22189
+ const posix = toPosix(relPath);
22257
22190
  const segs = posix.split("/").filter((s) => s.length > 0);
22258
22191
  if (segs.length === 0)
22259
22192
  return null;
@@ -22300,7 +22233,7 @@ function recognizeToolDir(layout, c, file) {
22300
22233
  adapterId: layout.adapterId,
22301
22234
  type: cls.type,
22302
22235
  name,
22303
- content: body.length > MAX_CONTENT_CHARS4 ? body.slice(0, MAX_CONTENT_CHARS4) : body
22236
+ content: body
22304
22237
  };
22305
22238
  if (cls.type === "instruction")
22306
22239
  doc.ownsPresentation = true;
@@ -22311,7 +22244,7 @@ function recognizeToolDir(layout, c, file) {
22311
22244
  return doc;
22312
22245
  }
22313
22246
  function placeNewToolDir(layout, c, conceptId) {
22314
- const posix = toPosix5(conceptId);
22247
+ const posix = toPosix(conceptId);
22315
22248
  if (posix === layout.instructionConceptId)
22316
22249
  return path18.join(c.root, layout.instructionFile);
22317
22250
  const segs = posix.split("/").filter((s) => s.length > 0);
@@ -22328,7 +22261,7 @@ function placeNewToolDir(layout, c, conceptId) {
22328
22261
  return path18.join(c.root, `${posix}.md`);
22329
22262
  }
22330
22263
  function readCandidatesToolDir(layout, c, conceptId) {
22331
- const posix = toPosix5(conceptId);
22264
+ const posix = toPosix(conceptId);
22332
22265
  if (posix === layout.instructionConceptId) {
22333
22266
  return [{ path: path18.join(c.root, layout.instructionFile), conceptId: posix }];
22334
22267
  }
@@ -22369,7 +22302,7 @@ async function validateToolDir(layout, c, changes, ctx) {
22369
22302
  const raw = change.after ?? await ctx.readFile(change.path);
22370
22303
  if (typeof raw !== "string")
22371
22304
  continue;
22372
- const relPath = toPosix5(change.path);
22305
+ const relPath = toPosix(change.path);
22373
22306
  diagnostics.push(...await skillDirectoryDiagnostics(relPath, seenSkillDirs, ctx, layout.skillDirs));
22374
22307
  const cls = classify(change.path, layout);
22375
22308
  if (cls === null)
@@ -22469,12 +22402,8 @@ var COMPONENT_ID4 = "main";
22469
22402
  var ENV_DIR = "env";
22470
22403
  var SECRETS_DIR = "secrets";
22471
22404
  var SECRET_SKIP_SUFFIXES = [".lock", ".sensitive"];
22472
- var ASSIGN_RE3 = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=/;
22473
- function toPosix6(p) {
22474
- return p.replace(/\\/g, "/");
22475
- }
22476
22405
  function classify2(relPath) {
22477
- const posix = toPosix6(relPath);
22406
+ const posix = toPosix(relPath);
22478
22407
  const segs = posix.split("/").filter((s) => s.length > 0);
22479
22408
  if (segs.length < 2)
22480
22409
  return null;
@@ -22492,23 +22421,8 @@ function hasSensitiveMarker(absPath, type) {
22492
22421
  const marker = type === "env" ? absPath.replace(/\.env$/i, ".sensitive") : `${absPath}.sensitive`;
22493
22422
  return marker !== absPath && fs12.existsSync(marker);
22494
22423
  }
22495
- function scanKeyNames(raw) {
22496
- const keys2 = [];
22497
- const seen = new Set;
22498
- for (const line of raw.split(/\r?\n/)) {
22499
- const m = line.match(ASSIGN_RE3);
22500
- if (!m)
22501
- continue;
22502
- const key = m[1];
22503
- if (seen.has(key))
22504
- continue;
22505
- seen.add(key);
22506
- keys2.push(key);
22507
- }
22508
- return keys2;
22509
- }
22510
22424
  function conceptIdForPath(type, relativePath) {
22511
- const posix = toPosix6(relativePath);
22425
+ const posix = toPosix(relativePath);
22512
22426
  if (type === "secret")
22513
22427
  return posix;
22514
22428
  const stripped = posix.replace(/\.env$/i, "");
@@ -22520,12 +22434,12 @@ function recognize5(c, file) {
22520
22434
  return null;
22521
22435
  if (hasSensitiveMarker(file.absPath, type))
22522
22436
  return null;
22523
- const posix = toPosix6(file.relPath);
22437
+ const posix = toPosix(file.relPath);
22524
22438
  const raw = file.content();
22525
22439
  if (type === "env") {
22526
22440
  const conceptId = conceptIdForPath(type, posix);
22527
22441
  const name2 = (conceptId.split("/").pop() ?? conceptId) || "default";
22528
- const keys2 = scanKeyNames(raw);
22442
+ const keys2 = scanEnvKeyNames(raw);
22529
22443
  const doc = {
22530
22444
  ref: `${c.id}//${conceptId}`,
22531
22445
  bundle: c.id,
@@ -22565,7 +22479,7 @@ async function validate5(_c, changes, ctx) {
22565
22479
  const type = classify2(change.path);
22566
22480
  if (type === null)
22567
22481
  continue;
22568
- diagnostics.push(...dangerousEnvKeyDiagnostics(type, toPosix6(change.path), raw));
22482
+ diagnostics.push(...dangerousEnvKeyDiagnostics(type, toPosix(change.path), raw));
22569
22483
  }
22570
22484
  return diagnostics;
22571
22485
  }
@@ -22576,7 +22490,7 @@ var dotenvAdapter = {
22576
22490
  recognize: recognize5,
22577
22491
  validate: validate5,
22578
22492
  readCandidates(c, conceptId) {
22579
- const posix = toPosix6(conceptId);
22493
+ const posix = toPosix(conceptId);
22580
22494
  const slash = posix.indexOf("/");
22581
22495
  if (slash <= 0)
22582
22496
  return [];
@@ -22590,7 +22504,7 @@ var dotenvAdapter = {
22590
22504
  return expanded.map((candidatePath) => ({ path: candidatePath, conceptId: posix }));
22591
22505
  },
22592
22506
  placeNew(c, conceptId) {
22593
- const posix = toPosix6(conceptId);
22507
+ const posix = toPosix(conceptId);
22594
22508
  const slash = posix.indexOf("/");
22595
22509
  if (slash > 0) {
22596
22510
  const head = posix.slice(0, slash);
@@ -22625,13 +22539,8 @@ var dotenvAdapter = {
22625
22539
  import path21 from "path";
22626
22540
  var COMPONENT_ID5 = "main";
22627
22541
  var DOCUMENT_EXTENSIONS = new Set([".md", ".markdown", ".txt", ".text"]);
22628
- var RESERVED_FILES3 = new Set(["index.md", "log.md"]);
22629
- var MAX_CONTENT_CHARS5 = 1e5;
22630
- function toPosix7(p) {
22631
- return p.replace(/\\/g, "/");
22632
- }
22633
22542
  function isReserved2(base3) {
22634
- return RESERVED_FILES3.has(base3.toLowerCase());
22543
+ return RESERVED_FILES.has(base3.toLowerCase());
22635
22544
  }
22636
22545
  function classify3(ext) {
22637
22546
  if (SCRIPT_EXTENSIONS.has(ext))
@@ -22641,7 +22550,7 @@ function classify3(ext) {
22641
22550
  return "file";
22642
22551
  }
22643
22552
  function recognize6(c, file) {
22644
- const posix = toPosix7(file.relPath);
22553
+ const posix = toPosix(file.relPath);
22645
22554
  const base3 = posix.split("/").pop() ?? posix;
22646
22555
  if (isReserved2(base3))
22647
22556
  return null;
@@ -22661,7 +22570,7 @@ function recognize6(c, file) {
22661
22570
  adapterId: "generic-files",
22662
22571
  type,
22663
22572
  name,
22664
- content: body.length > MAX_CONTENT_CHARS5 ? body.slice(0, MAX_CONTENT_CHARS5) : body
22573
+ content: body
22665
22574
  };
22666
22575
  if (type !== "script")
22667
22576
  doc.ownsPresentation = true;
@@ -22681,7 +22590,7 @@ async function validate6(c, changes, ctx) {
22681
22590
  const raw = change.after ?? await ctx.readFile(change.path);
22682
22591
  if (typeof raw !== "string")
22683
22592
  continue;
22684
- diagnostics.push(...await runBaseValidateChecks(toPosix7(change.path), parseFrontmatter(raw), c.root, ctx));
22593
+ diagnostics.push(...await runBaseValidateChecks(toPosix(change.path), parseFrontmatter(raw), c.root, ctx));
22685
22594
  }
22686
22595
  return diagnostics;
22687
22596
  }
@@ -22692,7 +22601,7 @@ var genericFilesAdapter = {
22692
22601
  recognize: recognize6,
22693
22602
  validate: validate6,
22694
22603
  readCandidates(c, conceptId) {
22695
- const posix = toPosix7(conceptId);
22604
+ const posix = toPosix(conceptId);
22696
22605
  const extension = path21.extname(posix).toLowerCase();
22697
22606
  const documentCandidates = [...DOCUMENT_EXTENSIONS].map((candidateExtension) => ({
22698
22607
  path: path21.join(c.root, `${posix}${candidateExtension}`),
@@ -22701,7 +22610,7 @@ var genericFilesAdapter = {
22701
22610
  return DOCUMENT_EXTENSIONS.has(extension) ? documentCandidates : [{ path: path21.join(c.root, posix), conceptId: posix }, ...documentCandidates];
22702
22611
  },
22703
22612
  placeNew(c, conceptId) {
22704
- const posix = toPosix7(conceptId);
22613
+ const posix = toPosix(conceptId);
22705
22614
  const hasExt = path21.extname(posix) !== "";
22706
22615
  return path21.join(c.root, hasExt ? posix : `${posix}.md`);
22707
22616
  },
@@ -22719,12 +22628,8 @@ var DEFAULT_PAGE_KIND = "note";
22719
22628
  var RESERVED_ROOT_FILES = new Set(["schema.md", "index.md", "log.md"]);
22720
22629
  var RAW_SUBDIR = "raw";
22721
22630
  var PAGES_SUBDIR = "pages";
22722
- var MAX_CONTENT_CHARS6 = 1e5;
22723
- function toPosix8(p) {
22724
- return p.replace(/\\/g, "/");
22725
- }
22726
22631
  function conceptIdOf2(relPath) {
22727
- return toPosix8(relPath).replace(/\.md$/i, "");
22632
+ return toPosix(relPath).replace(/\.md$/i, "");
22728
22633
  }
22729
22634
  function parseWikiFrontmatter(raw) {
22730
22635
  const out = { xrefs: [], sources: [] };
@@ -22756,13 +22661,13 @@ function parseWikiFrontmatter(raw) {
22756
22661
  return out;
22757
22662
  }
22758
22663
  function isReservedRootFile(relPath) {
22759
- const posix = toPosix8(relPath);
22664
+ const posix = toPosix(relPath);
22760
22665
  if (posix.includes("/"))
22761
22666
  return false;
22762
22667
  return RESERVED_ROOT_FILES.has(posix.toLowerCase());
22763
22668
  }
22764
22669
  function firstSegment(relPath) {
22765
- const posix = toPosix8(relPath);
22670
+ const posix = toPosix(relPath);
22766
22671
  const slash = posix.indexOf("/");
22767
22672
  return slash < 0 ? posix : posix.slice(0, slash);
22768
22673
  }
@@ -22774,7 +22679,7 @@ function resolveXref(xref, bundleId) {
22774
22679
  return target.length > 0 ? target : null;
22775
22680
  }
22776
22681
  function resolveBodyLinks(body, fileRelPath) {
22777
- const dir = path22.posix.dirname(toPosix8(fileRelPath));
22682
+ const dir = path22.posix.dirname(toPosix(fileRelPath));
22778
22683
  const linkRe = /\[[^\]]*\]\(([^)]+)\)/g;
22779
22684
  const out = [];
22780
22685
  const seen = new Set;
@@ -22851,7 +22756,7 @@ function resolveSources(fm) {
22851
22756
  function recognize7(c, file) {
22852
22757
  if (file.ext !== ".md")
22853
22758
  return null;
22854
- const relPath = toPosix8(file.relPath);
22759
+ const relPath = toPosix(file.relPath);
22855
22760
  if (isReservedRootFile(relPath))
22856
22761
  return null;
22857
22762
  const head = firstSegment(relPath);
@@ -22875,7 +22780,7 @@ function recognize7(c, file) {
22875
22780
  ownsPresentation: true,
22876
22781
  type: isRaw ? WIKI_SOURCE_TYPE : fm.pageKind ?? DEFAULT_PAGE_KIND,
22877
22782
  name: lastSegment,
22878
- content: body.length > MAX_CONTENT_CHARS6 ? body.slice(0, MAX_CONTENT_CHARS6) : body
22783
+ content: body
22879
22784
  };
22880
22785
  if (fm.description !== undefined)
22881
22786
  doc.description = fm.description;
@@ -22901,7 +22806,7 @@ async function validate7(c, changes, ctx) {
22901
22806
  const raw = change.after ?? await ctx.readFile(change.path);
22902
22807
  if (typeof raw !== "string")
22903
22808
  continue;
22904
- const relPath = toPosix8(change.path);
22809
+ const relPath = toPosix(change.path);
22905
22810
  if (isReservedRootFile(relPath))
22906
22811
  continue;
22907
22812
  const head = firstSegment(relPath);
@@ -22984,7 +22889,7 @@ var llmWikiAdapter = {
22984
22889
  recognize: recognize7,
22985
22890
  validate: validate7,
22986
22891
  readCandidates(c, conceptId) {
22987
- const canonical = toPosix8(conceptId).replace(/\.md$/i, "");
22892
+ const canonical = toPosix(conceptId).replace(/\.md$/i, "");
22988
22893
  return [{ path: path22.join(c.root, `${canonical}.md`), conceptId: canonical }];
22989
22894
  },
22990
22895
  placeNew(c, conceptId) {
@@ -23020,11 +22925,8 @@ var CONSUMED_FRONTMATTER_KEYS = [
23020
22925
  "stale_after",
23021
22926
  "okf_version"
23022
22927
  ];
23023
- function isPlainObject3(value) {
23024
- return value !== null && typeof value === "object" && !Array.isArray(value);
23025
- }
23026
22928
  function parseActorMapping(value) {
23027
- if (!isPlainObject3(value))
22929
+ if (!isRecord(value))
23028
22930
  return;
23029
22931
  const by = nonEmptyString(value.by);
23030
22932
  if (by === undefined)
@@ -23049,7 +22951,7 @@ function parseOkfSources(value) {
23049
22951
  return;
23050
22952
  const out = [];
23051
22953
  for (const item of value) {
23052
- if (!isPlainObject3(item))
22954
+ if (!isRecord(item))
23053
22955
  continue;
23054
22956
  const resource = nonEmptyString(item.resource);
23055
22957
  if (resource === undefined)
@@ -23077,16 +22979,11 @@ function parseOkfSources(value) {
23077
22979
  function parseLifecycleStatus(value) {
23078
22980
  return value === "draft" || value === "stable" || value === "deprecated" ? value : undefined;
23079
22981
  }
23080
- var RESERVED_FILES4 = new Set(["index.md", "log.md"]);
23081
- var MAX_CONTENT_CHARS7 = 1e5;
23082
- function toPosix9(p) {
23083
- return p.replace(/\\/g, "/");
23084
- }
23085
22982
  function isReservedFileName2(name) {
23086
- return RESERVED_FILES4.has(name.toLowerCase());
22983
+ return RESERVED_FILES.has(name.toLowerCase());
23087
22984
  }
23088
22985
  function resolveOkfLinks(body, fileRelPath) {
23089
- const dir = path23.posix.dirname(toPosix9(fileRelPath));
22986
+ const dir = path23.posix.dirname(toPosix(fileRelPath));
23090
22987
  const definitions = new Map;
23091
22988
  for (const match of body.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm)) {
23092
22989
  definitions.set(match[1].trim().toLowerCase(), match[2]);
@@ -23144,7 +23041,7 @@ function recognize8(c, file) {
23144
23041
  return null;
23145
23042
  if (isReservedFileName2(file.fileName))
23146
23043
  return null;
23147
- const conceptId = toPosix9(file.relPath).replace(/\.md$/i, "");
23044
+ const conceptId = toPosix(file.relPath).replace(/\.md$/i, "");
23148
23045
  const raw = file.content();
23149
23046
  const parsed = parseFrontmatter(raw);
23150
23047
  const data = parsed.data;
@@ -23155,7 +23052,7 @@ function recognize8(c, file) {
23155
23052
  const description = nonEmptyString(data.description);
23156
23053
  const tags = readTags(data.tags);
23157
23054
  const links = resolveOkfLinks(body, file.relPath);
23158
- const generatedMapping = isPlainObject3(data.generated) ? data.generated : undefined;
23055
+ const generatedMapping = isRecord(data.generated) ? data.generated : undefined;
23159
23056
  const generatedAt = generatedMapping ? nonEmptyString(generatedMapping.at) : undefined;
23160
23057
  const generatedBy = generatedMapping ? nonEmptyString(generatedMapping.by) : undefined;
23161
23058
  const legacyTimestamp = nonEmptyString(data.timestamp);
@@ -23182,7 +23079,7 @@ function recognize8(c, file) {
23182
23079
  ownsPresentation: true,
23183
23080
  type,
23184
23081
  name,
23185
- content: body.length > MAX_CONTENT_CHARS7 ? body.slice(0, MAX_CONTENT_CHARS7) : body
23082
+ content: body
23186
23083
  };
23187
23084
  if (description !== undefined)
23188
23085
  doc.description = description;
@@ -23213,7 +23110,7 @@ async function validate8(c, changes, ctx) {
23213
23110
  const raw = change.after ?? await ctx.readFile(change.path);
23214
23111
  if (typeof raw !== "string")
23215
23112
  continue;
23216
- const relPath = toPosix9(change.path);
23113
+ const relPath = toPosix(change.path);
23217
23114
  const fileName = relPath.split("/").pop() ?? relPath;
23218
23115
  const reserved = isReservedFileName2(fileName);
23219
23116
  const parsed = parseFrontmatter(raw);
@@ -23337,10 +23234,6 @@ var COMPONENT_ID6 = "main";
23337
23234
  var PAGES_PREFIX = "stash/knowledge/";
23338
23235
  var MANIFEST_FILE = "manifest.json";
23339
23236
  var WEBSITE_TAG = "website";
23340
- var MAX_CONTENT_CHARS8 = 1e5;
23341
- function toPosix10(p) {
23342
- return p.replace(/\\/g, "/");
23343
- }
23344
23237
  function parseSnapshotFrontmatter(raw) {
23345
23238
  const out = { tags: [] };
23346
23239
  const block = parseFrontmatterBlock(raw);
@@ -23363,14 +23256,14 @@ function parseSnapshotFrontmatter(raw) {
23363
23256
  return out;
23364
23257
  }
23365
23258
  function isSnapshotPage(relPath) {
23366
- const posix = toPosix10(relPath);
23259
+ const posix = toPosix(relPath);
23367
23260
  return posix.startsWith(PAGES_PREFIX) && posix.toLowerCase().endsWith(".md");
23368
23261
  }
23369
23262
  function isReTypeGated(fm) {
23370
23263
  return fm.sourceUrl !== undefined || fm.tags.includes(WEBSITE_TAG);
23371
23264
  }
23372
23265
  function conceptIdOf3(relPath) {
23373
- return toPosix10(relPath).slice(PAGES_PREFIX.length).replace(/\.md$/i, "");
23266
+ return toPosix(relPath).slice(PAGES_PREFIX.length).replace(/\.md$/i, "");
23374
23267
  }
23375
23268
  function recognize9(c, file) {
23376
23269
  if (file.ext !== ".md" || !isSnapshotPage(file.relPath))
@@ -23393,7 +23286,7 @@ function recognize9(c, file) {
23393
23286
  ownsPresentation: true,
23394
23287
  type: "website",
23395
23288
  name,
23396
- content: body.length > MAX_CONTENT_CHARS8 ? body.slice(0, MAX_CONTENT_CHARS8) : body
23289
+ content: body
23397
23290
  };
23398
23291
  if (fm.description !== undefined)
23399
23292
  doc.description = fm.description;
@@ -23411,7 +23304,7 @@ async function validate9(c, changes, ctx) {
23411
23304
  continue;
23412
23305
  if (!isSnapshotPage(change.path))
23413
23306
  continue;
23414
- const base3 = await runBaseValidateChecks(toPosix10(change.path), parseFrontmatter(raw), c.root, ctx);
23307
+ const base3 = await runBaseValidateChecks(toPosix(change.path), parseFrontmatter(raw), c.root, ctx);
23415
23308
  diagnostics.push(...base3.filter((d) => d.issue !== "missing-updated"));
23416
23309
  }
23417
23310
  return diagnostics;
@@ -23423,7 +23316,7 @@ var websiteSnapshotAdapter = {
23423
23316
  recognize: recognize9,
23424
23317
  validate: validate9,
23425
23318
  readCandidates(c, conceptId) {
23426
- const canonical = toPosix10(conceptId).replace(/\.md$/i, "");
23319
+ const canonical = toPosix(conceptId).replace(/\.md$/i, "");
23427
23320
  return [{ path: path25.join(c.root, PAGES_PREFIX, `${canonical}.md`), conceptId: canonical }];
23428
23321
  },
23429
23322
  looksLikeRoot(root) {
@@ -28813,7 +28706,7 @@ function upgradeConfigVersion(raw, sourcePath) {
28813
28706
 
28814
28707
  // src/core/config/deep-merge.ts
28815
28708
  var UNSAFE_KEYS3 = new Set(["__proto__", "constructor", "prototype"]);
28816
- function isPlainObject4(value) {
28709
+ function isPlainObject(value) {
28817
28710
  if (value === null || typeof value !== "object" || Array.isArray(value))
28818
28711
  return false;
28819
28712
  const prototype = Object.getPrototypeOf(value);
@@ -28822,7 +28715,7 @@ function isPlainObject4(value) {
28822
28715
  function copyConfigValue(value) {
28823
28716
  if (Array.isArray(value))
28824
28717
  return value.map(copyConfigValue);
28825
- if (!isPlainObject4(value))
28718
+ if (!isPlainObject(value))
28826
28719
  return value;
28827
28720
  const copy = {};
28828
28721
  for (const key of Object.keys(value)) {
@@ -28841,7 +28734,7 @@ function deepMergeConfig(base3, override) {
28841
28734
  if (next === undefined)
28842
28735
  continue;
28843
28736
  const current = result[key];
28844
- result[key] = isPlainObject4(current) && isPlainObject4(next) ? deepMergeConfig(current, next) : copyConfigValue(next);
28737
+ result[key] = isPlainObject(current) && isPlainObject(next) ? deepMergeConfig(current, next) : copyConfigValue(next);
28845
28738
  }
28846
28739
  return result;
28847
28740
  }
@@ -28902,8 +28795,8 @@ function loadUserConfig() {
28902
28795
  }
28903
28796
  function parseAndValidateConfigText(text, sourcePath) {
28904
28797
  const parsedRaw = upgradeConfigVersion(parseConfigText(text, sourcePath), sourcePath);
28905
- const { config: raw, lifted, conflicts } = liftLegacyEngineExtraParams(parsedRaw);
28906
28798
  const where = sourcePath ? ` at ${sourcePath}` : "";
28799
+ const { lifted, conflicts } = liftLegacyEngineExtraParams(parsedRaw);
28907
28800
  if (conflicts.length > 0) {
28908
28801
  const lines = conflicts.map((c) => ` - engines.${c.engine}.extraParams.${c.key} (${JSON.stringify(c.extraParamsValue)}) conflicts with engines.${c.engine}.${c.field} (${JSON.stringify(c.fieldValue)})`).join(`
28909
28802
  `);
@@ -28913,11 +28806,13 @@ ${lines}
28913
28806
  Each extraParams key above has a first-class equivalent and akm will not guess which value you meant \u2014 remove the extraParams entry once the field carries the value you want.`, "INVALID_CONFIG_FILE");
28914
28807
  }
28915
28808
  if (lifted.length > 0) {
28916
- warn(`Config${where} uses deprecated extraParams keys with first-class equivalents; treating them as the first-class fields for this run (not written back to the file):
28809
+ throw new ConfigError(`Config${where} uses deprecated extraParams keys with first-class equivalents:
28917
28810
  - ${lifted.join(`
28918
- - `)}`);
28811
+ - `)}
28812
+
28813
+ Run \`akm migrate apply\` to rewrite the config file, or move the values onto the first-class fields yourself.`, "INVALID_CONFIG_FILE");
28919
28814
  }
28920
- const parsed = AkmConfigSchema.safeParse(raw);
28815
+ const parsed = AkmConfigSchema.safeParse(parsedRaw);
28921
28816
  if (!parsed.success) {
28922
28817
  const lines = parsed.error.issues.map((i) => ` - ${i.path.join(".") || "(root)"}: ${i.message}`).join(`
28923
28818
  `);
@@ -29212,6 +29107,9 @@ function createProviderRegistry() {
29212
29107
  resolve(type) {
29213
29108
  return map.get(type) ?? null;
29214
29109
  },
29110
+ unregister(type) {
29111
+ map.delete(type);
29112
+ },
29215
29113
  list() {
29216
29114
  return [...map.keys()];
29217
29115
  }