@pleri/olam-cli 0.1.145 → 0.1.147

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 (90) hide show
  1. package/dist/commands/skills-doctor.d.ts +14 -0
  2. package/dist/commands/skills-doctor.d.ts.map +1 -0
  3. package/dist/commands/skills-doctor.js +126 -0
  4. package/dist/commands/skills-doctor.js.map +1 -0
  5. package/dist/commands/skills-hook.d.ts +19 -0
  6. package/dist/commands/skills-hook.d.ts.map +1 -0
  7. package/dist/commands/skills-hook.js +99 -0
  8. package/dist/commands/skills-hook.js.map +1 -0
  9. package/dist/commands/skills-migrate-back.d.ts +21 -0
  10. package/dist/commands/skills-migrate-back.d.ts.map +1 -0
  11. package/dist/commands/skills-migrate-back.js +222 -0
  12. package/dist/commands/skills-migrate-back.js.map +1 -0
  13. package/dist/commands/skills-migrate-hooks-back.d.ts +19 -0
  14. package/dist/commands/skills-migrate-hooks-back.d.ts.map +1 -0
  15. package/dist/commands/skills-migrate-hooks-back.js +83 -0
  16. package/dist/commands/skills-migrate-hooks-back.js.map +1 -0
  17. package/dist/commands/skills-migrate-hooks.d.ts +40 -0
  18. package/dist/commands/skills-migrate-hooks.d.ts.map +1 -0
  19. package/dist/commands/skills-migrate-hooks.js +178 -0
  20. package/dist/commands/skills-migrate-hooks.js.map +1 -0
  21. package/dist/commands/skills-migrate.d.ts +33 -0
  22. package/dist/commands/skills-migrate.d.ts.map +1 -0
  23. package/dist/commands/skills-migrate.js +216 -0
  24. package/dist/commands/skills-migrate.js.map +1 -0
  25. package/dist/commands/skills-onboard.d.ts +26 -0
  26. package/dist/commands/skills-onboard.d.ts.map +1 -0
  27. package/dist/commands/skills-onboard.js +227 -0
  28. package/dist/commands/skills-onboard.js.map +1 -0
  29. package/dist/commands/skills-shadow-backups.d.ts +15 -0
  30. package/dist/commands/skills-shadow-backups.d.ts.map +1 -0
  31. package/dist/commands/skills-shadow-backups.js +132 -0
  32. package/dist/commands/skills-shadow-backups.js.map +1 -0
  33. package/dist/commands/skills-source.d.ts +25 -0
  34. package/dist/commands/skills-source.d.ts.map +1 -1
  35. package/dist/commands/skills-source.js +305 -7
  36. package/dist/commands/skills-source.js.map +1 -1
  37. package/dist/commands/skills.d.ts.map +1 -1
  38. package/dist/commands/skills.js +62 -7
  39. package/dist/commands/skills.js.map +1 -1
  40. package/dist/commands/substrate-audit-log.d.ts +49 -0
  41. package/dist/commands/substrate-audit-log.d.ts.map +1 -0
  42. package/dist/commands/substrate-audit-log.js +148 -0
  43. package/dist/commands/substrate-audit-log.js.map +1 -0
  44. package/dist/commands/substrate.d.ts +60 -0
  45. package/dist/commands/substrate.d.ts.map +1 -0
  46. package/dist/commands/substrate.js +175 -0
  47. package/dist/commands/substrate.js.map +1 -0
  48. package/dist/commands/upgrade.d.ts +10 -0
  49. package/dist/commands/upgrade.d.ts.map +1 -1
  50. package/dist/commands/upgrade.js +30 -0
  51. package/dist/commands/upgrade.js.map +1 -1
  52. package/dist/image-digests.json +7 -7
  53. package/dist/index.js +8687 -4713
  54. package/dist/index.js.map +1 -1
  55. package/dist/lib/config.d.ts +69 -0
  56. package/dist/lib/config.d.ts.map +1 -0
  57. package/dist/lib/config.js +146 -0
  58. package/dist/lib/config.js.map +1 -0
  59. package/dist/lib/instrumentation.d.ts +85 -0
  60. package/dist/lib/instrumentation.d.ts.map +1 -0
  61. package/dist/lib/instrumentation.js +104 -0
  62. package/dist/lib/instrumentation.js.map +1 -0
  63. package/dist/lib/kubectl-wrap.d.ts +59 -0
  64. package/dist/lib/kubectl-wrap.d.ts.map +1 -0
  65. package/dist/lib/kubectl-wrap.js +130 -0
  66. package/dist/lib/kubectl-wrap.js.map +1 -0
  67. package/dist/lib/manifest-refresh.d.ts +95 -0
  68. package/dist/lib/manifest-refresh.d.ts.map +1 -0
  69. package/dist/lib/manifest-refresh.js +222 -0
  70. package/dist/lib/manifest-refresh.js.map +1 -0
  71. package/dist/lib/port-forward.d.ts +101 -0
  72. package/dist/lib/port-forward.d.ts.map +1 -0
  73. package/dist/lib/port-forward.js +240 -0
  74. package/dist/lib/port-forward.js.map +1 -0
  75. package/dist/lib/upgrade-kubernetes.d.ts +77 -0
  76. package/dist/lib/upgrade-kubernetes.d.ts.map +1 -0
  77. package/dist/lib/upgrade-kubernetes.js +277 -0
  78. package/dist/lib/upgrade-kubernetes.js.map +1 -0
  79. package/dist/mcp-server.js +20262 -18211
  80. package/host-cp/k8s/manifests/00-namespace.yaml +7 -0
  81. package/host-cp/k8s/manifests/10-serviceaccount.yaml +8 -0
  82. package/host-cp/k8s/manifests/20-rbac.yaml +34 -0
  83. package/host-cp/k8s/manifests/30-configmap.yaml +30 -0
  84. package/host-cp/k8s/manifests/45-pvc.yaml +27 -0
  85. package/host-cp/k8s/manifests/50-deployment.yaml +148 -0
  86. package/host-cp/k8s/manifests/60-service.yaml +22 -0
  87. package/host-cp/k8s/templates/40-secret-template.yaml +32 -0
  88. package/host-cp/src/plan-chat-service.mjs +31 -7
  89. package/host-cp/src/server.mjs +32 -7
  90. package/package.json +3 -2
@@ -0,0 +1,83 @@
1
+ /**
2
+ * `olam skills migrate-hooks-back` — reverse Phase B B1 meta-hook
3
+ * injection by restoring `~/.claude/settings.json` from a snapshot
4
+ * written by `writeMetaHooksSnapshot` (engine writes one before every
5
+ * injection that has a non-empty delta).
6
+ *
7
+ * olam skills migrate-hooks-back [--snapshot <path>]
8
+ *
9
+ * Without `--snapshot`: consumes the most-recent
10
+ * `meta-hooks-*.json` in `~/.olam/state/migration-snapshots/`.
11
+ * With `--snapshot`: uses the named file explicitly.
12
+ *
13
+ * Output: prints settings.json path + snapshot path + summary
14
+ * (restored / file-removed when snapshot represents pre-existence
15
+ * absence) + exits 0 on success.
16
+ */
17
+ import * as path from 'node:path';
18
+ import { findLatestMetaHooksSnapshot, readMetaHooksSnapshot, restoreSettingsFromSnapshot, migrationSnapshotsDir, META_HOOKS_SNAPSHOT_PREFIX, } from '@olam/core/src/skill-sources/meta-hooks-migration-snapshot.js';
19
+ import { claudeSettingsPath } from '@olam/core/src/skill-sources/index.js';
20
+ import { printError, printInfo, printSuccess } from '../output.js';
21
+ function asMessage(err) {
22
+ return err instanceof Error ? err.message : String(err);
23
+ }
24
+ export function registerSkillsMigrateHooksBack(program) {
25
+ const skills = program.commands.find((c) => c.name() === 'skills') ??
26
+ program.command('skills').description('Manage skill sources and synchronization');
27
+ skills
28
+ .command('migrate-hooks-back')
29
+ .description('Reverse olam-meta hook injection by restoring ~/.claude/settings.json from a B5 snapshot')
30
+ .option('--snapshot <path>', 'Use a specific snapshot file (default: most recent meta-hooks-*.json)')
31
+ .action((opts) => {
32
+ try {
33
+ const snapshotPath = opts.snapshot ?? findLatestMetaHooksSnapshot();
34
+ if (!snapshotPath) {
35
+ printError('No meta-hooks-* snapshot found in ~/.olam/state/migration-snapshots/. ' +
36
+ 'Engine writes one before every injection that mutates settings.json; ' +
37
+ 'if none exist, no reversible injection has happened yet.');
38
+ process.exitCode = 1;
39
+ return;
40
+ }
41
+ // CP3 HIGH-2 fix: when --snapshot is operator-supplied, the path
42
+ // must (a) resolve inside ~/.olam/state/migration-snapshots/ and
43
+ // (b) have the canonical `meta-hooks-` prefix. Without this
44
+ // guard, an attacker (or accidental --snapshot /tmp/foo.json)
45
+ // could supply an arbitrary JSON file → restoreSettingsFromSnapshot
46
+ // would blindly write that JSON to ~/.claude/settings.json,
47
+ // installing operator-attacker-chosen hook blocks.
48
+ if (opts.snapshot) {
49
+ const resolved = path.resolve(opts.snapshot);
50
+ const allowedDir = path.resolve(migrationSnapshotsDir());
51
+ if (!resolved.startsWith(allowedDir + path.sep)) {
52
+ printError(`--snapshot path must be inside ${allowedDir} (got "${resolved}"). ` +
53
+ `Refusing to restore from an arbitrary path — settings.json would land operator-chosen content.`);
54
+ process.exitCode = 1;
55
+ return;
56
+ }
57
+ const basename = path.basename(resolved);
58
+ if (!basename.startsWith(META_HOOKS_SNAPSHOT_PREFIX)) {
59
+ printError(`--snapshot filename must start with "${META_HOOKS_SNAPSHOT_PREFIX}" (got "${basename}"). ` +
60
+ `Cross-namespace snapshots (atlas-toolbox-*) are not valid restore targets for olam-meta hooks.`);
61
+ process.exitCode = 1;
62
+ return;
63
+ }
64
+ }
65
+ printInfo('snapshot', snapshotPath);
66
+ const snapshot = readMetaHooksSnapshot(snapshotPath);
67
+ printInfo('takenAt', snapshot.takenAt);
68
+ const settingsFile = claudeSettingsPath();
69
+ restoreSettingsFromSnapshot(snapshot, settingsFile);
70
+ if (snapshot.originalSettings === null) {
71
+ printSuccess(`removed ${settingsFile} (no settings.json existed pre-injection)`);
72
+ }
73
+ else {
74
+ printSuccess(`restored ${settingsFile} to pre-injection state`);
75
+ }
76
+ }
77
+ catch (err) {
78
+ printError(asMessage(err));
79
+ process.exitCode = 1;
80
+ }
81
+ });
82
+ }
83
+ //# sourceMappingURL=skills-migrate-hooks-back.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills-migrate-hooks-back.js","sourceRoot":"","sources":["../../src/commands/skills-migrate-hooks-back.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,+DAA+D,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnE,SAAS,SAAS,CAAC,GAAY;IAC7B,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,OAAgB;IAC7D,MAAM,MAAM,GACV,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,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,UAAU,CAAC,0BAA0B,CAAC,EAAE,CAAC;oBACrD,UAAU,CACR,wCAAwC,0BAA0B,WAAW,QAAQ,MAAM;wBACzF,gGAAgG,CACnG,CAAC;oBACF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;oBACrB,OAAO;gBACT,CAAC;YACH,CAAC;YAED,SAAS,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;YACpC,MAAM,QAAQ,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAC;YACrD,SAAS,CAAC,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;YAEvC,MAAM,YAAY,GAAG,kBAAkB,EAAE,CAAC;YAC1C,2BAA2B,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YAEpD,IAAI,QAAQ,CAAC,gBAAgB,KAAK,IAAI,EAAE,CAAC;gBACvC,YAAY,CAAC,WAAW,YAAY,2CAA2C,CAAC,CAAC;YACnF,CAAC;iBAAM,CAAC;gBACN,YAAY,CAAC,YAAY,YAAY,yBAAyB,CAAC,CAAC;YAClE,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YAC3B,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * `olam skills migrate-hooks` — forward strip of atlas-toolbox-shipped
3
+ * olam-meta hook entries (Phase C C2).
4
+ *
5
+ * olam skills migrate-hooks [--dry-run]
6
+ *
7
+ * Detects PreToolUse/PostToolUse matcher entries in ~/.claude/settings.json
8
+ * whose `command` strings reference one of the agentmemory-classifier
9
+ * scripts AND do NOT carry an olam-meta sentinel — i.e. atlas-toolbox-
10
+ * shipped entries from the pre-Phase-B world. Strips them; writes a
11
+ * pre-strip snapshot via the B5 primitive so the operator can undo via
12
+ * `olam skills migrate-hooks-back`.
13
+ *
14
+ * Order of operations (snapshot first, mutation after, audit-log last):
15
+ * 1. acquire settings-json lock (A4 — serializes against concurrent sync)
16
+ * 2. read settings.json (return early if absent — nothing to strip)
17
+ * 3. findStripCandidates(settings)
18
+ * - empty list → no-op + summary + exit 0
19
+ * 4. --dry-run → print summary + exit 0 (no snapshot, no mutation)
20
+ * 5. writeMetaHooksSnapshot(settings) — same prefix as B5, so
21
+ * `migrate-hooks-back` consumes it identically
22
+ * 6. applyStrip(settings, candidates) → next settings.json
23
+ * 7. atomic write via temp+rename
24
+ * 8. appendTrustAudit({action: 'meta-hook-stripped', count, ...})
25
+ * — operator-visible append-only audit trail
26
+ * 9. print summary
27
+ *
28
+ * Idempotent: re-running on already-stripped settings.json is a no-op
29
+ * (findStripCandidates returns []).
30
+ *
31
+ * Reversibility: forward-fix-only. Audit-log entry is append-only by
32
+ * contract; settings.json mutation is reversible via B5 snapshot.
33
+ */
34
+ import type { Command } from 'commander';
35
+ import { AGENTMEMORY_SCRIPT_PATTERNS, OLAM_META_SENTINELS_GUARDED, findStripCandidates, applyStrip, type StripCandidate } from '@olam/core/src/skill-sync/atlas-hook-strip.js';
36
+ /** Stable command name — referenced by tests. */
37
+ export declare const MIGRATE_HOOKS_COMMAND = "migrate-hooks";
38
+ export { AGENTMEMORY_SCRIPT_PATTERNS, OLAM_META_SENTINELS_GUARDED, findStripCandidates, applyStrip, type StripCandidate, };
39
+ export declare function registerSkillsMigrateHooks(program: Command): void;
40
+ //# sourceMappingURL=skills-migrate-hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills-migrate-hooks.d.ts","sourceRoot":"","sources":["../../src/commands/skills-migrate-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,mBAAmB,EACnB,UAAU,EAEV,KAAK,cAAc,EACpB,MAAM,+CAA+C,CAAC;AAGvD,iDAAiD;AACjD,eAAO,MAAM,qBAAqB,kBAAkB,CAAC;AAMrD,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,mBAAmB,EACnB,UAAU,EACV,KAAK,cAAc,GACpB,CAAC;AAmEF,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+EjE"}
@@ -0,0 +1,178 @@
1
+ /**
2
+ * `olam skills migrate-hooks` — forward strip of atlas-toolbox-shipped
3
+ * olam-meta hook entries (Phase C C2).
4
+ *
5
+ * olam skills migrate-hooks [--dry-run]
6
+ *
7
+ * Detects PreToolUse/PostToolUse matcher entries in ~/.claude/settings.json
8
+ * whose `command` strings reference one of the agentmemory-classifier
9
+ * scripts AND do NOT carry an olam-meta sentinel — i.e. atlas-toolbox-
10
+ * shipped entries from the pre-Phase-B world. Strips them; writes a
11
+ * pre-strip snapshot via the B5 primitive so the operator can undo via
12
+ * `olam skills migrate-hooks-back`.
13
+ *
14
+ * Order of operations (snapshot first, mutation after, audit-log last):
15
+ * 1. acquire settings-json lock (A4 — serializes against concurrent sync)
16
+ * 2. read settings.json (return early if absent — nothing to strip)
17
+ * 3. findStripCandidates(settings)
18
+ * - empty list → no-op + summary + exit 0
19
+ * 4. --dry-run → print summary + exit 0 (no snapshot, no mutation)
20
+ * 5. writeMetaHooksSnapshot(settings) — same prefix as B5, so
21
+ * `migrate-hooks-back` consumes it identically
22
+ * 6. applyStrip(settings, candidates) → next settings.json
23
+ * 7. atomic write via temp+rename
24
+ * 8. appendTrustAudit({action: 'meta-hook-stripped', count, ...})
25
+ * — operator-visible append-only audit trail
26
+ * 9. print summary
27
+ *
28
+ * Idempotent: re-running on already-stripped settings.json is a no-op
29
+ * (findStripCandidates returns []).
30
+ *
31
+ * Reversibility: forward-fix-only. Audit-log entry is append-only by
32
+ * contract; settings.json mutation is reversible via B5 snapshot.
33
+ */
34
+ import * as fs from 'node:fs';
35
+ import * as path from 'node:path';
36
+ import pc from 'picocolors';
37
+ import { claudeSettingsPath } from '@olam/core/src/skill-sources/index.js';
38
+ import { withSettingsJsonLock } from '@olam/core/src/skill-sync/settings-json-lock.js';
39
+ import { writeMetaHooksSnapshot } from '@olam/core/src/skill-sources/meta-hooks-migration-snapshot.js';
40
+ import { appendTrustAudit } from '@olam/core/src/skill-sources/trust-audit-log.js';
41
+ import { AGENTMEMORY_SCRIPT_PATTERNS, OLAM_META_SENTINELS_GUARDED, findStripCandidates, applyStrip, } from '@olam/core/src/skill-sync/atlas-hook-strip.js';
42
+ import { printError, printInfo, printSuccess, printWarning } from '../output.js';
43
+ /** Stable command name — referenced by tests. */
44
+ export const MIGRATE_HOOKS_COMMAND = 'migrate-hooks';
45
+ // Re-export the pure strip helpers so the C2 test imports stay anchored
46
+ // on the CLI module surface (paths used by operators); the C3 engine
47
+ // imports the same names directly from `@olam/core/src/skill-sync/
48
+ // atlas-hook-strip.js` to avoid a CLI → core back-edge.
49
+ export { AGENTMEMORY_SCRIPT_PATTERNS, OLAM_META_SENTINELS_GUARDED, findStripCandidates, applyStrip, };
50
+ /**
51
+ * True iff any hook command in settings.json contains an olam-meta
52
+ * sentinel. Used by the migrate-hooks command to warn when stripping
53
+ * atlas-shipped entries would leave NO olam-managed agentmemory hooks
54
+ * behind (per Phase C CP3 follow-up MEDIUM #3).
55
+ */
56
+ function settingsHasOlamMetaSentinel(settings) {
57
+ for (const stage of ['PreToolUse', 'PostToolUse']) {
58
+ const matchers = settings.hooks?.[stage];
59
+ if (!Array.isArray(matchers))
60
+ continue;
61
+ for (const matcher of matchers) {
62
+ const inner = Array.isArray(matcher.hooks) ? matcher.hooks : [];
63
+ for (const h of inner) {
64
+ const cmd = h?.command;
65
+ if (typeof cmd !== 'string')
66
+ continue;
67
+ for (const sentinel of OLAM_META_SENTINELS_GUARDED) {
68
+ if (cmd.includes(sentinel))
69
+ return true;
70
+ }
71
+ }
72
+ }
73
+ }
74
+ return false;
75
+ }
76
+ function readSettings(filePath) {
77
+ if (!fs.existsSync(filePath))
78
+ return null;
79
+ const raw = fs.readFileSync(filePath, 'utf-8');
80
+ if (raw.trim().length === 0)
81
+ return {};
82
+ return JSON.parse(raw);
83
+ }
84
+ function writeSettings(filePath, settings) {
85
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
86
+ const tmp = `${filePath}.tmp-migrate-hooks-${process.pid}-${Date.now()}`;
87
+ fs.writeFileSync(tmp, JSON.stringify(settings, null, 2) + '\n');
88
+ fs.renameSync(tmp, filePath);
89
+ }
90
+ function printSummary(candidates, opts) {
91
+ if (candidates.length === 0) {
92
+ printInfo(MIGRATE_HOOKS_COMMAND, 'no atlas-toolbox-shipped agentmemory hooks found in settings.json — nothing to migrate');
93
+ return;
94
+ }
95
+ const verb = opts.dryRun ? 'would strip' : 'stripped';
96
+ console.log(pc.bold(`${verb} ${candidates.length} atlas-toolbox-shipped agentmemory hook entry(ies):`));
97
+ for (const c of candidates) {
98
+ const matcher = c.matcher ?? '*';
99
+ const cmdPreview = c.command.length > 120 ? `${c.command.slice(0, 117)}...` : c.command;
100
+ console.log(` ${pc.dim(`[${c.stage}]`)} matcher=${pc.cyan(matcher)} pattern=${pc.yellow(c.matchedPattern)}`);
101
+ console.log(` ${pc.dim(cmdPreview)}`);
102
+ }
103
+ if (opts.snapshotPath) {
104
+ console.log();
105
+ printInfo('snapshot', opts.snapshotPath);
106
+ printInfo('reverse', `run \`olam skills migrate-hooks-back\` (or \`migrate-hooks-back --snapshot <path>\`) to restore the pre-strip settings.json`);
107
+ }
108
+ }
109
+ function asMessage(err) {
110
+ return err instanceof Error ? err.message : String(err);
111
+ }
112
+ export function registerSkillsMigrateHooks(program) {
113
+ const skills = program.commands.find((c) => c.name() === 'skills') ??
114
+ program.command('skills').description('Manage skill sources and synchronization');
115
+ skills
116
+ .command(MIGRATE_HOOKS_COMMAND)
117
+ .description('Strip atlas-toolbox-shipped agentmemory hook entries from ~/.claude/settings.json (forward migration; reverse via migrate-hooks-back)')
118
+ .option('--dry-run', 'Show what would be stripped without mutating settings.json or writing a snapshot')
119
+ .action(async (opts) => {
120
+ try {
121
+ await withSettingsJsonLock(async () => {
122
+ const settingsFile = claudeSettingsPath();
123
+ const settings = readSettings(settingsFile);
124
+ if (settings === null) {
125
+ printInfo(MIGRATE_HOOKS_COMMAND, `${settingsFile} does not exist — nothing to migrate`);
126
+ return;
127
+ }
128
+ const candidates = findStripCandidates(settings);
129
+ if (opts.dryRun) {
130
+ printSummary(candidates, { dryRun: true });
131
+ return;
132
+ }
133
+ if (candidates.length === 0) {
134
+ printSummary(candidates, { dryRun: false });
135
+ return;
136
+ }
137
+ // CP3 follow-up (Phase C adversarial review MEDIUM #3):
138
+ // when stripping would leave NO olam-meta sentinel-bound
139
+ // entries in settings.json, agentmemory recall/classify
140
+ // dies entirely. The likely-but-not-guaranteed cause:
141
+ // operator has been running `olam skills sync
142
+ // --meta-hooks=never` (declined olam ownership) and now
143
+ // ran migrate-hooks not realising it strips
144
+ // unconditionally. Warn loudly — don't gate (the operator
145
+ // who explicitly typed the command unambiguously asked
146
+ // for the strip; --force ceremony would be hostile), but
147
+ // the consequence MUST be visible.
148
+ const hasOlamMetaSentinel = settingsHasOlamMetaSentinel(settings);
149
+ if (!hasOlamMetaSentinel) {
150
+ printWarning(`stripping ${candidates.length} atlas-toolbox-shipped agentmemory entry(ies) WITHOUT any olam-meta sentinel-bound block present in settings.json. ` +
151
+ `After the strip, agentmemory recall/classify will NOT fire from this settings.json. ` +
152
+ `If unintended, reverse with \`olam skills migrate-hooks-back\` and re-sync with \`olam skills sync\` (default mode injects olam-meta blocks when memory-bridge is running).`);
153
+ }
154
+ // Snapshot BEFORE mutation. Reuses B5 prefix so
155
+ // migrate-hooks-back picks it up identically.
156
+ const snapshotPath = writeMetaHooksSnapshot(settings);
157
+ const { nextSettings, removedCount } = applyStrip(settings, candidates);
158
+ writeSettings(settingsFile, nextSettings);
159
+ // Audit-log AFTER the write — entry records what landed,
160
+ // not what was planned. T6 mitigation.
161
+ appendTrustAudit({
162
+ gitUrl: 'internal:olam-meta-hooks',
163
+ action: 'meta-hook-stripped',
164
+ trustMethod: 'none',
165
+ sourceId: 'atlas-toolbox',
166
+ note: `removed ${removedCount} agentmemory hook entry(ies); snapshot at ${snapshotPath}`,
167
+ });
168
+ printSummary(candidates, { dryRun: false, snapshotPath });
169
+ printSuccess(`stripped ${removedCount} atlas-toolbox-shipped agentmemory hook entry(ies) from ${settingsFile}`);
170
+ }, { reason: `cli:${MIGRATE_HOOKS_COMMAND}` });
171
+ }
172
+ catch (err) {
173
+ printError(asMessage(err));
174
+ process.exitCode = 1;
175
+ }
176
+ });
177
+ }
178
+ //# sourceMappingURL=skills-migrate-hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills-migrate-hooks.js","sourceRoot":"","sources":["../../src/commands/skills-migrate-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,+DAA+D,CAAC;AACvG,OAAO,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AACnF,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,mBAAmB,EACnB,UAAU,GAGX,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjF,iDAAiD;AACjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAErD,wEAAwE;AACxE,qEAAqE;AACrE,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,WAAW,EAAE,MAAM;oBACnB,QAAQ,EAAE,eAAe;oBACzB,IAAI,EAAE,WAAW,YAAY,6CAA6C,YAAY,EAAE;iBACzF,CAAC,CAAC;gBAEH,YAAY,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;gBAC1D,YAAY,CAAC,YAAY,YAAY,2DAA2D,YAAY,EAAE,CAAC,CAAC;YAClH,CAAC,EACD,EAAE,MAAM,EAAE,OAAO,qBAAqB,EAAE,EAAE,CAC3C,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YAC3B,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * `olam skills migrate-from-toolbox` — convert an existing toolbox-shaped
3
+ * skill source (e.g. atlas-toolbox, grain/ai-skills) installation to
4
+ * olam-managed skill distribution.
5
+ *
6
+ * Order of operations (atomic in spirit — snapshot first, mutations after):
7
+ * 1. detectToolboxState({ toolboxPath }) → MigrationSnapshot (or no-op when nothing detected)
8
+ * 2. writeMigrationSnapshot() → ~/.olam/state/migration-snapshots/<namespace>-<ISO>.json
9
+ * 3. addSkillSource() + cloneSkillSource() → register the toolbox as an olam source
10
+ * 4. uninstall legacy toolbox SessionStart hook entries (entries whose command
11
+ * references the toolbox repo path OR `./scripts/sync.sh`)
12
+ * 5. install the olam-skills SessionStart hook (via mergeHomeSettingsJson)
13
+ * 6. run `olam skills sync` to deploy artifacts under olam management
14
+ *
15
+ * Idempotent: re-running on an already-migrated host detects the olam
16
+ * hook sentinel and no-ops with an informative message.
17
+ */
18
+ import type { Command } from 'commander';
19
+ /** Stable command identifier — referenced by tests to keep them rename-resilient. */
20
+ export declare const MIGRATE_FROM_TOOLBOX_COMMAND = "migrate-from-toolbox";
21
+ interface ToolboxHookSurgeryResult {
22
+ readonly removed: number;
23
+ }
24
+ /**
25
+ * Surgically remove SessionStart hook entries that reference the toolbox
26
+ * repo path OR call `./scripts/sync.sh` (legacy atlas-toolbox sync entry —
27
+ * harmless no-op against non-atlas toolboxes). Leaves olam-skills entries
28
+ * and unrelated user hooks intact.
29
+ */
30
+ declare function uninstallLegacyToolboxSessionStartHook(filePath: string, toolboxPath: string | undefined): ToolboxHookSurgeryResult;
31
+ export declare function registerSkillsMigrate(program: Command): void;
32
+ export { uninstallLegacyToolboxSessionStartHook };
33
+ //# sourceMappingURL=skills-migrate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills-migrate.d.ts","sourceRoot":"","sources":["../../src/commands/skills-migrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiBzC,qFAAqF;AACrF,eAAO,MAAM,4BAA4B,yBAAyB,CAAC;AAgBnE,UAAU,wBAAwB;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,iBAAS,sCAAsC,CAC7C,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,wBAAwB,CAuC1B;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8I5D;AAGD,OAAO,EAAE,sCAAsC,EAAE,CAAC"}
@@ -0,0 +1,216 @@
1
+ /**
2
+ * `olam skills migrate-from-toolbox` — convert an existing toolbox-shaped
3
+ * skill source (e.g. atlas-toolbox, grain/ai-skills) installation to
4
+ * olam-managed skill distribution.
5
+ *
6
+ * Order of operations (atomic in spirit — snapshot first, mutations after):
7
+ * 1. detectToolboxState({ toolboxPath }) → MigrationSnapshot (or no-op when nothing detected)
8
+ * 2. writeMigrationSnapshot() → ~/.olam/state/migration-snapshots/<namespace>-<ISO>.json
9
+ * 3. addSkillSource() + cloneSkillSource() → register the toolbox as an olam source
10
+ * 4. uninstall legacy toolbox SessionStart hook entries (entries whose command
11
+ * references the toolbox repo path OR `./scripts/sync.sh`)
12
+ * 5. install the olam-skills SessionStart hook (via mergeHomeSettingsJson)
13
+ * 6. run `olam skills sync` to deploy artifacts under olam management
14
+ *
15
+ * Idempotent: re-running on an already-migrated host detects the olam
16
+ * hook sentinel and no-ops with an informative message.
17
+ */
18
+ import * as fs from 'node:fs';
19
+ import * as path from 'node:path';
20
+ import { addSkillSource, cloneSkillSource, detectToolboxState, writeMigrationSnapshot, OLAM_SKILLS_HOOK_SENTINEL, buildSkillsHookEntry, OLAM_SKILLS_HOOK_STAGE, syncSkills, } from '@olam/core/src/skill-sources/index.js';
21
+ import { mergeHomeSettingsJson } from '@olam/core/src/world/merge-settings.js';
22
+ import { claudeSettingsPath } from '@olam/core/src/skill-sources/index.js';
23
+ import { printError, printInfo, printSuccess, printWarning } from '../output.js';
24
+ /** Stable command identifier — referenced by tests to keep them rename-resilient. */
25
+ export const MIGRATE_FROM_TOOLBOX_COMMAND = 'migrate-from-toolbox';
26
+ function asMessage(err) {
27
+ return err instanceof Error ? err.message : String(err);
28
+ }
29
+ function isOlamSkillsHookPresent(filePath) {
30
+ if (!fs.existsSync(filePath))
31
+ return false;
32
+ try {
33
+ const raw = fs.readFileSync(filePath, 'utf-8');
34
+ return raw.includes(OLAM_SKILLS_HOOK_SENTINEL);
35
+ }
36
+ catch {
37
+ return false;
38
+ }
39
+ }
40
+ /**
41
+ * Surgically remove SessionStart hook entries that reference the toolbox
42
+ * repo path OR call `./scripts/sync.sh` (legacy atlas-toolbox sync entry —
43
+ * harmless no-op against non-atlas toolboxes). Leaves olam-skills entries
44
+ * and unrelated user hooks intact.
45
+ */
46
+ function uninstallLegacyToolboxSessionStartHook(filePath, toolboxPath) {
47
+ if (!fs.existsSync(filePath))
48
+ return { removed: 0 };
49
+ const raw = fs.readFileSync(filePath, 'utf-8');
50
+ const settings = raw.trim() ? JSON.parse(raw) : {};
51
+ const ss = settings?.hooks?.SessionStart;
52
+ if (!Array.isArray(ss))
53
+ return { removed: 0 };
54
+ let removed = 0;
55
+ const filteredMatchers = [];
56
+ for (const matcher of ss) {
57
+ const innerHooks = Array.isArray(matcher?.hooks) ? matcher.hooks : [];
58
+ const keptInner = innerHooks.filter((h) => {
59
+ if (typeof h?.command !== 'string')
60
+ return true;
61
+ // Identify legacy-toolbox-shape entries by command content.
62
+ const looksLegacyToolbox = h.command.includes('./scripts/sync.sh') ||
63
+ (toolboxPath !== undefined && h.command.includes(toolboxPath));
64
+ // Never remove olam-skills entries here — install-skills-hook handles those.
65
+ const isOlam = h.command.includes(OLAM_SKILLS_HOOK_SENTINEL);
66
+ if (looksLegacyToolbox && !isOlam) {
67
+ removed += 1;
68
+ return false;
69
+ }
70
+ return true;
71
+ });
72
+ if (keptInner.length === 0 && innerHooks.length > 0)
73
+ continue;
74
+ if (keptInner.length === innerHooks.length)
75
+ filteredMatchers.push(matcher);
76
+ else
77
+ filteredMatchers.push({ ...matcher, hooks: keptInner });
78
+ }
79
+ if (removed === 0)
80
+ return { removed: 0 };
81
+ const next = { ...settings, hooks: { ...settings.hooks, SessionStart: filteredMatchers } };
82
+ if (filteredMatchers.length === 0) {
83
+ const otherStages = Object.keys(next.hooks ?? {}).filter((k) => k !== 'SessionStart');
84
+ if (otherStages.length === 0)
85
+ delete next.hooks;
86
+ else
87
+ delete next.hooks.SessionStart;
88
+ }
89
+ fs.writeFileSync(filePath, JSON.stringify(next, null, 2) + '\n');
90
+ return { removed };
91
+ }
92
+ export function registerSkillsMigrate(program) {
93
+ const skills = program.commands.find((c) => c.name() === 'skills') ??
94
+ program.command('skills').description('Manage skill sources and synchronization');
95
+ skills
96
+ .command(MIGRATE_FROM_TOOLBOX_COMMAND)
97
+ .description('Convert an existing toolbox-shaped skill source (atlas-toolbox, grain/ai-skills, etc.) to olam-managed skill distribution')
98
+ .option('--path <path>', 'Absolute path to the source toolbox repo (e.g. /repos/atlas-toolbox, /repos/grain/ai-skills)')
99
+ .option('--namespace <name>', 'Source-identifying namespace used for the snapshot filename + default source name (default: basename of --path)')
100
+ .option('--source-name <name>', 'Display name for the registered olam source (default: --namespace)')
101
+ .option('--branch <branch>', 'Branch to track on the source', 'master')
102
+ .option('--scope <scope>', 'install-hook scope: project (default) or user', 'project')
103
+ .option('--no-clone', 'Skip clone step (register source state only — useful for tests)')
104
+ .action(async (opts) => {
105
+ // Idempotency: if olam-skills sentinel already present, no-op.
106
+ const settingsFile = claudeSettingsPath();
107
+ if (isOlamSkillsHookPresent(settingsFile)) {
108
+ printInfo(MIGRATE_FROM_TOOLBOX_COMMAND, `already migrated (olam-skills hook sentinel present in ${settingsFile})`);
109
+ return;
110
+ }
111
+ if (!opts.path) {
112
+ printError('--path <path> is required (absolute path to the source toolbox repo, e.g. /repos/atlas-toolbox)');
113
+ process.exitCode = 1;
114
+ return;
115
+ }
116
+ const toolboxPath = opts.path;
117
+ const namespace = opts.namespace ?? path.basename(toolboxPath);
118
+ const sourceName = opts.sourceName ?? namespace;
119
+ // 1. Detect.
120
+ const snapshot = detectToolboxState({ toolboxPath, namespace });
121
+ if (!snapshot) {
122
+ printInfo(MIGRATE_FROM_TOOLBOX_COMMAND, `no toolbox state detected at ${toolboxPath} (no ~/.claude/.atlas-user, no symlinks pointing at this path, no SessionStart hook block — nothing to migrate)`);
123
+ return;
124
+ }
125
+ // 2. Snapshot (ALWAYS — before any mutation).
126
+ let snapshotPath;
127
+ try {
128
+ snapshotPath = writeMigrationSnapshot(snapshot);
129
+ printInfo('snapshot', snapshotPath);
130
+ }
131
+ catch (err) {
132
+ printError(`snapshot write failed: ${asMessage(err)}`);
133
+ process.exitCode = 1;
134
+ return;
135
+ }
136
+ // 3. Register source + clone.
137
+ // `trustMethod: 'internal'` — migrate-from is an operator-explicit
138
+ // command (operator typed it). Bypasses the interactive trust
139
+ // gate but is structurally audit-logged via addSkillSource()
140
+ // itself; the trust-audit log records the bypass.
141
+ try {
142
+ const entry = addSkillSource({
143
+ name: sourceName,
144
+ gitUrl: toolboxPath,
145
+ branch: opts.branch,
146
+ trustMethod: 'internal',
147
+ });
148
+ printInfo('registered source', `${entry.name} (${entry.id})`);
149
+ if (opts.clone !== false) {
150
+ const cloneResult = cloneSkillSource({
151
+ gitUrl: entry.gitUrl,
152
+ branch: entry.branch,
153
+ id: entry.id,
154
+ });
155
+ printInfo('cloned to', cloneResult.clonePath);
156
+ }
157
+ else {
158
+ printInfo('clone skipped', '--no-clone passed');
159
+ }
160
+ }
161
+ catch (err) {
162
+ printError(`source registration failed: ${asMessage(err)}`);
163
+ printInfo('snapshot preserved', snapshotPath);
164
+ process.exitCode = 1;
165
+ return;
166
+ }
167
+ // 4. Uninstall legacy toolbox SessionStart hook.
168
+ try {
169
+ const surgery = uninstallLegacyToolboxSessionStartHook(settingsFile, toolboxPath);
170
+ if (surgery.removed > 0) {
171
+ printInfo('legacy hook', `removed ${surgery.removed} entry(ies) from ${settingsFile}`);
172
+ }
173
+ else {
174
+ printInfo('legacy hook', 'no legacy-toolbox-shape SessionStart hook entries found');
175
+ }
176
+ }
177
+ catch (err) {
178
+ printWarning(`legacy hook removal failed: ${asMessage(err)}; proceeding`);
179
+ }
180
+ // 5. Install olam-skills hook.
181
+ const scope = opts.scope === 'user' ? 'user' : 'project';
182
+ const olamHookPath = scope === 'user' ? settingsFile : path.join(process.cwd(), '.claude', 'settings.json');
183
+ try {
184
+ fs.mkdirSync(path.dirname(olamHookPath), { recursive: true });
185
+ const result = mergeHomeSettingsJson(olamHookPath, {
186
+ ensureHook: {
187
+ stage: OLAM_SKILLS_HOOK_STAGE,
188
+ sentinel: OLAM_SKILLS_HOOK_SENTINEL,
189
+ entry: buildSkillsHookEntry(),
190
+ },
191
+ });
192
+ printInfo('olam hook', `${result.status} at ${olamHookPath}`);
193
+ }
194
+ catch (err) {
195
+ printError(`olam hook install failed: ${asMessage(err)}`);
196
+ printInfo('snapshot preserved', snapshotPath);
197
+ process.exitCode = 1;
198
+ return;
199
+ }
200
+ // 6. Sync.
201
+ try {
202
+ const summary = await syncSkills({ atlasUser: snapshot.atlasUser });
203
+ printSuccess(`migrated — synced ${summary.sourceCount} source(s), deployed ${summary.deploy?.linked ?? 0} symlink(s)`);
204
+ printInfo('snapshot', snapshotPath);
205
+ printInfo('reverse', `run \`olam skills migrate-back-to-toolbox --path ${toolboxPath}\` to restore the original state`);
206
+ }
207
+ catch (err) {
208
+ printError(`sync failed: ${asMessage(err)}`);
209
+ printInfo('snapshot preserved', snapshotPath);
210
+ process.exitCode = 1;
211
+ }
212
+ });
213
+ }
214
+ // Export internal helper for tests + reverse-migration consumers.
215
+ export { uninstallLegacyToolboxSessionStartHook };
216
+ //# sourceMappingURL=skills-migrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills-migrate.js","sourceRoot":"","sources":["../../src/commands/skills-migrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,EACzB,oBAAoB,EACpB,sBAAsB,EACtB,UAAU,GACX,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjF,qFAAqF;AACrF,MAAM,CAAC,MAAM,4BAA4B,GAAG,sBAAsB,CAAC;AAEnE,SAAS,SAAS,CAAC,GAAY;IAC7B,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG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AAC,CAAC;YAC7C,SAAS,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC;YAC9C,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAED,kEAAkE;AAClE,OAAO,EAAE,sCAAsC,EAAE,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * olam skills onboard — fresh-install umbrella that composes the 3-step
3
+ * recipe into one operator-friendly verb.
4
+ *
5
+ * olam skills onboard --name <n> --git-url <url> [--branch main]
6
+ * [--trust] [--scope project|user]
7
+ *
8
+ * Pipeline:
9
+ * 1. addSkillSource({ trustMethod: 'flag' }) — `--trust` is the only
10
+ * sanctioned trust method here. Onboard is non-interactive by
11
+ * design (it composes 4 steps; an interactive picker mid-pipeline
12
+ * would be confusing). Operators who want the picker should run
13
+ * `olam skills source add` directly.
14
+ * 2. cloneSkillSource(...) — register + clone.
15
+ * 3. installSkillsHookToFile(...) at --scope (default project).
16
+ * 4. syncSkills() — first sync.
17
+ * 5. Print a single success summary covering all 4 steps.
18
+ *
19
+ * Failure rollback: any failure AFTER step 1 (clone, hook install,
20
+ * sync) unwinds the registered source so the operator can re-try
21
+ * cleanly. Each step appends an audit row so the trust-coverage gate
22
+ * stays accurate even when the umbrella partially fails.
23
+ */
24
+ import type { Command } from 'commander';
25
+ export declare function registerSkillsOnboard(program: Command): void;
26
+ //# sourceMappingURL=skills-onboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills-onboard.d.ts","sourceRoot":"","sources":["../../src/commands/skills-onboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6BzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0M5D"}