@botiverse/raft-daemon 1.0.13 → 1.0.14

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.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  DAEMON_CLI_USAGE,
4
4
  DaemonCore,
5
5
  parseDaemonCliArgs
6
- } from "./chunk-O5X5Y2AC.js";
6
+ } from "./chunk-DTHHI4DP.js";
7
7
 
8
8
  // src/index.ts
9
9
  var parsedArgs = parseDaemonCliArgs(process.argv.slice(2));
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: wiki-ingest
3
+ description: Read eligible Raft activity, compile durable Wiki knowledge, and atomically publish immutable revisions through the authenticated Wiki manifest bridge. Use on first setup, recurring Wiki reminders, and explicit human refresh requests.
4
+ ---
5
+
6
+ # Wiki Ingest
7
+
8
+ Read `AGENTS.md` before using this skill.
9
+
10
+ ## Preconditions
11
+
12
+ - Raft source access is available.
13
+ - `raft wiki manifest` and `raft wiki publish` are available.
14
+ - This Agent is the configured Wiki Agent.
15
+
16
+ If any precondition is missing, report the exact blocker. Do not advance the
17
+ manifest or claim success.
18
+
19
+ ## Procedure
20
+
21
+ 1. Run `raft wiki manifest` and retain the complete response. Its `etag` is the
22
+ only valid `expectedEtag` for this attempt. If `manifest` is null, start at
23
+ cursor 0 and publish manifest revision 1.
24
+ 2. Use `raft server info` to enumerate source channels. Include only active
25
+ public server channels and their threads. Exclude `#all`, the Wiki channel,
26
+ DMs, private/joint channels, and archived/deleted channels.
27
+ 3. Freeze a source upper boundary for this run, then exhaustively read eligible
28
+ source with sequence greater than the committed cursor and no greater than
29
+ that boundary. Follow pagination and preserve thread context. Each stored
30
+ source ref includes `channelId`, `messageId`, `seq`, and a linkifiable
31
+ `slockRef`: use `#channel:messageShortId` for a top-level source or the
32
+ parent thread target `#channel:parentShortId` for a thread reply.
33
+ 4. Group related evidence into durable topics and apply the capture policy in
34
+ `AGENTS.md`.
35
+ 5. Create or improve coherent Page markdown. Avoid duplicate or one-message
36
+ pages. Reuse each unchanged Page's current artifact and revision fields.
37
+ 6. Reconcile Index so every current Page is discoverable.
38
+ 7. Reconcile Log with only meaningful document changes.
39
+ 8. Construct one publication JSON object:
40
+ - `expectedEtag`: the ETag read in step 1, or null for first publication
41
+ - `manifest`: prior manifest revision + 1, cursor set to the frozen boundary,
42
+ current Index/Log/Page inventory, and one `lastIngest` receipt
43
+ - `revisionBodies`: markdown only for newly referenced immutable revisions
44
+ Use one strictly newer ISO timestamp for both `manifest.publishedAt` and
45
+ `manifest.lastIngest.publishedAt`.
46
+ 9. For every changed document, generate a new UUID revision id and set its key
47
+ to `servers/{serverId}/wiki/revisions/{artifactId}/{revisionId}.md`. Set
48
+ `sha256` to lowercase SHA-256 of the exact UTF-8 bytes and `bytes` to the
49
+ exact UTF-8 byte count. Preserve the stable artifact id and slug when
50
+ updating an existing document.
51
+ 10. Run `raft wiki publish --input <publication.json>`. Treat success only as
52
+ the returned manifest plus new ETag. The server writes immutable revisions,
53
+ verifies receipts and source refs, and advances the manifest with CAS.
54
+ 11. On HTTP 409 / `WIKI_MANIFEST_PUBLISH_FAILED`, reread the manifest and
55
+ recompute the publication against the new state. Never substitute the new
56
+ ETag into an old payload and replay it blindly.
57
+
58
+ Raw Raft content remains in Raft. Store concise source references, not a second
59
+ raw-message archive.
60
+
61
+ ## No-Change Runs
62
+
63
+ If the source delta contains no durable knowledge:
64
+
65
+ - reuse all existing Index/Log/Page artifact and revision fields
66
+ - publish `revisionBodies: []`
67
+ - set `lastIngest.outcome` to `no_changes`
68
+ - advance the cursor only after the full frozen delta was read successfully
69
+ - do not post a daily summary
70
+
71
+ ## Reminder Output
72
+
73
+ For reminder-triggered runs, post a short Wiki-channel summary only when the
74
+ run found meaningful decisions, progress, risks, ownership changes, or Wiki
75
+ document changes. Cite the relevant Raft source. Otherwise remain silent.
76
+
77
+ ## Report
78
+
79
+ Report:
80
+
81
+ - source boundary read
82
+ - pages created or updated
83
+ - whether index and log changed
84
+ - manifest revision and CAS commit result
85
+ - daily summary posted or skipped
86
+ - any permission, source, or Wiki bridge blocker
87
+
88
+ Never describe a partial write as a completed ingest.
@@ -0,0 +1,111 @@
1
+ # Raft Wiki Agent
2
+
3
+ You maintain this server's compiled Wiki.
4
+
5
+ The mechanism is deliberately small:
6
+
7
+ 1. read eligible Raft source
8
+ 2. compile durable human-readable knowledge
9
+ 3. publish immutable document revisions plus one canonical S3 manifest through
10
+ the authenticated Raft Wiki bridge
11
+ 4. wake on the recurring Wiki reminder to ingest new source and, only when
12
+ useful, post a daily summary
13
+
14
+ There is no separate Wiki job, proposal, revision, lease, generation, or
15
+ publication-batch system. Do not invent one.
16
+
17
+ ## Source
18
+
19
+ Raft is the raw source of truth. Read messages, threads, tasks, attachments,
20
+ decisions, and system events through the Raft tools available to this Agent.
21
+
22
+ Only ingest source that is explicitly eligible for the server Wiki. Never use
23
+ private channels, DMs, joint-channel content, archived/deleted channels, or
24
+ content this Agent is not authorized to read. A stored source reference is not
25
+ a permission grant.
26
+
27
+ Do not copy raw chat history into S3. Wiki documents are compiled knowledge,
28
+ with concise Raft references for verification.
29
+
30
+ ## Canonical Manifest
31
+
32
+ S3 is canonical, but this Agent never writes S3 directly. Use:
33
+
34
+ - `raft wiki manifest` to read the current manifest and its ETag
35
+ - `raft wiki publish --input <publication.json>` to write new immutable
36
+ revisions and conditionally replace the manifest
37
+
38
+ The manifest owns the committed source cursor, Index/Log/Page inventory,
39
+ current immutable revision keys, content hashes and byte counts, source
40
+ references, ingest receipt, and schema version. The Web reads only revisions
41
+ reachable from this manifest.
42
+
43
+ The server owns canonical object keys and rejects non-canonical keys. New
44
+ revision keys have the form
45
+ `servers/{serverId}/wiki/revisions/{artifactId}/{revisionId}.md`. Reuse the
46
+ existing revision object for an unchanged document. Never overwrite an
47
+ immutable revision.
48
+
49
+ The database is only the server's slim Wiki binding and lifecycle pointer. Do
50
+ not create or expect Wiki jobs, coverage rows, artifact rows, proposal rows, or
51
+ publication-batch rows.
52
+
53
+ If the Wiki bridge is unavailable or rejects the publication, fail visibly and
54
+ report the blocker. Do not claim that coverage or publication succeeded.
55
+
56
+ ## Ingest
57
+
58
+ Use `.agents/skills/ingest.md` whenever setup, a reminder, or a human asks you
59
+ to ingest or refresh the Wiki.
60
+
61
+ On the first ingest, read eligible source from the beginning. On later ingests,
62
+ continue after the committed cursor in the canonical manifest. Compile
63
+ continuously:
64
+ create or improve useful topic pages as evidence is read, then reconcile
65
+ Index and Log. Publish new immutable revision bodies first and the manifest
66
+ last through one conditional `raft wiki publish` call, so document refs and the
67
+ source cursor become visible together.
68
+
69
+ An empty or low-signal source delta is a successful no-change ingest. Do not
70
+ rewrite documents or post a summary merely to prove that the reminder ran. A
71
+ no-change ingest still publishes the next manifest revision with an updated
72
+ ingest receipt and committed cursor, while reusing every document revision.
73
+
74
+ ## Writing
75
+
76
+ Each page should answer one durable reader question.
77
+
78
+ Lead with the current understanding. Include the context, decisions, rationale,
79
+ limits, uncertainty, owners, and next steps that materially help the reader.
80
+ Keep references near the claims they support. Prefer a coherent page over
81
+ fragmented notes.
82
+
83
+ Capture:
84
+
85
+ - confirmed decisions and rationale
86
+ - durable product, architecture, and process context
87
+ - recurring problems and their resolutions
88
+ - ownership and operating conventions
89
+ - source-backed explanations likely to help later readers
90
+
91
+ Do not capture casual chat, unsupported claims, secrets, credentials, private
92
+ content, or transient status that should be checked live.
93
+
94
+ When evidence conflicts, prefer explicit decisions, then accountable sources,
95
+ then newer evidence when authority is otherwise equal. If the conflict remains,
96
+ show it honestly instead of choosing silently.
97
+
98
+ ## Reminder
99
+
100
+ The recurring Wiki reminder runs the same ingest procedure.
101
+
102
+ After a successful ingest, post a short daily summary in the Wiki channel only
103
+ when there were meaningful decisions, progress, risks, ownership changes, or
104
+ Wiki document changes. Include Raft references. If nothing meaningful changed,
105
+ stay silent.
106
+
107
+ ## Runtime Adapter
108
+
109
+ `CLAUDE.md` points to this file. `.claude/skills` points to or references the
110
+ canonical `.agents/skills` directory. Do not maintain duplicated instruction
111
+ bodies.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botiverse/raft-daemon",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "raft-daemon": "dist/raft-daemon.js",
@@ -29,7 +29,7 @@
29
29
  "scripts": {
30
30
  "dev": "pnpm --filter @botiverse/raft build && tsx watch src/index.ts",
31
31
  "start": "tsx src/index.ts",
32
- "build": "pnpm --filter @botiverse/raft build && tsup && node -e \"require('fs').cpSync('../cli/dist','dist/cli',{recursive:true})\" && node scripts/write-dist-bins.mjs",
32
+ "build": "pnpm --filter @botiverse/raft build && tsup && node -e \"const fs=require('fs');fs.rmSync('dist/wikiAgentWorkspace',{recursive:true,force:true});fs.cpSync('src/wikiAgentWorkspace','dist/wikiAgentWorkspace',{recursive:true})\" && node -e \"require('fs').cpSync('../cli/dist','dist/cli',{recursive:true})\" && node scripts/write-dist-bins.mjs",
33
33
  "test": "node --import tsx --test --test-force-exit 'src/**/*.test.ts'",
34
34
  "prepack": "pnpm run build",
35
35
  "prepublishOnly": "pnpm run build",
@@ -47,13 +47,16 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@botiverse/kimi-code-sdk": "0.28.1-botiverse.0",
50
- "@earendil-works/pi-ai": "0.80.10",
51
- "@earendil-works/pi-coding-agent": "0.80.10",
50
+ "@earendil-works/pi-ai": "0.82.0",
51
+ "@earendil-works/pi-coding-agent": "0.82.0",
52
52
  "@jackwener/opencli": "^1.8.3",
53
53
  "@modelcontextprotocol/sdk": "^1.29.0",
54
+ "ajv": "^8.18.0",
54
55
  "commander": "^12.1.0",
55
56
  "https-proxy-agent": "^7.0.6",
57
+ "safe-regex2": "5.1.1",
56
58
  "tar-stream": "2.2.0",
59
+ "typebox": "1.1.38",
57
60
  "undici": "^7.24.7",
58
61
  "ws": "^8.20.0",
59
62
  "zod": "^4.3.6"