@aopslabs/aops 0.3.23 → 0.3.25

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 (68) hide show
  1. package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/SKILL.md +0 -1
  2. package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/references/agentspace/SKILL.md +0 -6
  3. package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/references/collaborative-work/SKILL.md +1 -2
  4. package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/references/working-disciplines/SKILL.md +2 -5
  5. package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/user-guides/agentspace.md +1 -16
  6. package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/user-guides/aops-cli.md +4 -33
  7. package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/user-guides/working-disciplines.md +32 -138
  8. package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/manifest.json +17 -22
  9. package/agent-assets-release/agent-assets/inventory.json +5 -5
  10. package/agent-assets-release/agent-assets/projection.json +1 -1
  11. package/agent-assets-release/agent-assets-release.json +48 -53
  12. package/agent-assets-release/agent-assets-release.sigstore.json +27 -31
  13. package/assets/agent-assets/core/SKILL.md +0 -1
  14. package/assets/agent-assets/core/references/agentspace/SKILL.md +0 -6
  15. package/assets/agent-assets/core/references/collaborative-work/SKILL.md +1 -2
  16. package/assets/agent-assets/core/references/working-disciplines/SKILL.md +2 -5
  17. package/assets/agent-assets/core/user-guides/agentspace.md +1 -16
  18. package/assets/agent-assets/core/user-guides/aops-cli.md +4 -33
  19. package/assets/agent-assets/core/user-guides/working-disciplines.md +32 -138
  20. package/dist/commands/checkpoint.js +4 -23
  21. package/dist/commands/community-server.js +212 -6
  22. package/dist/commands/db.js +145 -0
  23. package/dist/commands/experience.js +0 -2
  24. package/dist/commands/global-update.js +447 -22
  25. package/dist/commands/memory.js +8 -2
  26. package/dist/commands/official-catalog.js +1 -1
  27. package/dist/commands/plan.js +2 -2
  28. package/dist/commands/pm/index.js +39 -3
  29. package/dist/commands/pm/projectman.js +281 -8
  30. package/dist/commands/start-disciplines.js +8 -21
  31. package/dist/commands/start.js +20 -504
  32. package/dist/lib/agent-assets/native-fs.js +2 -2
  33. package/dist/lib/community-cockpit-lifecycle.js +95 -1
  34. package/dist/lib/community-migration-snapshot.js +43 -2
  35. package/dist/lib/community-native-backup.js +386 -0
  36. package/dist/lib/community-native-lifecycle.js +147 -5
  37. package/dist/lib/community-native-migration.js +20 -0
  38. package/dist/main.js +2 -2
  39. package/dist/seeds/agents-md.js +1 -1
  40. package/dist/utils/playbook-workspace.js +5 -33
  41. package/dist/utils/session-guidance.js +0 -7
  42. package/native/bin/darwin-arm64/aops-agent-assets-fs +0 -0
  43. package/native/bin/darwin-x64/aops-agent-assets-fs +0 -0
  44. package/native/bin/linux-arm64/aops-agent-assets-fs +0 -0
  45. package/native/bin/linux-x64/aops-agent-assets-fs +0 -0
  46. package/native/bin/win32-x64/aops-agent-assets-fs.exe +0 -0
  47. package/native/manifest.json +6 -6
  48. package/native/qualifications/win32-x64.json +2 -2
  49. package/native/tui/darwin-arm64/aops-tui +0 -0
  50. package/native/tui/linux-x64/aops-tui +0 -0
  51. package/native/tui/win32-x64/aops-tui.exe +0 -0
  52. package/package.json +21 -9
  53. package/agent-assets-release/agent-assets/core/647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09/files/references/mission/SKILL.md +0 -54
  54. package/assets/agent-assets/core/references/mission/SKILL.md +0 -54
  55. package/dist/commands/mission.js +0 -562
  56. /package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/references/aops-cli-core/SKILL.md +0 -0
  57. /package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/references/chatv3/SKILL.md +0 -0
  58. /package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/references/discuss/SKILL.md +0 -0
  59. /package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/references/docman/SKILL.md +0 -0
  60. /package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/references/projectman/SKILL.md +0 -0
  61. /package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/references/sys/SKILL.md +0 -0
  62. /package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/references/view/SKILL.md +0 -0
  63. /package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/user-guides/agent-assets.md +0 -0
  64. /package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/user-guides/aops-system.md +0 -0
  65. /package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/user-guides/chatv3.md +0 -0
  66. /package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/user-guides/docman.md +0 -0
  67. /package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/user-guides/projectman.md +0 -0
  68. /package/agent-assets-release/agent-assets/core/{647c6e84fbc48f9a36945d81660f4d2a5241f58a53a18054365bfc16868b0f09 → bc42dd7792dbe66040e99a7ef3d80b3bc788c72b369b5a065cf936aef29f53fb}/files/user-guides/sys.md +0 -0
@@ -1,5 +1,5 @@
1
1
  import { createHash, randomBytes, randomUUID } from 'node:crypto';
2
- import { spawn } from 'node:child_process';
2
+ import { spawn, spawnSync } from 'node:child_process';
3
3
  import { createRequire } from 'node:module';
4
4
  import { closeSync, existsSync, fsyncSync, lstatSync, mkdirSync, openSync, readdirSync, readSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync, } from 'node:fs';
5
5
  import path from 'node:path';
@@ -10,7 +10,8 @@ import { resolveCommunityInstallPaths } from './community-lifecycle.js';
10
10
  import { buildCommunityInstanceContract, } from './community-instance-contract.js';
11
11
  import { COMMUNITY_NATIVE_POSTGRES_CONTRACT_PATH, assertCommunityNativePostgresInstanceState, assertCommunityNativePostgresState, buildCommunityNativePostgresUrl, setupCommunityNativePostgres, startCommunityNativePostgres, } from './community-native-postgres.js';
12
12
  import { COMMUNITY_NATIVE_MIGRATION_POLICY_PATH, assertCommunityNativeMigrationReceiptV1, planCommunityNativeMigration, runCommunityNativeMigration, } from './community-native-migration.js';
13
- import { createCommunityExternalSnapshotAttestationV1, writeCommunityExternalSnapshotAttestationV1, } from './community-migration-snapshot.js';
13
+ import { createCommunityExternalSnapshotAttestationV1, createCommunityNativeManagedSnapshotV1, writeCommunityExternalSnapshotAttestationV1, } from './community-migration-snapshot.js';
14
+ import { createCommunityNativeBackupV1 } from './community-native-backup.js';
14
15
  import { createCommunityNativeApplicationReferenceV1, readCommunityNativeApplicationUpdate, sameCommunityNativeApplicationContent, writeCommunityNativeApplicationRollbackOutcome, writeCommunityNativeApplicationRollbackPrepared, writeCommunityNativeApplicationUpdateOutcome, writeCommunityNativeApplicationUpdatePrepared, } from './community-native-application-recovery.js';
15
16
  const PUBLIC_ROOT_NAME = 'aops-community-distribution';
16
17
  const PUBLIC_SERVER_PACKAGE_NAME = '@aopslabs/aops-server';
@@ -68,6 +69,56 @@ const PACKAGE_BUILD_PATHS = Object.freeze({
68
69
  handlerEntry: 'build/handler.js',
69
70
  cockpitIndex: 'cockpit/index.html',
70
71
  });
72
+ export function inspectHostProcess(pid, execute = (command, args) => {
73
+ const result = spawnSync(command, args, { encoding: 'utf8', windowsHide: true, timeout: 5_000 });
74
+ if (result.error)
75
+ throw result.error;
76
+ return { status: result.status, stdout: result.stdout ?? '', stderr: result.stderr ?? '' };
77
+ }, platform = process.platform) {
78
+ if (!Number.isSafeInteger(pid) || pid < 1) {
79
+ return { outcome: 'undetermined', pid, reason: 'pid_not_inspectable' };
80
+ }
81
+ try {
82
+ if (platform === 'win32') {
83
+ const result = execute('powershell.exe', [
84
+ '-NoProfile', '-NonInteractive', '-Command',
85
+ `$p = Get-CimInstance Win32_Process -Filter "ProcessId=${pid}" -ErrorAction Stop; ` +
86
+ 'if ($null -eq $p) { exit 3 }; ' +
87
+ '"{0}`t{1}" -f $p.CreationDate.ToString("o"), $p.CommandLine',
88
+ ]);
89
+ if (result.status === 3)
90
+ return { outcome: 'absent', pid };
91
+ if (result.status !== 0) {
92
+ return { outcome: 'undetermined', pid, reason: `process_query_failed:${result.status ?? 'no_status'}` };
93
+ }
94
+ const [startedAt, ...rest] = result.stdout.trim().split('\t');
95
+ if (!startedAt)
96
+ return { outcome: 'undetermined', pid, reason: 'process_query_empty' };
97
+ return { outcome: 'inspected', pid, startedAt, command: rest.join('\t').trim() };
98
+ }
99
+ const result = execute('ps', ['-o', 'lstart=,args=', '-p', String(pid)]);
100
+ if (result.status === 1 && result.stdout.trim() === '')
101
+ return { outcome: 'absent', pid };
102
+ if (result.status !== 0) {
103
+ return { outcome: 'undetermined', pid, reason: `process_query_failed:${result.status ?? 'no_status'}` };
104
+ }
105
+ const line = result.stdout.split('\n')[0]?.trim() ?? '';
106
+ if (line === '')
107
+ return { outcome: 'absent', pid };
108
+ const fields = line.split(/\s+/u);
109
+ if (fields.length < 6)
110
+ return { outcome: 'undetermined', pid, reason: 'process_query_unparsable' };
111
+ const startedAt = fields.slice(0, 5).join(' ');
112
+ return { outcome: 'inspected', pid, startedAt, command: fields.slice(5).join(' ') };
113
+ }
114
+ catch (error) {
115
+ return {
116
+ outcome: 'undetermined',
117
+ pid,
118
+ reason: error instanceof Error ? `process_query_threw:${error.message.slice(0, 80)}` : 'process_query_threw',
119
+ };
120
+ }
121
+ }
71
122
  function sha256(content) {
72
123
  return `sha256:${createHash('sha256').update(content).digest('hex')}`;
73
124
  }
@@ -1145,10 +1196,17 @@ export async function attestCommunityNativeExternalSnapshot(params, dependencies
1145
1196
  evidence,
1146
1197
  };
1147
1198
  }
1148
- function childEnvironment(params) {
1199
+ const FORWARDED_TUNING_ENV_KEYS = new Set([
1200
+ 'CHATV3_RATE_OPEN_PER_MIN',
1201
+ 'CHATV3_RATE_MEMBER_PER_MIN',
1202
+ 'CHATV3_RATE_LOCAL_PER_MIN',
1203
+ ]);
1204
+ export function childEnvironment(params) {
1149
1205
  const env = { ...(params.env ?? process.env) };
1150
1206
  for (const key of Object.keys(env)) {
1151
1207
  const upper = key.toUpperCase();
1208
+ if (FORWARDED_TUNING_ENV_KEYS.has(upper))
1209
+ continue;
1152
1210
  if (/^PG[A-Z0-9_]+$/i.test(key) ||
1153
1211
  /(?:^|_)(?:AUTH|COOKIE|DATABASE|ENCRYPT|JWT|PASSWORD|PG|POSTGRES|REPO|SECRET|SESSION|SQLITE|TOKEN)(?:_|$)/i.test(key) ||
1154
1212
  /^(?:AOPS|PROJECTMAN|DOCMAN|AGENTSPACE|CHATV3|AUTHV2|KANBAN|SPRINT|TASKER|FILEMAN|SYS)_/i.test(key) ||
@@ -1437,6 +1495,9 @@ export const communityNativeRuntime = {
1437
1495
  return Boolean(error && typeof error === 'object' && 'code' in error && error.code === 'EPERM');
1438
1496
  }
1439
1497
  },
1498
+ inspectProcess(pid) {
1499
+ return inspectHostProcess(pid);
1500
+ },
1440
1501
  sleep: (milliseconds, signal) => new Promise((resolve, reject) => {
1441
1502
  if (signal?.aborted) {
1442
1503
  reject(new Error('community_operation_aborted'));
@@ -1476,6 +1537,16 @@ function removeControlIfExact(paths, launchId) {
1476
1537
  throw new Error('community_native_control_launch_mismatch');
1477
1538
  rmSync(paths.controlPath, { force: true });
1478
1539
  }
1540
+ function reconcileDisappearedRecord(record, reason, now) {
1541
+ if (record.status !== 'starting' && record.status !== 'running')
1542
+ return record;
1543
+ return {
1544
+ ...record,
1545
+ status: 'failed',
1546
+ updatedAt: now().toISOString(),
1547
+ failure: record.failure ?? reason,
1548
+ };
1549
+ }
1479
1550
  async function observeInstalledNative(params) {
1480
1551
  const record = params.processRecord;
1481
1552
  const identityPresent = existsSync(params.paths.identityPath);
@@ -1554,7 +1625,8 @@ async function observeInstalledNative(params) {
1554
1625
  if (!identity) {
1555
1626
  if (!supervisorAlive && !hostAlive) {
1556
1627
  return {
1557
- runtimeState: 'crashed', recoverable: true, process: record, identity: null,
1628
+ runtimeState: 'crashed', recoverable: true, identity: null,
1629
+ process: reconcileDisappearedRecord(record, 'community_native_process_disappeared_without_identity', params.now),
1558
1630
  supervisorAlive: false, hostAlive: false, health: 'not-checked',
1559
1631
  reason: 'community_native_process_disappeared_without_identity',
1560
1632
  };
@@ -1567,7 +1639,8 @@ async function observeInstalledNative(params) {
1567
1639
  }
1568
1640
  if (!supervisorAlive && !hostAlive) {
1569
1641
  return {
1570
- runtimeState: 'crashed', recoverable: true, process: record, identity,
1642
+ runtimeState: 'crashed', recoverable: true, identity,
1643
+ process: reconcileDisappearedRecord(record, 'community_native_process_disappeared', params.now),
1571
1644
  supervisorAlive: false, hostAlive: false, health: 'not-checked',
1572
1645
  reason: 'community_native_process_disappeared',
1573
1646
  };
@@ -1636,6 +1709,10 @@ export async function stopCommunityNativeInstall(params = {}) {
1636
1709
  now,
1637
1710
  });
1638
1711
  if (observed.runtimeState === 'stopped' || observed.runtimeState === 'crashed') {
1712
+ if (observed.runtimeState === 'crashed' && observed.process &&
1713
+ inspection.process && inspection.process.status !== observed.process.status) {
1714
+ writeProcess(inspection.paths, observed.process);
1715
+ }
1639
1716
  return { status: 'already-stopped', state: inspection.state, process: observed.process };
1640
1717
  }
1641
1718
  if (!observed.process || !observed.identity || !observed.supervisorAlive ||
@@ -1789,6 +1866,60 @@ export function resolveCommunityNativeLaunchMode(input) {
1789
1866
  throw new Error('community_native_launch_mode_conflict');
1790
1867
  return input.foreground === true ? 'foreground' : 'detached';
1791
1868
  }
1869
+ export async function resolveCommunityNativeSnapshotEvidence(params) {
1870
+ if (params.context.planning.migrationPlan.action !== 'migrate')
1871
+ return null;
1872
+ const exists = params.fileExists ?? existsSync;
1873
+ if (params.postgres.mode === 'container') {
1874
+ const create = params.createManagedSnapshot ?? createCommunityNativeManagedSnapshotV1;
1875
+ const snapshot = await create({
1876
+ planning: params.context.planning,
1877
+ policy: params.context.policy,
1878
+ sourceRoot: params.context.sourceRoot,
1879
+ state: params.postgres,
1880
+ instanceName: params.instanceName,
1881
+ instanceRoot: params.instanceRoot,
1882
+ backupRoot: params.backupRoot,
1883
+ evidenceRoot: params.evidenceRoot,
1884
+ runtime: params.postgresRuntime,
1885
+ signal: params.signal,
1886
+ });
1887
+ return { path: snapshot.evidencePath, policy: 'managed-verified-only-v1' };
1888
+ }
1889
+ const attestationPath = path.join(params.evidenceRoot, `external-${params.context.planning.acceptedPlanSha256}.json`);
1890
+ if (exists(attestationPath)) {
1891
+ return { path: attestationPath, policy: 'managed-or-external-attested-v1' };
1892
+ }
1893
+ const postgres = params.postgres;
1894
+ const loadUrl = params.loadRepoUrl
1895
+ ?? ((state) => {
1896
+ const configRef = state.configRef;
1897
+ if (typeof configRef !== 'string' || configRef.trim() === '') {
1898
+ throw new Error('community_native_snapshot_external_config_ref_missing');
1899
+ }
1900
+ return loadExternalPostgresUrl(configRef, state.tlsPolicy);
1901
+ });
1902
+ const createBackup = params.createExternalBackup ?? createCommunityNativeBackupV1;
1903
+ const writeAttestation = params.writeExternalAttestation ?? writeCommunityExternalSnapshotAttestationV1;
1904
+ const firstPending = params.context.planning.migrationPlan.pendingMigrations?.[0]?.tag;
1905
+ const { record } = await createBackup({
1906
+ backupRoot: params.backupRoot,
1907
+ repoUrl: loadUrl(postgres),
1908
+ instanceName: params.instanceName,
1909
+ label: firstPending ? `pre-${firstPending}` : 'pre-migration',
1910
+ });
1911
+ const written = writeAttestation({
1912
+ planning: params.context.planning,
1913
+ policy: params.context.policy,
1914
+ evidenceRoot: params.evidenceRoot,
1915
+ provider: 'aops-cli-native-pg-dump',
1916
+ snapshotRef: record.path,
1917
+ snapshotDigest: record.sha256,
1918
+ attestedBy: 'aops-cli',
1919
+ restoreInstructionsRef: `aops db restore --backup ${record.path} --confirm-data-rewind`,
1920
+ });
1921
+ return { path: written.evidencePath, policy: 'managed-or-external-attested-v1' };
1922
+ }
1792
1923
  async function launchInstalledNative(params) {
1793
1924
  throwIfNativeAborted(params.signal);
1794
1925
  assertCommunityNativePathLayout(params.paths, { requireInstanceRoot: true });
@@ -1858,6 +1989,17 @@ async function launchInstalledNative(params) {
1858
1989
  sourceFingerprint: params.state.source.sourceFingerprint,
1859
1990
  requiredPlanSha256: params.requiredMigrationPlanSha256,
1860
1991
  requiredAction: params.requiredMigrationAction,
1992
+ snapshotEvidenceProvider: (context) => resolveCommunityNativeSnapshotEvidence({
1993
+ context,
1994
+ postgres,
1995
+ instanceName: params.state.instanceName,
1996
+ instanceRoot: params.paths.instanceRoot,
1997
+ backupRoot: params.paths.backupRoot,
1998
+ evidenceRoot: params.paths.migrationEvidenceRoot,
1999
+ postgresRuntime: params.postgresRuntime,
2000
+ signal: params.signal,
2001
+ createManagedSnapshot: params.createManagedSnapshot,
2002
+ }),
1861
2003
  onPlanAccepted: (context) => {
1862
2004
  const pendingMigrationCount = context.migrationPlan.pendingMigrations.length;
1863
2005
  params.progress?.({
@@ -212,6 +212,26 @@ function receiptFromResult(invocation, result, completedAt, migrationLogCount) {
212
212
  migrationLogCount,
213
213
  });
214
214
  }
215
+ export async function reportCommunityNativePendingMigrations(params, dependencies = {}) {
216
+ try {
217
+ const policy = readCommunityNativeMigrationPolicy(params.sourceRoot);
218
+ const planning = await (dependencies.planStrictPgSchema ?? planCommunityStrictPgSchema)({
219
+ repoUrl: params.repoUrl,
220
+ workspaceRoot: params.sourceRoot,
221
+ policy,
222
+ });
223
+ const pending = planning.migrationPlan.pendingMigrations ?? [];
224
+ return {
225
+ status: 'planned',
226
+ action: planning.migrationPlan.action,
227
+ pendingMigrationCount: pending.length,
228
+ pendingMigrationTags: pending.map((entry) => String(entry.tag ?? '')).filter(Boolean),
229
+ };
230
+ }
231
+ catch (error) {
232
+ return { status: 'unavailable', reason: error instanceof Error ? error.message : String(error) };
233
+ }
234
+ }
215
235
  export async function runCommunityNativeMigration(invocation, dependencies = {}) {
216
236
  const prior = invocation.priorIntentExpectation;
217
237
  if (!path.isAbsolute(invocation.sourceRoot) || !invocation.repoUrl ||
package/dist/main.js CHANGED
@@ -24,7 +24,6 @@ import { guardChatv3UnknownSubcommand, makeChatv3Command } from './commands/chat
24
24
  import { makeAgentProfileCommand } from './commands/agent-profile.js';
25
25
  import { makePromptCommand } from './commands/prompt.js';
26
26
  import { makeProjectCommand } from './commands/project.js';
27
- import { makeMissionCommand } from './commands/mission.js';
28
27
  import { makePlaybookCommand } from './commands/playbook.js';
29
28
  import { makeResourceCommand } from './commands/resource.js';
30
29
  import { makeArtifactCommand } from './commands/artifact.js';
@@ -33,6 +32,7 @@ import { makeSkillCommand } from './commands/skill.js';
33
32
  import { makeDocCommand } from './commands/doc.js';
34
33
  import { makePmCommand } from './commands/pm/index.js';
35
34
  import { makeCommunityServerCommand } from './commands/community-server.js';
35
+ import { makeDbCommand } from './commands/db.js';
36
36
  import { makeCommunityCockpitCommand } from './commands/community-cockpit.js';
37
37
  import { makeCommunityDoctorCommand } from './commands/community-doctor.js';
38
38
  import { makeTargetCommand } from './commands/target.js';
@@ -141,7 +141,6 @@ export function buildCommunityProgram() {
141
141
  program.addCommand(makeAgentProfileCommand());
142
142
  program.addCommand(makePromptCommand());
143
143
  program.addCommand(makeProjectCommand());
144
- program.addCommand(makeMissionCommand());
145
144
  program.addCommand(makePlaybookCommand());
146
145
  program.addCommand(makeResourceCommand());
147
146
  program.addCommand(makeArtifactCommand());
@@ -151,6 +150,7 @@ export function buildCommunityProgram() {
151
150
  program.addCommand(makeDocCommand());
152
151
  program.addCommand(makePmCommand());
153
152
  program.addCommand(makeCommunityServerCommand());
153
+ program.addCommand(makeDbCommand());
154
154
  program.addCommand(makeCommunityCockpitCommand());
155
155
  program.addCommand(makeCommunityDoctorCommand());
156
156
  program.addCommand(makeTargetCommand());
@@ -10,7 +10,7 @@ export const AOPS_AGENTS_MD_TEMPLATE_SEEDS = [
10
10
  'Boot the aops-collaborative-work skill and pick the mode once at kickoff: solo (default) | solo+async-review | chat-room.',
11
11
  'Run the skill startup block with compact output; prefer aops-cli start --json --out <file> and follow result.promptRef.path instead of inline prompt JSON.',
12
12
  'Read layered rules only as needed: repo AGENTS.md / ChatV3 room rules, selected working-discipline guardrails, accepted playbook briefs, and ranked experience briefs.',
13
- 'Use aops-cli mission resume --id <mission-id> --json or aops-cli start --resume <mission-id> --json when a mission exists; use aops-cli start --reminder --task "<current task>" --area <area> --json for mid-session refresh.',
13
+ 'Use aops-cli start --json',
14
14
  'Pull detail through the skill detail ladder (sub-skill section, command --help, aops-cli agent schema).',
15
15
  'Every task lands in PM before implementation; validate honestly; UI slices are verified live via Chrome MCP.',
16
16
  'Solo modes may leave async PM review requests for a future session; chat-room mode posts the PM review-request ref into the hosted room as a wake.',
@@ -232,25 +232,10 @@ export function filterPlaybookRecords(records, filter = {}) {
232
232
  ? filtered.slice(0, Math.trunc(filter.limit))
233
233
  : filtered;
234
234
  }
235
- function getSessionContextMissionId(record) {
236
- return isRecord(record.sessionContext) ? normalizeNonEmpty(record.sessionContext.missionId) : undefined;
237
- }
238
- function sourceRefsIncludeMission(record, missionId) {
239
- return toRecordArray(record.sourceRefs).some((ref) => {
240
- const refType = normalizeNonEmpty(ref.refType)?.toLowerCase();
241
- const refId = normalizeNonEmpty(ref.refId) ?? normalizeNonEmpty(ref.id);
242
- return refId === missionId && (refType === undefined || refType === 'agentspace.mission' || refType === 'mission');
243
- });
244
- }
245
- function isActiveSessionPlaybook(record, missionId) {
246
- if (normalizeNonEmpty(record.scope)?.toLowerCase() !== 'session')
247
- return false;
248
- if (!missionId)
249
- return true;
250
- return getSessionContextMissionId(record) === missionId || sourceRefsIncludeMission(record, missionId);
235
+ function isActiveSessionPlaybook(record) {
236
+ return normalizeNonEmpty(record.scope)?.toLowerCase() === 'session';
251
237
  }
252
238
  function buildSessionPlaybookSet(records, options = {}) {
253
- const missionId = normalizeNonEmpty(options.missionId);
254
239
  const reviewState = toStringArray(options.reviewState).length > 0
255
240
  ? toStringArray(options.reviewState).map((entry) => entry.toLowerCase())
256
241
  : ['accepted'];
@@ -261,7 +246,7 @@ function buildSessionPlaybookSet(records, options = {}) {
261
246
  ? Math.trunc(options.limit)
262
247
  : 8;
263
248
  const filtered = records.filter((record) => {
264
- if (!isActiveSessionPlaybook(record, missionId))
249
+ if (!isActiveSessionPlaybook(record))
265
250
  return false;
266
251
  if (!durability.includes(normalizeNonEmpty(record.durability)?.toLowerCase() ?? ''))
267
252
  return false;
@@ -284,7 +269,6 @@ function buildSessionPlaybookSet(records, options = {}) {
284
269
  scope: 'session',
285
270
  durability,
286
271
  reviewState,
287
- ...(missionId ? { missionId } : {}),
288
272
  limit,
289
273
  },
290
274
  count: filtered.length,
@@ -295,13 +279,10 @@ function buildSessionPlaybookSet(records, options = {}) {
295
279
  mode: 'read-only',
296
280
  applyRequired: false,
297
281
  command,
298
- policyPath: 'mission.policy.playbook.sessionSet',
299
- note: missionId
300
- ? 'Review accepted session-scope playbooks attached to this mission before resuming work.'
301
- : 'Review accepted session-scope playbooks before resuming active work.',
282
+ note: 'Review accepted session-scope playbooks before resuming active work.',
302
283
  },
303
284
  ],
304
- note: 'Session playbooks are read-only active-mission guidance; start/resume surfaces never promote them silently.',
285
+ note: 'Session playbooks are read-only session-scope guidance; start/resume surfaces never promote them silently.',
305
286
  };
306
287
  }
307
288
  export function buildProjectPlaybookSet(records, options = {}) {
@@ -348,7 +329,6 @@ export function buildProjectPlaybookSet(records, options = {}) {
348
329
  mode: 'read-only',
349
330
  applyRequired: false,
350
331
  command,
351
- policyPath: 'mission.policy.playbook.projectSet',
352
332
  note: 'Review accepted project-scope playbooks before starting or resuming work.',
353
333
  },
354
334
  ],
@@ -356,7 +336,6 @@ export function buildProjectPlaybookSet(records, options = {}) {
356
336
  };
357
337
  }
358
338
  export function buildActivePlaybookNudgePack(records, options = {}) {
359
- const missionId = normalizeNonEmpty(options.missionId);
360
339
  const project = buildProjectPlaybookSet(records, {
361
340
  projectSlug: options.projectSlug,
362
341
  reviewState: options.reviewState,
@@ -365,7 +344,6 @@ export function buildActivePlaybookNudgePack(records, options = {}) {
365
344
  });
366
345
  const session = buildSessionPlaybookSet(records, {
367
346
  projectSlug: options.projectSlug,
368
- missionId,
369
347
  reviewState: options.reviewState,
370
348
  durability: options.sessionDurability,
371
349
  limit: options.limit,
@@ -381,11 +359,9 @@ export function buildActivePlaybookNudgePack(records, options = {}) {
381
359
  '--title "Hexagen backend playbook candidate"',
382
360
  '--area hexagen',
383
361
  '--tag playbook-candidate',
384
- missionId ? `--mission-id ${missionId}` : undefined,
385
362
  '--content "<reviewed closeout pattern, evidence, and applicability>"',
386
363
  '--apply --json',
387
364
  ].filter(Boolean).join(' '),
388
- policyPath: 'mission.policy.playbook.closeoutCapture.capture',
389
365
  note: 'At closeout, capture only reviewed operator/reviewer signal as experience; this is an explicit write.',
390
366
  },
391
367
  {
@@ -402,7 +378,6 @@ export function buildActivePlaybookNudgePack(records, options = {}) {
402
378
  '--applies-when "A future hexagen backend slice needs the same generated-domain pattern"',
403
379
  '--apply --json',
404
380
  ].filter(Boolean).join(' '),
405
- policyPath: 'mission.policy.playbook.closeoutCapture.promote',
406
381
  note: 'Promote a reviewed experience into an accepted playbook only after operator/reviewer signal.',
407
382
  },
408
383
  {
@@ -410,7 +385,6 @@ export function buildActivePlaybookNudgePack(records, options = {}) {
410
385
  mode: 'nudge-first',
411
386
  applyRequired: true,
412
387
  command: 'aops-cli mem summary --closeout --durability durable --confirm --content "<outcome, validation, review evidence, next action>" --apply --json',
413
- policyPath: 'mission.policy.closeout.handoff',
414
388
  note: 'Durable closeout memory remains explicit and confirmed; it is evidence for later playbook promotion, not an automatic promotion.',
415
389
  },
416
390
  ];
@@ -425,7 +399,6 @@ export function buildActivePlaybookNudgePack(records, options = {}) {
425
399
  mode: 'active-playbook-nudge-pack',
426
400
  readOnly: true,
427
401
  defaultWrite: false,
428
- ...(missionId ? { missionId } : {}),
429
402
  project,
430
403
  session,
431
404
  count: project.count + session.count,
@@ -473,7 +446,6 @@ export async function buildReadOnlyActivePlaybookNudgePackFromContext(context, o
473
446
  const records = await readLocalPlaybookRecordsFromContext(context);
474
447
  return buildActivePlaybookNudgePack(records, {
475
448
  projectSlug: context.projectSlug,
476
- missionId: options.missionId,
477
449
  limit: options.limit,
478
450
  });
479
451
  }
@@ -61,10 +61,6 @@ function scoreExperience(item, options) {
61
61
  score += 30;
62
62
  reasons.push(`area:${area}`);
63
63
  }
64
- if (sourceRefsContain(item, options.missionId)) {
65
- score += 25;
66
- reasons.push('mission-ref');
67
- }
68
64
  if (sourceRefsContain(item, options.planId)) {
69
65
  score += 20;
70
66
  reasons.push('plan-ref');
@@ -214,7 +210,6 @@ function buildSuggestedActions(params) {
214
210
  ];
215
211
  }
216
212
  export async function buildSessionGuidancePack(context, options) {
217
- const missionId = normalizeNonEmpty(options.missionId);
218
213
  const planId = normalizeNonEmpty(options.planId);
219
214
  const area = normalizeNonEmpty(options.area);
220
215
  const task = normalizeNonEmpty(options.task);
@@ -229,7 +224,6 @@ export async function buildSessionGuidancePack(context, options) {
229
224
  defaultWrite: false,
230
225
  hints: compactPayload({
231
226
  task,
232
- missionId,
233
227
  planId,
234
228
  area,
235
229
  experienceLimit: parseLimit(options.limit),
@@ -256,7 +250,6 @@ export async function buildSessionGuidancePack(context, options) {
256
250
  filters: compactPayload({
257
251
  area,
258
252
  task,
259
- missionId,
260
253
  planId,
261
254
  limit: parseLimit(options.limit),
262
255
  maxLimit: MAX_EXPERIENCE_LIMIT,
@@ -6,7 +6,7 @@
6
6
  "platform": "darwin",
7
7
  "architecture": "arm64",
8
8
  "relativePath": "bin/darwin-arm64/aops-agent-assets-fs",
9
- "sha256": "8b51027fa9c2ae84480da09a48f5e1970b1b5444e65c79f2c95a84494af83aba",
9
+ "sha256": "da26a2d6c0ea5cf8debe8e30a8a132b7f6e9b0dac1b9234c75172be8fad84e8e",
10
10
  "capabilityClass": "macos-exclusive-durable-v1",
11
11
  "qualification": null
12
12
  },
@@ -14,7 +14,7 @@
14
14
  "platform": "darwin",
15
15
  "architecture": "x64",
16
16
  "relativePath": "bin/darwin-x64/aops-agent-assets-fs",
17
- "sha256": "4e9023fe80b0c019c7d3b822efad79227a8185f6a546fc4a3671d72e4484dcd8",
17
+ "sha256": "7531ef357eb4aa4914c21abb8375ee2f5b5fb8796561689b74b94aad62c88e4c",
18
18
  "capabilityClass": "macos-exclusive-durable-v1",
19
19
  "qualification": null
20
20
  },
@@ -22,7 +22,7 @@
22
22
  "platform": "linux",
23
23
  "architecture": "arm64",
24
24
  "relativePath": "bin/linux-arm64/aops-agent-assets-fs",
25
- "sha256": "8e8457f64e9552a3094a910f3e2214ff2e309b8d2b4754af6fe30fd7fd674ff4",
25
+ "sha256": "4af380c99012b8e847570cb140c70c44c4dcdcee11c17cc5cb2bb8493b82dc8c",
26
26
  "capabilityClass": "linux-posix-durable-v1",
27
27
  "qualification": null
28
28
  },
@@ -30,7 +30,7 @@
30
30
  "platform": "linux",
31
31
  "architecture": "x64",
32
32
  "relativePath": "bin/linux-x64/aops-agent-assets-fs",
33
- "sha256": "a313faedbbb5e4ebd570750ce567ab7e42b23077a8ddf60a4c61ba24965dc01c",
33
+ "sha256": "1c36cd295f0fcfdfd4192748413483b099ac4299e0f770a982846b8915fba31d",
34
34
  "capabilityClass": "linux-posix-durable-v1",
35
35
  "qualification": null
36
36
  },
@@ -38,11 +38,11 @@
38
38
  "platform": "win32",
39
39
  "architecture": "x64",
40
40
  "relativePath": "bin/win32-x64/aops-agent-assets-fs.exe",
41
- "sha256": "9b54788cfec6108383d890fca1e79564258dfb9c8618f775d427b6ec371aac9d",
41
+ "sha256": "18bcd9a70c3ea5d02cfde9d3a9c369f97c2d6ceba6c3149ff57a8a5e1693de7d",
42
42
  "capabilityClass": "windows-ntfs-crash-recoverable-v1",
43
43
  "qualification": {
44
44
  "relativePath": "qualifications/win32-x64.json",
45
- "sha256": "98d28b5ea98eab250ae1849e88dc729a5986916db9aafda8c463a8d366e8c0c2"
45
+ "sha256": "ff219c69735c31fc593d21b9c261b96b5bdfce2ddc9421c812545ec3dfec7948"
46
46
  }
47
47
  }
48
48
  ]
@@ -3,11 +3,11 @@
3
3
  "status": "qualified",
4
4
  "platform": "win32",
5
5
  "architecture": "x64",
6
- "osBuild": "10.0.26200",
6
+ "osBuild": "10.0.26100",
7
7
  "filesystem": "NTFS",
8
8
  "primitiveProfile": "windows-createfile-flush-movefileex-v1",
9
9
  "capabilityClass": "windows-ntfs-crash-recoverable-v1",
10
- "evidenceSha256": "5bd395ea8e18d402e82eaed62da75009ddc767e29f27847184e6099707a37b7d",
10
+ "evidenceSha256": "eef9244424998366ee67c54616b9b7f8620c36cfa2af45b40272bae13347a657",
11
11
  "crashInjectionPoints": [
12
12
  "authority-history",
13
13
  "authority-current",
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aopslabs/aops",
3
- "version": "0.3.23",
3
+ "version": "0.3.25",
4
4
  "type": "module",
5
5
  "description": "AOPS CLI and terminal setup application.",
6
6
  "aopsDockerServerVersion": "0.2.17",
@@ -22,7 +22,15 @@
22
22
  "test:setup-install": "node --test test/setup-install.test.mjs",
23
23
  "test:setup-docker": "node --test test/setup-docker-server.test.mjs",
24
24
  "test:native-lifecycle": "node --test test/community-native-lifecycle.test.mjs",
25
+ "test:migration-snapshot-gate": "node --test test/community-migration-snapshot-gate.test.mjs",
26
+ "test:backup-gate-parity": "node --test test/community-backup-gate-parity.test.mjs test/community-backup-list.test.mjs test/community-native-backup.test.mjs",
27
+ "test:migration-auto-dump": "node --test test/community-migration-auto-dump.test.mjs",
28
+ "test:memory-search-window": "node --test test/memory-search-window-shape.test.mjs",
29
+ "test:db-restore-source-root": "node --test test/db-restore-source-root.test.mjs",
25
30
  "test:operation-journal": "node --test test/community-operation-journal.test.mjs",
31
+ "test:server-instance-option": "node --test test/community-server-instance-option.test.mjs",
32
+ "test:snapshot-provider": "node --test test/community-snapshot-provider.test.mjs",
33
+ "test:snapshot-verify-fd": "node --test test/community-snapshot-verify-fd.test.mjs",
26
34
  "test:commercial-artifact": "node --test test/commercial-artifact.test.mjs",
27
35
  "test:commercial-canonical-order": "node --test test/commercial-canonical-order.test.mjs",
28
36
  "test:commercial-runtime-closure": "node --test test/commercial-runtime-closure.test.mjs",
@@ -56,24 +64,28 @@
56
64
  "test:hosted-contract-hardening": "node --test test/hosted-contract-hardening.test.mjs",
57
65
  "test:home": "node --test test/home-menu.test.mjs",
58
66
  "test:launchers": "node --test test/terminal-launchers.test.mjs",
59
- "test:shortcuts": "pnpm --dir ../.. run build && pnpm run test:home && pnpm run test:cockpit && pnpm run test:launchers && pnpm run test:assets-menu && pnpm run test:agent-assets-content && pnpm run test:chatv3-session-store && pnpm run test:projectman-review-evidence && pnpm run test:projectman-pm-contract && pnpm run test:setup-install && pnpm run test:container-runtime && pnpm run test:native-lifecycle && pnpm run test:operation-journal && pnpm run test:commercial-canonical-order && pnpm run test:commercial-runtime-closure && pnpm run test:commercial-artifact && pnpm run test:commercial-final-readiness && pnpm run test:commercial-admission && pnpm run test:commercial-license && pnpm run test:commercial-runbook && pnpm run test:package-identity && pnpm run test:tui-launcher && pnpm run test:global-update && pnpm run test:skill-discovery && pnpm run test:target-transport && pnpm run test:target-auth && pnpm run test:r6-auth-cutover && pnpm run test:r6-cutover-baseline && pnpm run test:hosted-contract-hardening",
67
+ "test:shortcuts": "pnpm --dir ../.. run build && pnpm run test:home && pnpm run test:cockpit && pnpm run test:launchers && pnpm run test:assets-menu && pnpm run test:agent-assets-content && pnpm run test:chatv3-session-store && pnpm run test:projectman-review-evidence && pnpm run test:projectman-pm-contract && pnpm run test:setup-install && pnpm run test:container-runtime && pnpm run test:native-lifecycle && pnpm run test:migration-snapshot-gate && pnpm run test:backup-gate-parity && pnpm run test:migration-auto-dump && pnpm run test:memory-search-window && pnpm run test:db-restore-source-root && pnpm run test:operation-journal && pnpm run test:commercial-canonical-order && pnpm run test:commercial-runtime-closure && pnpm run test:commercial-artifact && pnpm run test:commercial-final-readiness && pnpm run test:commercial-admission && pnpm run test:commercial-license && pnpm run test:commercial-runbook && pnpm run test:package-identity && pnpm run test:tui-launcher && pnpm run test:global-update && pnpm run test:skill-discovery && pnpm run test:target-transport && pnpm run test:target-auth && pnpm run test:r6-auth-cutover && pnpm run test:r6-cutover-baseline && pnpm run test:hosted-contract-hardening && pnpm run test:server-instance-option && pnpm run test:snapshot-provider && pnpm run test:snapshot-verify-fd",
60
68
  "typecheck": "tsc -p tsconfig.json --noEmit",
61
- "start": "node dist/main.js"
69
+ "start": "node dist/main.js",
70
+ "test:chat-wake-watch": "node --test test/chat-wake-watch.test.mjs",
71
+ "test:codex-wake": "node --test test/codex-wake.test.mjs",
72
+ "test:commercial-lifecycle-evidence": "node --test test/commercial-lifecycle-evidence.test.mjs test/commercial-lifecycle-evidence-projection.test.mjs",
73
+ "test:commercial-effects": "node --test test/commercial-interruption-removal-effects.test.mjs test/commercial-natural-controls-effects.test.mjs test/commercial-transition-effects.test.mjs"
62
74
  },
63
75
  "dependencies": {
64
76
  "@aopslabs/aops-agent-runtime": "0.1.0",
65
- "@aopslabs/aops-server": "0.2.17",
77
+ "@aopslabs/aops-server": "0.2.19",
66
78
  "@aopslabs/artifact-trust-contracts": "0.3.1",
67
79
  "@aopslabs/cli-kit": "0.1.0",
68
- "@aopslabs/aops-host-registration": "0.2.1",
69
- "@aopslabs/aops-pg-bootstrap": "0.2.3",
70
- "@aopslabs/aops-runtime-config": "0.2.1",
80
+ "@aopslabs/aops-host-registration": "0.2.2",
81
+ "@aopslabs/aops-pg-bootstrap": "0.2.4",
82
+ "@aopslabs/aops-runtime-config": "0.2.2",
71
83
  "@sigstore/bundle": "4.0.0",
72
84
  "@sigstore/protobuf-specs": "0.5.1",
73
85
  "@sigstore/tuf": "4.0.2",
74
86
  "@sigstore/verify": "3.1.1",
75
- "@aopslabs/api-client": "0.2.1",
76
- "@aopslabs/domain-product-client-chatv3": "0.4.1",
87
+ "@aopslabs/api-client": "0.2.2",
88
+ "@aopslabs/domain-product-client-chatv3": "0.4.2",
77
89
  "@aopslabs/xf-cli-ui": "0.2.0",
78
90
  "commander": "14.0.3",
79
91
  "pg": "8.20.0",