@ted-galago/wave-cli 0.1.17 → 0.1.19

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/README.md CHANGED
@@ -129,6 +129,7 @@ wave osmd agent read "projects/Wave Tools" notes.md
129
129
  wave osmd agent create "projects/Wave Tools" notes.md --content "Working notes"
130
130
  wave osmd wiki read index.md
131
131
  wave osmd wiki read log.md
132
+ wave osmd wiki init
132
133
  wave osmd wiki create index.md --content "# Agent Wiki"
133
134
  wave osmd wiki update "Agent Wiki/index.md" --file ./agent-wiki-index.md
134
135
  wave osmd wiki append-log --content "Observed durable event"
@@ -315,6 +316,7 @@ Commands:
315
316
  - `wave osmd agent create <parent-ref> notes.md (--content <markdown> | --file <path> | stdin)`
316
317
  - `wave osmd agent update <parent-ref> notes.md (--content <markdown> | --file <path> | stdin)`
317
318
  - `wave osmd wiki status <path>`
319
+ - `wave osmd wiki init`
318
320
  - `wave osmd wiki read <path>`
319
321
  - `wave osmd wiki children [path]`
320
322
  - `wave osmd wiki create <path> (--content <markdown> | --file <path> | stdin)`
@@ -327,6 +329,7 @@ GraphQL mapping:
327
329
  - `osmd read` / `osmd agent read` / `osmd wiki read` -> `agentMarkdownFile`
328
330
  - `osmd children` / `osmd wiki children` -> `agentMarkdownChildren`
329
331
  - `osmd agent init` -> `initAgentMarkdown`
332
+ - `osmd wiki init` -> `initAgentMarkdown` with backend path `Agent Wiki`
330
333
  - `osmd agent create` / `osmd wiki create` -> `createAgentMarkdownFile`
331
334
  - `osmd agent update` / `osmd wiki update` -> `updateAgentMarkdownFile`
332
335
  - `osmd wiki append-log` -> `recordAgentMarkdownLog`
@@ -341,17 +344,63 @@ Path and permission rules:
341
344
  - Agent Wiki index paths may be `index.md` or `Agent Wiki/index.md`; the CLI normalizes these to `Agent Wiki/index.md`.
342
345
  - Agent Wiki log paths may be `log.md` or `Agent Wiki/log.md`; the CLI normalizes these to `Agent Wiki/log.md`.
343
346
  - Agent Wiki first-slice agents should use `index.md` for broad writable wiki memory and `log.md` for append-only event memory.
347
+ - Agent Wiki `init` initializes backend-owned system files, including append-only `log.md`, through `initAgentMarkdown` at path `Agent Wiki`.
344
348
  - Agent Wiki `create` and `update` support only `index.md`; `log.md` cannot be overwritten.
345
349
  - Agent Wiki `append-log` supports only `log.md` and calls status first before appending.
346
350
  - The CLI uses backend GraphQL metadata directly and does not derive S3 paths, SHA paths, or backend storage conventions.
347
- - Atlas should inspect `path`, `source`, `access`, `owner`, `parentRef`, `exists`, `canCreate`, `canUpdate`, `canAppend`, `suggestedAction`, and `errorCode`.
351
+ - Atlas should inspect `path`, `source`, `access`, `owner`, `parentRef`, `exists`, `canCreate`, `canUpdate`, `canAppend`, `wikiRole`, `formatVersion`, `suggestedAction`, and `errorCode`.
348
352
  - Reads never create files.
349
353
  - Create/update/append-log flows call status first and inspect `exists`, `canCreate`, `canUpdate`, `canAppend`, `suggestedAction`, and `errorCode`.
350
354
  - `create` fails when `exists` is true.
351
355
  - `update` fails when `exists` is false.
352
356
  - `append-log` fails unless status reports `exists: true`, `access: "append_only"`, and `canAppend: true`.
357
+ - When `Agent Wiki/log.md` is missing and status reports `suggestedAction: "init"`, `append-log` returns a JSON error telling Atlas to run `wave osmd wiki init`.
353
358
  - Missing `Agent Wiki/index.md` is create-ready when status returns `exists: false`, `canCreate: true`, `canUpdate: false`, and `suggestedAction: "create"`.
354
359
 
360
+ Atlas Agent Wiki log flow:
361
+
362
+ 1. `status_log`: run `wave osmd wiki status log.md`.
363
+ 2. If `data.exists === false` and `data.suggestedAction === "init"`, run `wave osmd wiki init`.
364
+ 3. `status_log`: run `wave osmd wiki status log.md` again and require `data.canAppend === true`.
365
+ 4. `append_log`: run `wave osmd wiki append-log --content "<markdown log entry>"`.
366
+
367
+ Atlas must not skip the status checks. `append-log` never initializes files implicitly; backend `initAgentMarkdown` via `wave osmd wiki init` is the only supported initialization flow for Agent Wiki system files.
368
+
369
+ Atlas maintenance examples:
370
+
371
+ Update `Agent Wiki/index.md` after an entity `.agent/notes.md` change. Atlas should read the current index, compose the complete replacement markdown in memory, then update `index.md`; the CLI does not patch partial content:
372
+
373
+ ```bash
374
+ wave osmd agent update "directory/Wave Tools Team" notes.md --content "## Working notes\n\n- New durable entity note."
375
+ wave osmd wiki status index.md
376
+ wave osmd wiki read index.md
377
+ wave osmd wiki update index.md --content "# Agent Wiki\n\n## Entity Notes\n\n- directory/Wave Tools Team -> .agent/notes.md"
378
+ ```
379
+
380
+ Append a parseable log entry. Use a stable fenced block so Atlas or backend jobs can parse the chronology later:
381
+
382
+ ````bash
383
+ wave osmd wiki append-log --content "```yaml
384
+ event: entity_note_updated
385
+ parentRef: directory/Wave Tools Team
386
+ agentFile: .agent/notes.md
387
+ wikiPath: Agent Wiki/index.md
388
+ summary: Added durable working notes for the Wave Tools Team.
389
+ ```"
390
+ ````
391
+
392
+ `append-log` accepts multi-line markdown from `--content`, `--file`, or stdin. Use `--file` for larger structured entries:
393
+
394
+ ```bash
395
+ wave osmd wiki append-log --file ./agent-wiki-log-entry.md
396
+ ```
397
+
398
+ When not using `--token-stdin` or `--auth-json-stdin`, stdin may also provide the log body:
399
+
400
+ ````bash
401
+ printf '%s\n' '```yaml' 'event: wiki_maintenance' 'summary: Refreshed Agent Wiki index.' '```' | wave osmd wiki append-log
402
+ ````
403
+
355
404
  OSMD command envelopes keep the global CLI envelope and put the file metadata directly in `data`:
356
405
 
357
406
  ```json
@@ -368,7 +417,11 @@ OSMD command envelopes keep the global CLI envelope and put the file metadata di
368
417
  "canCreate": false,
369
418
  "canUpdate": true,
370
419
  "canAppend": false,
420
+ "wikiRole": "notes",
421
+ "formatVersion": "agent_markdown_v1",
371
422
  "parentRef": "projects/Wave Tools",
423
+ "suggestedAction": "update",
424
+ "errorCode": null,
372
425
  "content": "..."
373
426
  },
374
427
  "error": null,
@@ -392,6 +445,8 @@ On write preflight errors, `data` contains the status metadata and `error.sugges
392
445
  "canCreate": true,
393
446
  "canUpdate": false,
394
447
  "canAppend": false,
448
+ "wikiRole": "index",
449
+ "formatVersion": "agent_markdown_v1",
395
450
  "parentRef": null,
396
451
  "suggestedAction": "create",
397
452
  "errorCode": null
package/dist/index.cjs CHANGED
@@ -6156,6 +6156,8 @@ var agentMarkdownFileSchema = import_zod16.z.object({
6156
6156
  canCreate: import_zod16.z.boolean(),
6157
6157
  canUpdate: import_zod16.z.boolean(),
6158
6158
  canAppend: import_zod16.z.boolean(),
6159
+ wikiRole: import_zod16.z.string().nullable().optional(),
6160
+ formatVersion: import_zod16.z.string().nullable().optional(),
6159
6161
  parentRef: import_zod16.z.string().nullable().optional(),
6160
6162
  agentChildrenAllowed: import_zod16.z.boolean(),
6161
6163
  suggestedAction: suggestedActionSchema,
@@ -6164,6 +6166,8 @@ var agentMarkdownFileSchema = import_zod16.z.object({
6164
6166
  url: import_zod16.z.string().nullable().optional()
6165
6167
  }).transform((value) => ({
6166
6168
  ...value,
6169
+ wikiRole: value.wikiRole ?? null,
6170
+ formatVersion: value.formatVersion ?? null,
6167
6171
  parentRef: value.parentRef ?? null,
6168
6172
  errorCode: value.errorCode ?? null,
6169
6173
  content: value.content ?? null,
@@ -6216,6 +6220,8 @@ var AGENT_MARKDOWN_FILE_SELECTION = `{
6216
6220
  canCreate
6217
6221
  canUpdate
6218
6222
  canAppend
6223
+ wikiRole
6224
+ formatVersion
6219
6225
  parentRef
6220
6226
  agentChildrenAllowed
6221
6227
  suggestedAction
@@ -6228,6 +6234,8 @@ var AGENT_JSON_KEY_ALIASES = {
6228
6234
  can_create: "canCreate",
6229
6235
  can_update: "canUpdate",
6230
6236
  can_append: "canAppend",
6237
+ wiki_role: "wikiRole",
6238
+ format_version: "formatVersion",
6231
6239
  parent_ref: "parentRef",
6232
6240
  agent_children_allowed: "agentChildrenAllowed",
6233
6241
  suggested_action: "suggestedAction",
@@ -6632,7 +6640,7 @@ function writePreflightError(status, action) {
6632
6640
  if (!status.exists) {
6633
6641
  return {
6634
6642
  code: "agent_file_not_found",
6635
- message: `Agent markdown file does not exist: ${status.path}`,
6643
+ message: status.suggestedAction === "init" ? `Agent Wiki log is not initialized. Run wave osmd wiki init before append-log.` : `Agent markdown file does not exist: ${status.path}`,
6636
6644
  suggestedAction: status.suggestedAction,
6637
6645
  status: 404
6638
6646
  };
@@ -6891,6 +6899,19 @@ function registerOsmdCommands(program) {
6891
6899
  }
6892
6900
  );
6893
6901
  const wiki = osmd.command("wiki").description("Agent Wiki files writable by agents; supports index.md and append-only log.md");
6902
+ wiki.command("init").description("Idempotently initialize Agent Wiki system files").action(async function() {
6903
+ const { organizationId, runtimeOptions } = await resolveOsmdContext(this);
6904
+ return runAgentMarkdownMutation({
6905
+ command: "osmd.wiki.init",
6906
+ operationName: "InitAgentMarkdown",
6907
+ runtimeOptions,
6908
+ field: "init_agent_markdown",
6909
+ variables: {
6910
+ organization_id: organizationId,
6911
+ path: "Agent Wiki"
6912
+ }
6913
+ });
6914
+ });
6894
6915
  wiki.command("status <path>").description("Show Agent Wiki index.md or log.md metadata without creating files").action(async (path, _opts, cmd) => {
6895
6916
  const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
6896
6917
  const result = await requestAgentMarkdownStatus({
package/dist/index.js CHANGED
@@ -6155,6 +6155,8 @@ var agentMarkdownFileSchema = z16.object({
6155
6155
  canCreate: z16.boolean(),
6156
6156
  canUpdate: z16.boolean(),
6157
6157
  canAppend: z16.boolean(),
6158
+ wikiRole: z16.string().nullable().optional(),
6159
+ formatVersion: z16.string().nullable().optional(),
6158
6160
  parentRef: z16.string().nullable().optional(),
6159
6161
  agentChildrenAllowed: z16.boolean(),
6160
6162
  suggestedAction: suggestedActionSchema,
@@ -6163,6 +6165,8 @@ var agentMarkdownFileSchema = z16.object({
6163
6165
  url: z16.string().nullable().optional()
6164
6166
  }).transform((value) => ({
6165
6167
  ...value,
6168
+ wikiRole: value.wikiRole ?? null,
6169
+ formatVersion: value.formatVersion ?? null,
6166
6170
  parentRef: value.parentRef ?? null,
6167
6171
  errorCode: value.errorCode ?? null,
6168
6172
  content: value.content ?? null,
@@ -6215,6 +6219,8 @@ var AGENT_MARKDOWN_FILE_SELECTION = `{
6215
6219
  canCreate
6216
6220
  canUpdate
6217
6221
  canAppend
6222
+ wikiRole
6223
+ formatVersion
6218
6224
  parentRef
6219
6225
  agentChildrenAllowed
6220
6226
  suggestedAction
@@ -6227,6 +6233,8 @@ var AGENT_JSON_KEY_ALIASES = {
6227
6233
  can_create: "canCreate",
6228
6234
  can_update: "canUpdate",
6229
6235
  can_append: "canAppend",
6236
+ wiki_role: "wikiRole",
6237
+ format_version: "formatVersion",
6230
6238
  parent_ref: "parentRef",
6231
6239
  agent_children_allowed: "agentChildrenAllowed",
6232
6240
  suggested_action: "suggestedAction",
@@ -6631,7 +6639,7 @@ function writePreflightError(status, action) {
6631
6639
  if (!status.exists) {
6632
6640
  return {
6633
6641
  code: "agent_file_not_found",
6634
- message: `Agent markdown file does not exist: ${status.path}`,
6642
+ message: status.suggestedAction === "init" ? `Agent Wiki log is not initialized. Run wave osmd wiki init before append-log.` : `Agent markdown file does not exist: ${status.path}`,
6635
6643
  suggestedAction: status.suggestedAction,
6636
6644
  status: 404
6637
6645
  };
@@ -6890,6 +6898,19 @@ function registerOsmdCommands(program) {
6890
6898
  }
6891
6899
  );
6892
6900
  const wiki = osmd.command("wiki").description("Agent Wiki files writable by agents; supports index.md and append-only log.md");
6901
+ wiki.command("init").description("Idempotently initialize Agent Wiki system files").action(async function() {
6902
+ const { organizationId, runtimeOptions } = await resolveOsmdContext(this);
6903
+ return runAgentMarkdownMutation({
6904
+ command: "osmd.wiki.init",
6905
+ operationName: "InitAgentMarkdown",
6906
+ runtimeOptions,
6907
+ field: "init_agent_markdown",
6908
+ variables: {
6909
+ organization_id: organizationId,
6910
+ path: "Agent Wiki"
6911
+ }
6912
+ });
6913
+ });
6893
6914
  wiki.command("status <path>").description("Show Agent Wiki index.md or log.md metadata without creating files").action(async (path, _opts, cmd) => {
6894
6915
  const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
6895
6916
  const result = await requestAgentMarkdownStatus({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ted-galago/wave-cli",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "wave": "dist/index.js"
@@ -1182,6 +1182,8 @@ function runOsmdLiveVerification() {
1182
1182
  wikiStatus.parsed?.ok === true &&
1183
1183
  wikiStatus.parsed?.data?.path === "Agent Wiki/index.md" &&
1184
1184
  wikiStatus.parsed?.data?.source === "agent_wiki" &&
1185
+ wikiStatus.parsed?.data?.wikiRole === "index" &&
1186
+ typeof wikiStatus.parsed?.data?.formatVersion === "string" &&
1185
1187
  (wikiStatus.parsed?.data?.exists !== false ||
1186
1188
  (wikiStatus.parsed?.data?.canCreate === true &&
1187
1189
  wikiStatus.parsed?.data?.canUpdate === false &&
@@ -1210,6 +1212,8 @@ function runOsmdLiveVerification() {
1210
1212
  wikiLogStatus.parsed?.data?.path === "Agent Wiki/log.md" &&
1211
1213
  wikiLogStatus.parsed?.data?.source === "agent_wiki" &&
1212
1214
  wikiLogStatus.parsed?.data?.access === "append_only" &&
1215
+ wikiLogStatus.parsed?.data?.wikiRole === "log" &&
1216
+ typeof wikiLogStatus.parsed?.data?.formatVersion === "string" &&
1213
1217
  typeof wikiLogStatus.parsed?.data?.canAppend === "boolean",
1214
1218
  reason: "agent_wiki_log_status"
1215
1219
  });
@@ -1224,31 +1228,78 @@ function runOsmdLiveVerification() {
1224
1228
  wikiLogRead.parsed?.ok === true &&
1225
1229
  wikiLogRead.parsed?.data?.path === "Agent Wiki/log.md" &&
1226
1230
  wikiLogRead.parsed?.data?.access === "append_only" &&
1231
+ wikiLogRead.parsed?.data?.wikiRole === "log" &&
1232
+ typeof wikiLogRead.parsed?.data?.formatVersion === "string" &&
1227
1233
  wikiLogRead.parsed?.data?.exists === wikiLogStatus.parsed?.data?.exists,
1228
1234
  reason: "agent_wiki_log_read"
1229
1235
  });
1230
1236
 
1237
+ if (wikiLogStatus.parsed?.data?.exists === false) {
1238
+ const missingWikiLogAppend = runWave(
1239
+ ["osmd", "wiki", "append-log", "--content", `CLI live verify log ${verifyStamp}`],
1240
+ env
1241
+ );
1242
+ results.push(missingWikiLogAppend);
1243
+ osmdVerificationFailures += recordExactCheck({
1244
+ lines: osmdVerificationLines,
1245
+ label: "osmd.wiki append-log missing log returns init guidance",
1246
+ result: missingWikiLogAppend,
1247
+ ok:
1248
+ missingWikiLogAppend.parsed?.ok === false &&
1249
+ missingWikiLogAppend.parsed?.status === 404 &&
1250
+ missingWikiLogAppend.parsed?.error?.code === "agent_file_not_found" &&
1251
+ missingWikiLogAppend.parsed?.error?.suggestedAction === "init" &&
1252
+ String(missingWikiLogAppend.parsed?.error?.message ?? "").includes("wave osmd wiki init") &&
1253
+ missingWikiLogAppend.parsed?.data?.path === "Agent Wiki/log.md" &&
1254
+ missingWikiLogAppend.parsed?.data?.wikiRole === "log" &&
1255
+ typeof missingWikiLogAppend.parsed?.data?.formatVersion === "string" &&
1256
+ missingWikiLogAppend.parsed?.data?.canAppend === false,
1257
+ reason: "agent_wiki_log_missing_init_guidance"
1258
+ });
1259
+ } else {
1260
+ osmdVerificationLines.push(
1261
+ "PASS | status=n/a | err=skipped_existing_log | reason=missing_log_init_guidance_skipped | osmd.wiki append-log missing log returns init guidance"
1262
+ );
1263
+ }
1264
+
1265
+ const wikiInit = runWave(["osmd", "wiki", "init"], env);
1266
+ results.push(wikiInit);
1267
+ const wikiInitFiles = firstArrayValue(wikiInit.parsed, [["data", "files"]]);
1268
+ osmdVerificationFailures += recordExactCheck({
1269
+ lines: osmdVerificationLines,
1270
+ label: "osmd.wiki init creates Agent Wiki system files",
1271
+ result: wikiInit,
1272
+ ok:
1273
+ wikiInit.parsed?.ok === true &&
1274
+ wikiInitFiles.some(
1275
+ (file) =>
1276
+ file?.path === "Agent Wiki/log.md" &&
1277
+ file?.access === "append_only" &&
1278
+ file?.wikiRole === "log" &&
1279
+ typeof file?.formatVersion === "string" &&
1280
+ file?.exists === true &&
1281
+ file?.canAppend === true
1282
+ ),
1283
+ reason: "agent_wiki_init"
1284
+ });
1285
+
1231
1286
  const wikiLogAppend = runWave(
1232
1287
  ["osmd", "wiki", "append-log", "--content", `CLI live verify log ${verifyStamp}`],
1233
1288
  env
1234
1289
  );
1235
1290
  results.push(wikiLogAppend);
1236
- const logAppendAllowed =
1237
- wikiLogStatus.parsed?.data?.exists === true &&
1238
- wikiLogStatus.parsed?.data?.access === "append_only" &&
1239
- wikiLogStatus.parsed?.data?.canAppend === true;
1240
1291
  osmdVerificationFailures += recordExactCheck({
1241
1292
  lines: osmdVerificationLines,
1242
- label: "osmd.wiki append-log follows backend canAppend",
1293
+ label: "osmd.wiki append-log succeeds after init",
1243
1294
  result: wikiLogAppend,
1244
- ok: logAppendAllowed
1245
- ? wikiLogAppend.parsed?.ok === true &&
1246
- wikiLogAppend.parsed?.data?.path === "Agent Wiki/log.md" &&
1247
- wikiLogAppend.parsed?.data?.access === "append_only"
1248
- : wikiLogAppend.parsed?.ok === false &&
1249
- wikiLogAppend.parsed?.data?.path === "Agent Wiki/log.md" &&
1250
- wikiLogAppend.parsed?.data?.canAppend === false,
1251
- reason: "agent_wiki_log_append"
1295
+ ok:
1296
+ wikiLogAppend.parsed?.ok === true &&
1297
+ wikiLogAppend.parsed?.data?.path === "Agent Wiki/log.md" &&
1298
+ wikiLogAppend.parsed?.data?.access === "append_only" &&
1299
+ wikiLogAppend.parsed?.data?.wikiRole === "log" &&
1300
+ typeof wikiLogAppend.parsed?.data?.formatVersion === "string" &&
1301
+ wikiLogAppend.parsed?.data?.canAppend === true,
1302
+ reason: "agent_wiki_log_append_after_init"
1252
1303
  });
1253
1304
 
1254
1305
  if (wikiStatus.parsed?.data?.exists === false) {
@@ -1297,6 +1348,8 @@ function runOsmdLiveVerification() {
1297
1348
  ok:
1298
1349
  agentStatus.parsed?.ok === true &&
1299
1350
  agentStatus.parsed?.data?.source === "agent_overlay" &&
1351
+ agentStatus.parsed?.data?.wikiRole === "notes" &&
1352
+ typeof agentStatus.parsed?.data?.formatVersion === "string" &&
1300
1353
  agentStatus.parsed?.data?.parentRef === parentRef,
1301
1354
  reason: "agent_overlay_status"
1302
1355
  });
@@ -1310,7 +1363,12 @@ function runOsmdLiveVerification() {
1310
1363
  result: agentInit,
1311
1364
  ok:
1312
1365
  agentInit.parsed?.ok === true &&
1313
- (initFiles.some((file) => file?.path?.endsWith("/.agent/notes.md")) ||
1366
+ (initFiles.some(
1367
+ (file) =>
1368
+ file?.path?.endsWith("/.agent/notes.md") &&
1369
+ file?.wikiRole === "notes" &&
1370
+ typeof file?.formatVersion === "string"
1371
+ ) ||
1314
1372
  agentInit.parsed?.data?.path?.endsWith("/.agent/notes.md")),
1315
1373
  reason: "agent_overlay_init"
1316
1374
  });
@@ -1328,6 +1386,8 @@ function runOsmdLiveVerification() {
1328
1386
  ok:
1329
1387
  agentUpdate.parsed?.ok === true &&
1330
1388
  agentUpdate.parsed?.data?.access === "read_write" &&
1389
+ agentUpdate.parsed?.data?.wikiRole === "notes" &&
1390
+ typeof agentUpdate.parsed?.data?.formatVersion === "string" &&
1331
1391
  agentUpdate.parsed?.data?.content === notesContent,
1332
1392
  reason: "agent_overlay_update"
1333
1393
  });