cccc-sdk 0.4.4 → 0.4.40

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 (58) hide show
  1. package/README.md +252 -16
  2. package/dist/client.d.ts +87 -163
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +663 -536
  5. package/dist/client.js.map +1 -1
  6. package/dist/client_0430_admin_ops.d.ts +56 -0
  7. package/dist/client_0430_admin_ops.d.ts.map +1 -0
  8. package/dist/client_0430_admin_ops.js +143 -0
  9. package/dist/client_0430_admin_ops.js.map +1 -0
  10. package/dist/client_0430_assistant_ops.d.ts +106 -0
  11. package/dist/client_0430_assistant_ops.d.ts.map +1 -0
  12. package/dist/client_0430_assistant_ops.js +122 -0
  13. package/dist/client_0430_assistant_ops.js.map +1 -0
  14. package/dist/client_0430_memory_ops.d.ts +14 -0
  15. package/dist/client_0430_memory_ops.d.ts.map +1 -0
  16. package/dist/client_0430_memory_ops.js +84 -0
  17. package/dist/client_0430_memory_ops.js.map +1 -0
  18. package/dist/client_0430_ops.d.ts +8 -0
  19. package/dist/client_0430_ops.d.ts.map +1 -0
  20. package/dist/client_0430_ops.js +9 -0
  21. package/dist/client_0430_ops.js.map +1 -0
  22. package/dist/client_0430_shared.d.ts +15 -0
  23. package/dist/client_0430_shared.d.ts.map +1 -0
  24. package/dist/client_0430_shared.js +4 -0
  25. package/dist/client_0430_shared.js.map +1 -0
  26. package/dist/client_0434_ops.d.ts +10 -0
  27. package/dist/client_0434_ops.d.ts.map +1 -0
  28. package/dist/client_0434_ops.js +43 -0
  29. package/dist/client_0434_ops.js.map +1 -0
  30. package/dist/client_chat_ops.d.ts +28 -0
  31. package/dist/client_chat_ops.d.ts.map +1 -0
  32. package/dist/client_chat_ops.js +213 -0
  33. package/dist/client_chat_ops.js.map +1 -0
  34. package/dist/client_connect_ops.d.ts +9 -0
  35. package/dist/client_connect_ops.d.ts.map +1 -0
  36. package/dist/client_connect_ops.js +44 -0
  37. package/dist/client_connect_ops.js.map +1 -0
  38. package/dist/client_group_space_ops.d.ts +24 -0
  39. package/dist/client_group_space_ops.d.ts.map +1 -0
  40. package/dist/client_group_space_ops.js +167 -0
  41. package/dist/client_group_space_ops.js.map +1 -0
  42. package/dist/errors.d.ts +17 -1
  43. package/dist/errors.d.ts.map +1 -1
  44. package/dist/errors.js +26 -1
  45. package/dist/errors.js.map +1 -1
  46. package/dist/index.d.ts +4 -4
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +3 -3
  49. package/dist/index.js.map +1 -1
  50. package/dist/transport.d.ts +4 -3
  51. package/dist/transport.d.ts.map +1 -1
  52. package/dist/transport.js +236 -120
  53. package/dist/transport.js.map +1 -1
  54. package/dist/types.d.ts +752 -89
  55. package/dist/types.d.ts.map +1 -1
  56. package/dist/types.js +7 -3
  57. package/dist/types.js.map +1 -1
  58. package/package.json +3 -3
package/README.md CHANGED
@@ -5,7 +5,7 @@ TypeScript/Node.js client for the CCCC daemon (IPC v1).
5
5
  ## Relationship to CCCC core
6
6
 
7
7
  - CCCC core repository: https://github.com/ChesterRa/cccc
8
- - `cccc` core provides daemon/web/CLI and owns runtime state.
8
+ - `cccc` core provides one native Rust daemon/web/CLI product and owns runtime state.
9
9
  - `cccc-sdk` provides Node.js client APIs that call the daemon over IPC.
10
10
 
11
11
  ## Installation
@@ -14,7 +14,9 @@ TypeScript/Node.js client for the CCCC daemon (IPC v1).
14
14
  npm install cccc-sdk
15
15
  ```
16
16
 
17
- Compatibility is determined by Daemon IPC v1 contracts and operation probing, not by strict package-version matching.
17
+ Compatibility is determined by Daemon IPC v1 contracts and operation probing,
18
+ not by strict package-version matching. The current message contract is an
19
+ intentional atomic cut: upgrade SDK and daemon together.
18
20
 
19
21
  ## Quick start
20
22
 
@@ -26,34 +28,50 @@ async function main() {
26
28
 
27
29
  await client.assertCompatible({
28
30
  requireIpcV: 1,
29
- requireCapabilities: { events_stream: true },
30
31
  requireOps: ['groups', 'send', 'reply', 'tracked_send', 'context_sync'],
31
32
  });
32
33
 
33
- const group = await client.groupCreate({ title: 'TS demo' });
34
- const groupId = group.group.group_id;
34
+ // Use an existing Group and an Agent ID from that Group.
35
+ const groupId = 'g_your_group_id';
35
36
 
36
37
  await client.send({
37
38
  groupId,
38
39
  text: 'Please check this and reply.',
39
- priority: 'attention',
40
- replyRequired: true,
40
+ mode: 'request_reply',
41
+ to: ['peer-1'],
41
42
  });
42
43
  }
43
44
 
44
- main().catch(console.error);
45
+ main().catch(error => {
46
+ console.error(error);
47
+ process.exitCode = 1;
48
+ });
45
49
  ```
46
50
 
47
51
  ## Message semantics
48
52
 
49
- - `priority`: `'normal' | 'attention'`
50
- - `replyRequired`: `boolean` (maps to daemon `reply_required`)
53
+ - `mode`: `'mail' | 'send' | 'request_reply'` (required for new messages)
54
+ - `insight`: optional visible, provisional sender perspective for independent recipient judgment
55
+ - `suggestedUserMessage`: optional proposed next human message; stored visibly and never auto-sent
51
56
 
52
57
  Supported in:
53
58
  - `send(options)`
54
- - `reply(options)`
55
59
  - `sendCrossGroup(options)`
56
- - `trackedSend(options)`
60
+
61
+ `mail` stores without an immediate runtime prompt, `send` performs a
62
+ best-effort immediate Push, and `request_reply` adds a concrete reply request.
63
+ `reply(options)` defaults to Send and accepts `mode: 'mail'` for an agent-only,
64
+ non-urgent reply; both modes fulfill the original reply request. The visible
65
+ message emitted by `trackedSend(options)` remains Send. Generic ACK operations no longer exist; consume Inbox contents
66
+ with `inboxRead(options)`. Inbox contains only Mail; inspect past direct or Mail
67
+ traffic without changing the Mail cursor through `messageHistory(options)`.
68
+
69
+ `suggestedUserMessage` is supported by `send(options)` and `reply(options)`.
70
+
71
+ `contextGet(groupId, detail)` accepts `overview`, `summary`, or `full`.
72
+ `taskList(options)` supports exact batches, filters, atomic status pages, and
73
+ pagination. `groupSpaceSync(options)` is a read-only legacy-status call; use
74
+ explicit ingest/source operations for mutations.
57
75
 
58
76
  ## Workflow helpers
59
77
 
@@ -64,6 +82,7 @@ await client.trackedSend({
64
82
  groupId,
65
83
  title: 'Update SDK',
66
84
  text: 'Please handle the compatibility update.',
85
+ insight: 'The compatibility plan may preserve an obsolete boundary.',
67
86
  outcome: 'Tests and live compat pass',
68
87
  assignee: 'peer-impl',
69
88
  });
@@ -88,6 +107,7 @@ const hits = await client.memorySearch({
88
107
  actorId: 'dingtalk-worker',
89
108
  query: 'How should I reply to this message?',
90
109
  limit: 5,
110
+ minScore: 0.2,
91
111
  target: 'memory',
92
112
  });
93
113
  await client.memoryWrite({
@@ -103,6 +123,8 @@ await client.memoryWrite({
103
123
 
104
124
  Local memory helpers use daemon `memory_*` ops and are intended for fast local
105
125
  CCCC memory access. They do not depend on Group Space / NotebookLM bindings.
126
+ For raw ReMe result shapes or source selection, use `memoryRemeSearch` and
127
+ `memoryRemeGet`. See `spec/SDK_LOCAL_MEMORY_API.md` in the repository root.
106
128
 
107
129
  ## Automation semantics
108
130
 
@@ -134,12 +156,10 @@ const client = await CCCCClient.create();
134
156
 
135
157
  const upsert = await client.actorProfileUpsert({
136
158
  profile: {
137
- name: 'Codex PTY',
159
+ name: 'Codex',
138
160
  runtime: 'codex',
139
- runner: 'pty',
140
- command: ['codex', 'exec'],
161
+ command: ['codex'],
141
162
  submit: 'enter',
142
- env: { CODEX_MODEL: 'gpt-5' },
143
163
  capabilityDefaults: {
144
164
  autoloadCapabilities: ['pack:space'],
145
165
  defaultScope: 'actor',
@@ -193,6 +213,194 @@ await client.contextSync({
193
213
 
194
214
  If you need a daemon op that does not have a dedicated helper yet, you can always fall back to `call()` / `callRaw()`.
195
215
 
216
+ ## Current native-daemon compatibility surface
217
+
218
+ ```typescript
219
+ // Capture the bounded ANSI screen and exact raw cursor boundary.
220
+ const snapshot = await client.terminalSnapshot({
221
+ groupId,
222
+ actorId: 'web-model',
223
+ limitBytes: 512_000,
224
+ });
225
+
226
+ // Read or change the durable delivery mode for a Web Model actor.
227
+ const preference = await client.webModelDeliveryPreferencesGet({
228
+ groupId,
229
+ actorId: 'web-model',
230
+ });
231
+ await client.webModelDeliveryPreferencesUpdate({
232
+ groupId,
233
+ actorId: 'web-model',
234
+ mode: 'image_compat',
235
+ });
236
+
237
+ // Inspect a committed legacy turn without moving the actor cursor.
238
+ const recovered = await client.webModelRuntimeRecoverTurn({
239
+ groupId,
240
+ actorId: 'web-model',
241
+ eventIds: ['e_xxx'],
242
+ });
243
+ ```
244
+
245
+ `termResize()` sends the standard `term_resize` operation. For older compatible
246
+ daemon builds that expose `terminal_resize`, the SDK falls back only
247
+ after receiving a structured `unknown_op`; transport failures are never
248
+ replayed, and the legacy result is normalized to the standard shape.
249
+ Auto-discovered clients re-read `ccccd.addr.json` when connection
250
+ establishment fails before any request bytes are sent. Explicit endpoints are
251
+ never replaced.
252
+
253
+ This alignment pass also corrects the exact ReMe, global Remote Access,
254
+ group-scoped IM authorization, Voice model installation, group-copy, and chat
255
+ wire fields. `capabilitySourceDelete()` is deliberately source-scoped: the
256
+ current daemon does not implement instance-scoped deletion and callers should
257
+ not assume otherwise.
258
+
259
+ ## CCCC 0.4.33 compatibility delta
260
+
261
+ ```typescript
262
+ // Deliberately rotate provider session metadata for Claude, Codex and Grok.
263
+ await client.actorNewSession(groupId, 'reviewer');
264
+
265
+ // Page through retained PTY output by cursor.
266
+ const page = await client.terminalHistory({
267
+ groupId,
268
+ actorId: 'reviewer',
269
+ limitBytes: 64_000,
270
+ });
271
+
272
+ // Large group copies use a daemon-local package path instead of base64 IPC.
273
+ const exported = await client.groupCopyExportFile({ groupId });
274
+ const packagePath = String(exported.package_path);
275
+ const preview = await client.groupCopyPreviewImport({ packagePath });
276
+ const copied = await client.groupCopyImport({ packagePath });
277
+
278
+ // Manage the startup body delivered to the next fresh provider session.
279
+ await client.groupPreambleSet({
280
+ groupId,
281
+ content: 'This initialization is not a task. Wait for the targeted mission.\n',
282
+ });
283
+ const preamble = await client.groupPreambleGet({ groupId });
284
+ await client.groupPreambleReset({ groupId, confirm: 'preamble' });
285
+
286
+ // Upload active-scope files and append one message with daemon-owned attachments.
287
+ await client.sendFiles({
288
+ groupId,
289
+ paths: ['reference.png', 'candidate.png'],
290
+ text: 'Inspect these files',
291
+ to: ['reviewer'],
292
+ });
293
+
294
+ // Current terminal operations.
295
+ const recent = await client.terminalSince({ groupId, actorId: 'reviewer', after: 0 });
296
+ await client.termResize({ groupId, actorId: 'reviewer', cols: 120, rows: 40 });
297
+ ```
298
+
299
+ A changed preamble applies on its next delivery; it is not reinjected into a
300
+ session that already received one. `groupReset` creates a new group id and
301
+ does not carry the override forward. If the preamble establishes a standby
302
+ boundary, wait until the actor returns to `waiting` or `idle` before sending
303
+ the authoritative mission. `sendFiles` accepts only regular files beneath
304
+ the group's active scope and validates every path before appending the message.
305
+
306
+ `events_stream` compatibility is verified by probing the operation itself;
307
+ the SDK does not rely only on the daemon's advertised capability flag.
308
+
309
+ `groupReset` is destructive: it creates a clean replacement and removes the
310
+ old group after copying selected configuration. `confirmGroupId` must equal
311
+ `groupId`:
312
+
313
+ ```typescript
314
+ await client.groupReset({ groupId, confirmGroupId: groupId });
315
+ ```
316
+
317
+ ## CCCC 0.4.18 surface — Hermes runtime and Voice Secretary lease
318
+
319
+ ```typescript
320
+ // Hermes runtime setup diagnostics and MCP preparation
321
+ const status = await client.runtimeHermesStatus();
322
+ await client.runtimeHermesPrepare({ cwd: '.', autoEnableTools: true });
323
+ await client.runtimeHermesMcpTest({ groupId, actorId: 'hermes-1' });
324
+
325
+ // Cross-tab Voice Secretary recording guard
326
+ const lease = await client.assistantVoiceRecordingLease({
327
+ groupId,
328
+ action: 'acquire',
329
+ ownerId: 'browser-tab-1',
330
+ ttlSeconds: 30,
331
+ });
332
+ ```
333
+
334
+ ## CCCC 0.4.17 surface — new op families
335
+
336
+ ```typescript
337
+ const client = await CCCCClient.create();
338
+
339
+ // Tracked delegation — atomic task.create + send with idempotent replay
340
+ const tracked = await client.trackedSend({
341
+ groupId,
342
+ title: 'Fix login race',
343
+ text: 'Please pick this up — see issue link',
344
+ insight: 'The proposed fix may target the symptom rather than the ownership boundary.',
345
+ to: ['alice'],
346
+ idempotencyKey: 'fix-login-race-1',
347
+ refs: [{ kind: 'url', url: 'https://example.com/issue/42' }],
348
+ });
349
+
350
+ // Per-task drill-down
351
+ const task = await client.taskList({ groupId, taskId: String(tracked.task_id) });
352
+
353
+ // Structured refs on chat
354
+ await client.send({
355
+ groupId,
356
+ text: 'Looking at the demo deck',
357
+ insight: 'The deck may make the current option set look more settled than it is.',
358
+ refs: [{ kind: 'presentation_ref', slot_id: 'slot-1' }],
359
+ });
360
+
361
+ // Presentation workspace (slot-based viewer)
362
+ await client.presentationPublish({
363
+ groupId,
364
+ slot: 'slot-1',
365
+ title: 'Plan',
366
+ cardType: 'markdown',
367
+ content: '# Sprint plan\n- ...',
368
+ });
369
+
370
+ // Built-in Voice Secretary lifecycle
371
+ await client.assistantSettingsUpdate({
372
+ groupId,
373
+ assistantId: 'voice_secretary',
374
+ patch: { enabled: true },
375
+ });
376
+
377
+ // Copy a group for migration / backup
378
+ const pkg = await client.groupCopyExport({ groupId });
379
+ const newGroup = await client.groupCopyImport({ packageB64: String(pkg.package_b64) });
380
+
381
+ // Headless runtime control
382
+ await client.headlessSetStatus({ groupId, actorId: 'reviewer', status: 'working' });
383
+
384
+ // Capability Center extensions
385
+ await client.capabilityInstallTarget({
386
+ groupId,
387
+ target: 'github:owner/repo',
388
+ actorId: 'reviewer',
389
+ scope: 'session',
390
+ ttlSeconds: 600,
391
+ });
392
+
393
+ // Operator-side: terminal tail, ledger snapshot, branding/observability
394
+ await client.terminalTail({ groupId, actorId: 'reviewer', maxChars: 4000 });
395
+ await client.ledgerSnapshot({ groupId, reason: 'manual' });
396
+ await client.brandingUpdate({ patch: { product_name: 'My CCCC' } });
397
+ ```
398
+
399
+ Use `call()` for intentionally low-level or newly added non-streaming ops that
400
+ do not yet have a dedicated helper. Duplex browser/VNC/PTY attach operations
401
+ remain outside this request/response client and require a separate streaming
402
+ transport contract. See `spec/ADAPTATION_PLAN.md` for the exact boundary.
403
+
196
404
  ## Events stream
197
405
 
198
406
  ```typescript
@@ -219,3 +427,31 @@ npm run build
219
427
  ## License
220
428
 
221
429
  Apache-2.0
430
+
431
+ ## CCCC 0.4.40 alignment
432
+
433
+ All three SDK package versions are 0.4.40; `spec/core.json` records the supported
434
+ core revision. The matching release number is not a replacement for IPC and
435
+ capability checks.
436
+
437
+ Qualified Connect sends require a stable caller-owned retry key:
438
+
439
+ ```ts
440
+ await client.connectSend({ groupId: 'local', instanceId: 'remote-instance', targetGroupId: 'remote-group',
441
+ clientId: 'retained-caller-key', text: 'Please review', mode: 'mail' });
442
+ ```
443
+
444
+ Use `connect_catalog` / `connectCatalog` to read authorized cached peers and
445
+ `connect_send_files` / `connectSendFiles` to send files from the daemon's project
446
+ scope. Accepted means queued locally, not confirmed delivery. Keep the same key
447
+ and body after an uncertain result; the SDK never automatically replays a send.
448
+ Connect replies use the local received event ID with the ordinary reply helper.
449
+
450
+ `context_sync(if_version=...)` / `contextSync({ ifVersion })` rejects stale
451
+ updates with `version_conflict`. Reload before deciding whether to reapply.
452
+ Terminal history accepts `render_before` / `renderBefore` alongside `before`.
453
+
454
+ Compatibility requirements that lack an advertised capability and an audited
455
+ safe probe now fail instead of being executed or silently skipped. Retired
456
+ Presentation browser and Voice model-install helpers fail locally with migration
457
+ guidance; their interactive replacement belongs to CCCC Web, not daemon IPC.