@aopslabs/aops 0.3.8 → 0.3.10

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 (69) hide show
  1. package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/SKILL.md +3 -4
  2. package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/references/agentspace/SKILL.md +4 -4
  3. package/agent-assets-release/agent-assets/core/070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5/files/references/chatv3/SKILL.md +59 -0
  4. package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/references/collaborative-work/SKILL.md +10 -13
  5. package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/references/discuss/SKILL.md +2 -2
  6. package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/references/docman/SKILL.md +6 -0
  7. package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/references/projectman/SKILL.md +6 -0
  8. package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/references/working-disciplines/SKILL.md +1 -1
  9. package/agent-assets-release/agent-assets/core/070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5/files/user-guides/agentspace.md +198 -0
  10. package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/user-guides/aops-cli.md +25 -24
  11. package/agent-assets-release/agent-assets/core/070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5/files/user-guides/chatv3.md +98 -0
  12. package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/user-guides/docman.md +16 -0
  13. package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/user-guides/projectman.md +7 -0
  14. package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/user-guides/working-disciplines.md +2 -2
  15. package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/manifest.json +31 -36
  16. package/agent-assets-release/agent-assets/inventory.json +5 -5
  17. package/agent-assets-release/agent-assets/projection.json +1 -1
  18. package/agent-assets-release/agent-assets-release.json +64 -69
  19. package/agent-assets-release/agent-assets-release.sigstore.json +26 -25
  20. package/assets/agent-assets/core/SKILL.md +3 -4
  21. package/assets/agent-assets/core/references/agentspace/SKILL.md +4 -4
  22. package/assets/agent-assets/core/references/chatv3/SKILL.md +36 -26
  23. package/assets/agent-assets/core/references/collaborative-work/SKILL.md +10 -13
  24. package/assets/agent-assets/core/references/discuss/SKILL.md +2 -2
  25. package/assets/agent-assets/core/references/docman/SKILL.md +6 -0
  26. package/assets/agent-assets/core/references/projectman/SKILL.md +6 -0
  27. package/assets/agent-assets/core/references/working-disciplines/SKILL.md +1 -1
  28. package/assets/agent-assets/core/user-guides/agentspace.md +135 -1035
  29. package/assets/agent-assets/core/user-guides/aops-cli.md +25 -24
  30. package/assets/agent-assets/core/user-guides/chatv3.md +82 -97
  31. package/assets/agent-assets/core/user-guides/docman.md +16 -0
  32. package/assets/agent-assets/core/user-guides/projectman.md +7 -0
  33. package/assets/agent-assets/core/user-guides/working-disciplines.md +2 -2
  34. package/dist/commands/chatv3.js +81 -46
  35. package/dist/commands/doc.js +4 -4
  36. package/dist/commands/pm/index.js +2 -5
  37. package/dist/commands/pm/projectman.js +36 -95
  38. package/dist/lib/agent-assets/native-fs.js +2 -2
  39. package/dist/lib/agent-assets/release-input.js +7 -1
  40. package/dist/lib/setup-official-catalog-bridge.js +14 -4
  41. package/dist/main.js +2 -3
  42. package/dist/seeds/agents-md.js +1 -1
  43. package/dist/utils/chatv3-cursor.js +41 -0
  44. package/dist/utils/chatv3-session-store.js +166 -36
  45. package/launchers/aops-cockpit.sh +0 -0
  46. package/launchers/aops-server.sh +0 -0
  47. package/native/bin/darwin-arm64/aops-agent-assets-fs +0 -0
  48. package/native/bin/darwin-x64/aops-agent-assets-fs +0 -0
  49. package/native/bin/linux-arm64/aops-agent-assets-fs +0 -0
  50. package/native/bin/linux-x64/aops-agent-assets-fs +0 -0
  51. package/native/bin/win32-x64/aops-agent-assets-fs.exe +0 -0
  52. package/native/manifest.json +49 -0
  53. package/native/qualifications/win32-x64.json +23 -0
  54. package/native/tui/darwin-arm64/aops-tui +0 -0
  55. package/native/tui/win32-x64/aops-tui.exe +0 -0
  56. package/package.json +6 -4
  57. package/agent-assets-release/agent-assets/core/0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706/files/references/chatv3/SKILL.md +0 -49
  58. package/agent-assets-release/agent-assets/core/0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706/files/references/hosted-chat/SKILL.md +0 -64
  59. package/agent-assets-release/agent-assets/core/0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706/files/user-guides/agentspace.md +0 -1098
  60. package/agent-assets-release/agent-assets/core/0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706/files/user-guides/chatv3.md +0 -113
  61. package/assets/agent-assets/core/references/hosted-chat/SKILL.md +0 -64
  62. package/dist/commands/chat.js +0 -1363
  63. /package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/references/aops-cli-core/SKILL.md +0 -0
  64. /package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/references/mission/SKILL.md +0 -0
  65. /package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/references/sys/SKILL.md +0 -0
  66. /package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/references/view/SKILL.md +0 -0
  67. /package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/user-guides/agent-assets.md +0 -0
  68. /package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/user-guides/aops-system.md +0 -0
  69. /package/agent-assets-release/agent-assets/core/{0ffc854a8e32500f3d82c10a1e1ee6376d57e616201a323638f0f9caf8fb2706 → 070b0d3126c645890845791b67157fdd9f43a482fda66583e84fb159b30689a5}/files/user-guides/sys.md +0 -0
@@ -0,0 +1,41 @@
1
+ function decision(requested, previousSeq, expectedPreviousSeq) {
2
+ if (!requested) {
3
+ return {
4
+ requested: false,
5
+ safe: false,
6
+ previousSeq: previousSeq ?? null,
7
+ expectedPreviousSeq,
8
+ };
9
+ }
10
+ if (previousSeq === undefined) {
11
+ return {
12
+ requested: true,
13
+ safe: false,
14
+ previousSeq: null,
15
+ expectedPreviousSeq,
16
+ reason: 'receipt_missing_or_ambiguous',
17
+ };
18
+ }
19
+ if (previousSeq !== expectedPreviousSeq) {
20
+ return {
21
+ requested: true,
22
+ safe: false,
23
+ previousSeq,
24
+ expectedPreviousSeq,
25
+ reason: 'unseen_message_gap',
26
+ };
27
+ }
28
+ return {
29
+ requested: true,
30
+ safe: true,
31
+ previousSeq,
32
+ expectedPreviousSeq,
33
+ };
34
+ }
35
+ export function planChatv3SendCursorAdvance(params) {
36
+ const expectedPreviousSeq = params.sentSeq - 1;
37
+ return {
38
+ delivered: decision(params.markDelivered, params.snapshot?.deliveredSeq, expectedPreviousSeq),
39
+ read: decision(params.markRead, params.snapshot?.lastReadSeq, expectedPreviousSeq),
40
+ };
41
+ }
@@ -7,6 +7,10 @@ import { getAopsCliConfigFilePath } from './config.js';
7
7
  import { decryptWithPassword, encryptWithPassword, } from './password-crypto.js';
8
8
  const STORE_FILENAME = 'chatv3-sessions.json';
9
9
  const SECRET_FILENAME = 'chatv3-session.key';
10
+ const OWNER_STORE_DIRECTORY = 'chatv3';
11
+ const OWNER_STORE_FILENAME = 'sessions.json';
12
+ const OWNER_SECRET_FILENAME = 'session.key';
13
+ const LEGACY_CLAIMS_DIRECTORY = 'chatv3-legacy-claims';
10
14
  function normalizeNonEmpty(value) {
11
15
  if (typeof value !== 'string')
12
16
  return undefined;
@@ -19,14 +23,45 @@ function baseDirFromConfig() {
19
23
  }
20
24
  return path.join(os.homedir(), '.aops');
21
25
  }
22
- export function resolveChatv3SessionStorePath(explicitPath) {
23
- return path.resolve(normalizeNonEmpty(explicitPath) ??
24
- normalizeNonEmpty(process.env.AOPS_CHATV3_SESSION_STORE_PATH) ??
25
- path.join(baseDirFromConfig(), STORE_FILENAME));
26
+ function ownerKey(value) {
27
+ return `sha256:${crypto.createHash('sha256').update(value, 'utf8').digest('hex')}`;
26
28
  }
27
- function resolveChatv3SessionSecretPath() {
29
+ export function resolveChatv3SessionOwner(explicitOwner) {
30
+ const explicit = normalizeNonEmpty(explicitOwner);
31
+ if (explicit)
32
+ return { key: ownerKey(`explicit:${explicit}`), source: 'explicit' };
33
+ const configured = normalizeNonEmpty(process.env.AOPS_CHATV3_SESSION_OWNER);
34
+ if (configured)
35
+ return { key: ownerKey(`environment:${configured}`), source: 'environment' };
36
+ const codexThread = normalizeNonEmpty(process.env.CODEX_THREAD_ID);
37
+ if (codexThread)
38
+ return { key: ownerKey(`codex-thread:${codexThread}`), source: 'codex-thread' };
39
+ const claudeSession = normalizeNonEmpty(process.env.CLAUDE_SESSION_ID) ??
40
+ normalizeNonEmpty(process.env.CLAUDE_CODE_SESSION_ID);
41
+ if (claudeSession)
42
+ return { key: ownerKey(`claude-session:${claudeSession}`), source: 'claude-session' };
43
+ const operator = `${os.userInfo().username}@${os.hostname()}`;
44
+ return { key: ownerKey(`operator:${operator}`), source: 'operator' };
45
+ }
46
+ function ownerDirectoryName(owner) {
47
+ return owner.key.slice('sha256:'.length, 'sha256:'.length + 24);
48
+ }
49
+ export function resolveChatv3SessionStorePath(explicitPath, explicitOwner) {
50
+ const configuredPath = normalizeNonEmpty(explicitPath) ?? normalizeNonEmpty(process.env.AOPS_CHATV3_SESSION_STORE_PATH);
51
+ if (configuredPath)
52
+ return path.resolve(configuredPath);
53
+ const owner = resolveChatv3SessionOwner(explicitOwner);
54
+ return path.resolve(baseDirFromConfig(), OWNER_STORE_DIRECTORY, ownerDirectoryName(owner), OWNER_STORE_FILENAME);
55
+ }
56
+ function resolveLegacyChatv3SessionStorePath() {
57
+ return path.join(baseDirFromConfig(), STORE_FILENAME);
58
+ }
59
+ function resolveLegacyChatv3SessionSecretPath() {
28
60
  return path.join(baseDirFromConfig(), SECRET_FILENAME);
29
61
  }
62
+ function resolveChatv3SessionSecretPath(storePath) {
63
+ return path.join(path.dirname(storePath), OWNER_SECRET_FILENAME);
64
+ }
30
65
  async function ensureDir(filePath) {
31
66
  await fs.mkdir(path.dirname(filePath), { recursive: true });
32
67
  }
@@ -35,18 +70,34 @@ async function enforceOwnerOnlyFileMode(filePath) {
35
70
  return;
36
71
  await fs.chmod(filePath, 0o600);
37
72
  }
38
- async function readStore(storePath) {
73
+ function emptyStore(owner) {
74
+ return {
75
+ version: 2,
76
+ ownerKey: owner.key,
77
+ ownerSource: owner.source,
78
+ sessions: {},
79
+ };
80
+ }
81
+ async function readStore(storePath, owner) {
39
82
  try {
40
83
  const raw = await fs.readFile(storePath, 'utf8');
41
84
  const parsed = JSON.parse(raw);
85
+ if (parsed.version !== 2 || !normalizeNonEmpty(parsed.ownerKey)) {
86
+ throw new Error(`ChatV3 session store is not an agent-owned v2 store: ${storePath}`);
87
+ }
88
+ if (parsed.ownerKey !== owner.key) {
89
+ throw new Error(`ChatV3 session store owner mismatch: ${storePath}`);
90
+ }
42
91
  return {
43
- version: 1,
92
+ version: 2,
93
+ ownerKey: parsed.ownerKey,
94
+ ownerSource: parsed.ownerSource ?? owner.source,
44
95
  sessions: parsed && typeof parsed.sessions === 'object' && parsed.sessions ? parsed.sessions : {},
45
96
  };
46
97
  }
47
98
  catch (error) {
48
99
  if (error.code === 'ENOENT') {
49
- return { version: 1, sessions: {} };
100
+ return emptyStore(owner);
50
101
  }
51
102
  throw error;
52
103
  }
@@ -56,13 +107,12 @@ async function writeStore(storePath, store) {
56
107
  await fs.writeFile(storePath, `${JSON.stringify(store, null, 2)}\n`, { encoding: 'utf8', mode: 0o600 });
57
108
  await enforceOwnerOnlyFileMode(storePath);
58
109
  }
59
- async function resolveSessionSecret() {
110
+ async function resolveSessionSecret(secretPath) {
60
111
  const envSecret = normalizeNonEmpty(process.env.AOPS_CHATV3_SESSION_SECRET) ??
61
112
  normalizeNonEmpty(process.env.AOPS_MCP_TOKEN_SECRET) ??
62
113
  normalizeNonEmpty(process.env.AOPS_MCP_CONFIG_SECRET);
63
114
  if (envSecret)
64
115
  return envSecret;
65
- const secretPath = resolveChatv3SessionSecretPath();
66
116
  try {
67
117
  const raw = await fs.readFile(secretPath, 'utf8');
68
118
  const secret = normalizeNonEmpty(raw);
@@ -87,43 +137,45 @@ function encodeEncryptedPayload(payload) {
87
137
  function decodeEncryptedPayload(value) {
88
138
  return JSON.parse(Buffer.from(value, 'base64').toString('utf8'));
89
139
  }
90
- async function encryptSecret(value) {
91
- const { payload } = await encryptWithPassword(value, await resolveSessionSecret());
140
+ async function encryptSecret(value, secretPath) {
141
+ const { payload } = await encryptWithPassword(value, await resolveSessionSecret(secretPath));
92
142
  return encodeEncryptedPayload(payload);
93
143
  }
94
- async function decryptSecret(value) {
95
- return decryptWithPassword(decodeEncryptedPayload(value), await resolveSessionSecret());
144
+ async function decryptSecret(value, secretPath) {
145
+ return decryptWithPassword(decodeEncryptedPayload(value), await resolveSessionSecret(secretPath));
96
146
  }
97
- async function encryptEpochKeys(keys) {
147
+ async function encryptEpochKeys(keys, secretPath) {
98
148
  if (!keys || keys.length === 0)
99
149
  return undefined;
100
150
  return Promise.all(keys.map(async ({ rawEpochKey, ...rest }) => ({
101
151
  ...rest,
102
- rawEpochKeyEnc: await encryptSecret(rawEpochKey),
152
+ rawEpochKeyEnc: await encryptSecret(rawEpochKey, secretPath),
103
153
  })));
104
154
  }
105
- async function decryptEpochKeys(keys) {
155
+ async function decryptEpochKeys(keys, secretPath) {
106
156
  if (!keys || keys.length === 0)
107
157
  return undefined;
108
158
  return Promise.all(keys.map(async ({ rawEpochKeyEnc, ...rest }) => ({
109
159
  ...rest,
110
- rawEpochKey: await decryptSecret(rawEpochKeyEnc),
160
+ rawEpochKey: await decryptSecret(rawEpochKeyEnc, secretPath),
111
161
  })));
112
162
  }
113
163
  export async function saveChatv3Session(input, secrets, options = {}) {
114
- const storePath = resolveChatv3SessionStorePath(options.storePath);
115
- const store = await readStore(storePath);
164
+ const owner = resolveChatv3SessionOwner(options.owner);
165
+ const storePath = resolveChatv3SessionStorePath(options.storePath, options.owner);
166
+ const secretPath = resolveChatv3SessionSecretPath(storePath);
167
+ const store = await readStore(storePath, owner);
116
168
  const existing = store.sessions[input.id];
117
169
  const now = new Date().toISOString();
118
- const wrapSecretEnc = secrets.wrapSecret ? await encryptSecret(secrets.wrapSecret) : undefined;
119
- const epochKeysEnc = await encryptEpochKeys(secrets.epochKeys);
170
+ const wrapSecretEnc = secrets.wrapSecret ? await encryptSecret(secrets.wrapSecret, secretPath) : undefined;
171
+ const epochKeysEnc = await encryptEpochKeys(secrets.epochKeys, secretPath);
120
172
  const record = {
121
173
  version: 1,
122
174
  ...input,
123
175
  rooms: input.rooms,
124
176
  createdAt: input.createdAt ?? existing?.createdAt ?? now,
125
177
  updatedAt: input.updatedAt ?? now,
126
- memberTokenEnc: await encryptSecret(secrets.memberToken),
178
+ memberTokenEnc: await encryptSecret(secrets.memberToken, secretPath),
127
179
  ...(wrapSecretEnc ? { wrapSecretEnc } : {}),
128
180
  ...(epochKeysEnc ? { epochKeysEnc } : {}),
129
181
  };
@@ -131,31 +183,108 @@ export async function saveChatv3Session(input, secrets, options = {}) {
131
183
  await writeStore(storePath, store);
132
184
  return record;
133
185
  }
186
+ async function readLegacySessionRecord(id) {
187
+ const legacyStorePath = resolveLegacyChatv3SessionStorePath();
188
+ let parsed;
189
+ try {
190
+ parsed = JSON.parse(await fs.readFile(legacyStorePath, 'utf8'));
191
+ }
192
+ catch (error) {
193
+ if (error.code === 'ENOENT')
194
+ return null;
195
+ throw error;
196
+ }
197
+ const record = parsed.sessions?.[id];
198
+ return record ?? null;
199
+ }
200
+ async function claimLegacySession(id, owner, options) {
201
+ if (normalizeNonEmpty(options.storePath) || normalizeNonEmpty(process.env.AOPS_CHATV3_SESSION_STORE_PATH)) {
202
+ return null;
203
+ }
204
+ const legacyRecord = await readLegacySessionRecord(id);
205
+ if (!legacyRecord)
206
+ return null;
207
+ const claimDirectory = path.join(baseDirFromConfig(), LEGACY_CLAIMS_DIRECTORY);
208
+ const claimPath = path.join(claimDirectory, `${ownerKey(`legacy-session:${id}`).slice('sha256:'.length)}.json`);
209
+ await fs.mkdir(claimDirectory, { recursive: true });
210
+ const claim = `${JSON.stringify({ version: 1, sessionId: id, ownerKey: owner.key }, null, 2)}\n`;
211
+ try {
212
+ await fs.writeFile(claimPath, claim, { encoding: 'utf8', mode: 0o600, flag: 'wx' });
213
+ await enforceOwnerOnlyFileMode(claimPath);
214
+ }
215
+ catch (error) {
216
+ if (error.code !== 'EEXIST')
217
+ throw error;
218
+ const existing = JSON.parse(await fs.readFile(claimPath, 'utf8'));
219
+ if (existing.ownerKey !== owner.key) {
220
+ throw new Error(`Legacy ChatV3 session "${id}" is already owned by another local agent session.`);
221
+ }
222
+ }
223
+ const legacySecretPath = resolveLegacyChatv3SessionSecretPath();
224
+ const legacy = {
225
+ record: legacyRecord,
226
+ secrets: {
227
+ memberToken: await decryptSecret(legacyRecord.memberTokenEnc, legacySecretPath),
228
+ wrapSecret: legacyRecord.wrapSecretEnc
229
+ ? await decryptSecret(legacyRecord.wrapSecretEnc, legacySecretPath)
230
+ : undefined,
231
+ epochKeys: await decryptEpochKeys(legacyRecord.epochKeysEnc, legacySecretPath),
232
+ },
233
+ };
234
+ await saveChatv3Session({
235
+ id: legacy.record.id,
236
+ serverBaseUrl: legacy.record.serverBaseUrl,
237
+ handle: legacy.record.handle,
238
+ channel: legacy.record.channel,
239
+ keyId: legacy.record.keyId,
240
+ activeRoomId: legacy.record.activeRoomId,
241
+ rooms: legacy.record.rooms,
242
+ createdAt: legacy.record.createdAt,
243
+ updatedAt: legacy.record.updatedAt,
244
+ }, legacy.secrets, options);
245
+ return legacy;
246
+ }
134
247
  export async function loadChatv3Session(id, options = {}) {
135
- const store = await readStore(resolveChatv3SessionStorePath(options.storePath));
136
- const record = store.sessions[id];
137
- if (!record)
138
- throw new Error(`ChatV3 session not found: ${id}`);
248
+ const owner = resolveChatv3SessionOwner(options.owner);
249
+ const storePath = resolveChatv3SessionStorePath(options.storePath, options.owner);
250
+ const store = await readStore(storePath, owner);
251
+ let record = store.sessions[id];
252
+ if (!record) {
253
+ const claimed = await claimLegacySession(id, owner, options);
254
+ if (!claimed)
255
+ throw new Error(`ChatV3 session not found for the current local agent owner: ${id}`);
256
+ const migrated = await readStore(storePath, owner);
257
+ record = migrated.sessions[id];
258
+ }
259
+ const secretPath = resolveChatv3SessionSecretPath(storePath);
139
260
  return {
140
261
  record,
141
262
  secrets: {
142
- memberToken: await decryptSecret(record.memberTokenEnc),
143
- wrapSecret: record.wrapSecretEnc ? await decryptSecret(record.wrapSecretEnc) : undefined,
144
- epochKeys: await decryptEpochKeys(record.epochKeysEnc),
263
+ memberToken: await decryptSecret(record.memberTokenEnc, secretPath),
264
+ wrapSecret: record.wrapSecretEnc ? await decryptSecret(record.wrapSecretEnc, secretPath) : undefined,
265
+ epochKeys: await decryptEpochKeys(record.epochKeysEnc, secretPath),
145
266
  },
146
267
  };
147
268
  }
148
269
  export async function getChatv3SessionRecord(id, options = {}) {
149
- const store = await readStore(resolveChatv3SessionStorePath(options.storePath));
150
- return store.sessions[id] ?? null;
270
+ try {
271
+ return (await loadChatv3Session(id, options)).record;
272
+ }
273
+ catch (error) {
274
+ if (error.message.startsWith('ChatV3 session not found for the current local agent owner:'))
275
+ return null;
276
+ throw error;
277
+ }
151
278
  }
152
279
  export async function listChatv3SessionRecords(options = {}) {
153
- const store = await readStore(resolveChatv3SessionStorePath(options.storePath));
280
+ const owner = resolveChatv3SessionOwner(options.owner);
281
+ const store = await readStore(resolveChatv3SessionStorePath(options.storePath, options.owner), owner);
154
282
  return Object.values(store.sessions).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
155
283
  }
156
284
  export async function deleteChatv3Session(id, options = {}) {
157
- const storePath = resolveChatv3SessionStorePath(options.storePath);
158
- const store = await readStore(storePath);
285
+ const owner = resolveChatv3SessionOwner(options.owner);
286
+ const storePath = resolveChatv3SessionStorePath(options.storePath, options.owner);
287
+ const store = await readStore(storePath, owner);
159
288
  const existed = Boolean(store.sessions[id]);
160
289
  delete store.sessions[id];
161
290
  await writeStore(storePath, store);
@@ -178,8 +307,9 @@ export function summarizeChatv3Session(record) {
178
307
  };
179
308
  }
180
309
  export async function readChatv3SessionStoreRaw(options = {}) {
181
- const storePath = resolveChatv3SessionStorePath(options.storePath);
310
+ const storePath = resolveChatv3SessionStorePath(options.storePath, options.owner);
182
311
  if (!fsSync.existsSync(storePath))
183
312
  return '';
313
+ await readStore(storePath, resolveChatv3SessionOwner(options.owner));
184
314
  return fs.readFile(storePath, 'utf8');
185
315
  }
File without changes
File without changes
@@ -0,0 +1,49 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "surface": "agent-assets-native-fs-v1",
4
+ "helpers": [
5
+ {
6
+ "platform": "darwin",
7
+ "architecture": "arm64",
8
+ "relativePath": "bin/darwin-arm64/aops-agent-assets-fs",
9
+ "sha256": "c10dfde3b28f8c6c4d5fbc885fc6fa626763b961580e1676af6692342b2c11db",
10
+ "capabilityClass": "macos-exclusive-durable-v1",
11
+ "qualification": null
12
+ },
13
+ {
14
+ "platform": "darwin",
15
+ "architecture": "x64",
16
+ "relativePath": "bin/darwin-x64/aops-agent-assets-fs",
17
+ "sha256": "92cb610782d9d53a2ca43ccf8ffbcef2dd03ec684ce19f2252e3a55eda45e22a",
18
+ "capabilityClass": "macos-exclusive-durable-v1",
19
+ "qualification": null
20
+ },
21
+ {
22
+ "platform": "linux",
23
+ "architecture": "arm64",
24
+ "relativePath": "bin/linux-arm64/aops-agent-assets-fs",
25
+ "sha256": "8e8457f64e9552a3094a910f3e2214ff2e309b8d2b4754af6fe30fd7fd674ff4",
26
+ "capabilityClass": "linux-posix-durable-v1",
27
+ "qualification": null
28
+ },
29
+ {
30
+ "platform": "linux",
31
+ "architecture": "x64",
32
+ "relativePath": "bin/linux-x64/aops-agent-assets-fs",
33
+ "sha256": "a313faedbbb5e4ebd570750ce567ab7e42b23077a8ddf60a4c61ba24965dc01c",
34
+ "capabilityClass": "linux-posix-durable-v1",
35
+ "qualification": null
36
+ },
37
+ {
38
+ "platform": "win32",
39
+ "architecture": "x64",
40
+ "relativePath": "bin/win32-x64/aops-agent-assets-fs.exe",
41
+ "sha256": "f7b0fa243092c5c7fbcddf13ab7e6601566dd8f40078667d262c2a70588dd443",
42
+ "capabilityClass": "windows-ntfs-crash-recoverable-v1",
43
+ "qualification": {
44
+ "relativePath": "qualifications/win32-x64.json",
45
+ "sha256": "36fe11856fe825462846197238926c508a8753f39b6eb306b3c0e638659ef0c7"
46
+ }
47
+ }
48
+ ]
49
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "status": "qualified",
4
+ "platform": "win32",
5
+ "architecture": "x64",
6
+ "osBuild": "10.0.26100",
7
+ "filesystem": "NTFS",
8
+ "primitiveProfile": "windows-createfile-flush-movefileex-v1",
9
+ "capabilityClass": "windows-ntfs-crash-recoverable-v1",
10
+ "evidenceSha256": "86523b4e9d51c687d3386aaa006ce6bee7c8483b0c745d88fcceaf8ad22ae8aa",
11
+ "crashInjectionPoints": [
12
+ "authority-history",
13
+ "authority-current",
14
+ "activation-receipt",
15
+ "active-pointer",
16
+ "runtime-binding-receipt",
17
+ "runtime-binding-current",
18
+ "maintenance-receipt",
19
+ "pin",
20
+ "rollback",
21
+ "prune"
22
+ ]
23
+ }
Binary file
Binary file
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@aopslabs/aops",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "type": "module",
5
5
  "description": "AOPS CLI and terminal setup application.",
6
- "aopsDockerServerVersion": "0.2.9",
6
+ "aopsDockerServerVersion": "0.2.11",
7
7
  "license": "SEE LICENSE IN LICENSE",
8
8
  "repository": {
9
9
  "type": "git",
@@ -32,6 +32,8 @@
32
32
  "test:commercial-managed-postgres-docker-effects": "node --test test/commercial-managed-postgres-docker-effects.test.mjs",
33
33
  "test:existing-postgres-statement-log-effects": "node --test test/existing-postgres-statement-log-effects.test.mjs",
34
34
  "test:chatv3-keyring-parameter-log-effects": "node --test test/chatv3-keyring-parameter-log-effects.test.mjs",
35
+ "test:chatv3-session-store": "node --test test/chatv3-session-store.test.mjs",
36
+ "test:projectman-review-evidence": "node --test test/projectman-review-evidence.test.mjs",
35
37
  "test:commercial-lifecycle-scale-effects": "node --test test/commercial-lifecycle-scale-effects.test.mjs",
36
38
  "test:commercial-lifecycle-managed-effects": "node --test test/commercial-lifecycle-managed-effects.test.mjs",
37
39
  "test:commercial-lifecycle-negative-effects": "node --test test/commercial-lifecycle-negative-effects.test.mjs",
@@ -51,12 +53,12 @@
51
53
  "test:hosted-contract-hardening": "node --test test/hosted-contract-hardening.test.mjs",
52
54
  "test:home": "node --test test/home-menu.test.mjs",
53
55
  "test:launchers": "node --test test/terminal-launchers.test.mjs",
54
- "test:shortcuts": "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: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: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",
56
+ "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: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: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",
55
57
  "typecheck": "tsc -p tsconfig.json --noEmit",
56
58
  "start": "node dist/main.js"
57
59
  },
58
60
  "dependencies": {
59
- "@aopslabs/aops-server": "0.2.9",
61
+ "@aopslabs/aops-server": "0.2.11",
60
62
  "@aopslabs/artifact-trust-contracts": "0.3.1",
61
63
  "@aopslabs/cli-kit": "0.1.0",
62
64
  "@aopslabs/aops-host-registration": "0.2.1",
@@ -1,49 +0,0 @@
1
- ---
2
- name: aops-cli-chatv3
3
- description: Use for encrypted ChatV3 product channels, invitations, local session context, membership, presence, epochs, and message operations through the AOPS CLI.
4
- ---
5
-
6
- # ChatV3
7
-
8
- Use `aops chatv3` for product-facing encrypted channel/session operations.
9
- This is different from `aops chat`, which owns hosted agent coordination,
10
- wakes, inbox cursors, and room bindings.
11
-
12
- Read only the relevant section of `../../user-guides/chatv3.md`. Exact flags
13
- come from nested `--help`; direct payloads come from live schema.
14
-
15
- ## Common entry points
16
-
17
- ```bash
18
- aops chatv3 --help
19
- aops chatv3 channel --help
20
- aops chatv3 session --help
21
- aops chatv3 member --help
22
- aops chatv3 send --help
23
- aops chatv3 read --help
24
- ```
25
-
26
- Typical discovery and read flow:
27
-
28
- ```bash
29
- aops chatv3 session list --json
30
- aops chatv3 channels --json
31
- aops agent tools --domain chatv3 --summary --json
32
- aops agent schema --tool chatv3.channel.list --summary --json
33
- ```
34
-
35
- ChatV3 may keep invite, member-token, and room-key context in a private local
36
- session store. Never paste those values into chat, logs, source files, or raw
37
- shell history. Use supported secure-store, input-file, or environment
38
- mechanisms; the CLI does not collect secrets through terminal prompts.
39
-
40
- For a write not exposed by sugar, inspect the exact live schema before invoke:
41
-
42
- ```bash
43
- aops agent schema --tool chatv3.<operation> --summary --json
44
- aops agent invoke --tool chatv3.<operation> --input '@payload.json' --preview --json
45
- ```
46
-
47
- Do not use ChatV3 as the durable Projectman review record or the structured
48
- `discuss` transcript. Link or summarize outcomes into the correct owner when
49
- durability matters.
@@ -1,64 +0,0 @@
1
- ---
2
- name: aops-cli-chat
3
- description: Use for hosted Agentspace coordination rooms and direct messages, membership, bindings, messages, inbox/listen/catchup cursors, manifests, and agent onboarding briefs.
4
- ---
5
-
6
- # Hosted AOPS chat
7
-
8
- `aops chat` is the coordination and wake channel for agents/operators. It is
9
- not ChatV3 encrypted product messaging, the structured `discuss` transcript,
10
- or the Projectman review record.
11
-
12
- Deep semantics and troubleshooting are in the hosted-chat sections of
13
- `../../user-guides/agentspace.md`.
14
-
15
- ## Room lifecycle
16
-
17
- ```bash
18
- aops chat --help
19
- aops chat room list --json
20
- aops chat room create --slug <slug> --title "<purpose>" \
21
- --created-by <agent> --member "<agent>:<role>" --apply --json
22
- aops chat room get --id <id> --json
23
- aops chat room brief --room-id <id> --for <agent>
24
- aops chat room manifest --room-id <id> --json
25
- ```
26
-
27
- Use stable agent/operator identities and explicit role keys. Room closeout is
28
- operator-controlled; ordinary task completion should not silently close it.
29
-
30
- ## Bind durable references
31
-
32
- ```bash
33
- aops chat binding add --room-id <id> \
34
- --binding-type projectman.board --ref-id <board-id> \
35
- --title "PM board" --created-by <agent> --apply --json
36
- aops chat room manifest --room-id <id> --json
37
- ```
38
-
39
- Bindings orient participants; they do not move canonical truth out of
40
- Projectman, Docman, or Agentspace.
41
-
42
- ## Messages and unread work
43
-
44
- ```bash
45
- aops chat message send --help
46
- aops chat inbox --for <agent> --json
47
- aops chat listen --for <agent> --room-id <id> \
48
- --timeout-sec 570 --interval-sec 15 --json
49
- aops chat catchup --for <agent> --room-id <id> --apply --summary --json
50
- ```
51
-
52
- Send a message to wake/coordinate a peer, then use Projectman for review status
53
- or Discuss for a decision stance. Read cursors are per participant; acknowledge
54
- directives and advance cursors only after processing the message.
55
-
56
- ## Schema fallback
57
-
58
- ```bash
59
- aops agent tools --domain agentspace --q chat --limit 20 --summary --json
60
- aops agent schema --tool agentspace.chat-message.send --summary --json
61
- ```
62
-
63
- Do not guess member, cursor, or binding payloads. Never put database passwords,
64
- auth tokens, or ChatV3 room keys into hosted room messages.