@dench.com/cli 3.6.6-staging.386 → 3.8.0-staging.389

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
@@ -112,9 +112,8 @@ next commands. Add `--json` for structured output.
112
112
 
113
113
  Browse and search the user's past chat threads in this workspace (own +
114
114
  shared). Useful for pulling in earlier context when the user refers to
115
- something they discussed before. The chat agent has the equivalent
116
- in-process tools (`list_past_chats`, `search_past_chats`,
117
- `read_past_chat`); this CLI surface is the same data accessed via bash.
115
+ something they discussed before. The shared chat harness uses these same CLI
116
+ commands through its execution tool; there is no separate agent-only chat-history command family.
118
117
 
119
118
  ```bash
120
119
  dench chat list [--query <substr>] [--limit N] [--include-archived] [--json]
@@ -391,54 +390,53 @@ Outreach needs a workspace member's credentials (a `dench signin` session, a
391
390
  member-bound `DENCH_API_KEY`, or an agent session); an organization-only key
392
391
  is refused.
393
392
 
394
- ## Workspace sync
393
+ ## Workspace files and reusable setup
395
394
 
396
- Starting with CLI 2.9.8, `dench fs status` reports cached local daemon
397
- health, not a live comparison between disk and the cloud copy. The status
398
- probe does not scan the workspace, contact the backend, or start a mount
399
- worker.
395
+ Use `dench files` for saved workspace documents and `dench stage` for outputs.
396
+ Harness A keeps a separate scratch directory per job. The old filesystem and
397
+ home-sync daemons are legacy compatibility infrastructure; they are not needed
398
+ to execute a command or restore a saved environment.
400
399
 
401
- ```bash
402
- dench fs status --json
403
- dench fs status --workspace /workspace --json
404
- ```
405
-
406
- | JSON field | Meaning |
407
- | --- | --- |
408
- | `daemon.healthy` | The process is alive and cached progress passes freshness checks, with a short startup grace before the first scan. |
409
- | `daemon.workspaceMatches` | The cached daemon serves the requested workspace root. A mismatch also makes `healthy` false. |
410
- | `daemon.state.mountWorker` | Cached worker state, PID, last progress time, restart count, and error. |
411
- | `counts.onDisk` | Last successful scan's count, only for the matching root; `null` when unavailable. Not a fresh count. |
412
- | `counts.inConvex`, `counts.onlyOnDisk`, `counts.onlyInConvex`, `counts.hashMismatches` | `null`: these counts are unknown, not zero. |
413
- | `driftStatus`, `drift` | `"not_checked"` and `[]`; an empty list does not prove that files match. |
414
-
415
- Status exits **1** when the daemon is missing, dead, stale, stalled, or
416
- serves a different root, including with `--json`; exit **0** means cached
417
- health passed, not that every pending write has synced. The legacy
418
- `--no-hash` and `--drift-limit N` flags remain accepted but have no effect.
419
-
420
- To pull a workspace file through the running daemon:
421
-
422
- ```bash
423
- dench fs pull "/reports/example.csv" --wait --timeout-ms 10000 --json
400
+ ```sh
401
+ dench files cat /reports/example.md
402
+ dench env list --json
403
+ dench env save openai-report --path ./openai-report --json
404
+ dench env show openai-report --json
405
+ dench env run openai-report -- node report.mjs
406
+ dench secrets set OPENAI_API_KEY --stdin < /private/path/key.txt
424
407
  ```
425
408
 
426
- `--timeout-ms` covers the whole request, including queueing, metadata,
427
- download, and mounted write (default 10 seconds, capped at 60 seconds).
428
- Successful `--wait` means the downloaded original passed its SHA-256 check
429
- and the write finished before the deadline. Without `--wait`, success
430
- means only that the request was queued.
431
-
432
- A running daemon process does not hot-upgrade: restart it after installing a
433
- new CLI.
409
+ A saved directory requires `dench-env.json`, `SKILL.md`, an explicit file allowlist
410
+ and verification commands. It builds dependencies once, publishes a ready
411
+ revision, and reuses the prepared snapshot or compatible bundle. Only the chosen
412
+ environment is loaded. Secrets are encrypted separately and injected into the
413
+ executing process; they never become dependency archives or memory facts.
414
+
415
+ New automation runs select the latest ready revision; active jobs and their
416
+ children retain the resolved revision. State is isolated by job or automation
417
+ unless an explicit shared state key is chosen. State writes and refreshed
418
+ credential files use compare-and-set versions; conflicts do not replay business
419
+ operations. Rotate credentials without reinstalling packages.
420
+
421
+ On a different local OS/runtime, explicitly prepare a separate platform cache
422
+ once using `dench env run openai-report --prepare-local -- node report.mjs`.
423
+ Normal ready runs never invoke a package installer. The local executor provides
424
+ separate directories, not operating-system isolation.
425
+
426
+ See [the environment reference](https://dench.com/references/ENVIRONMENTS.md)
427
+ for the manifest, cold-start costs, mutable state and recovery receipts. Use
428
+ `dench memory search/save` for facts and preferences, `dench context set` for
429
+ standing context, and `dench secrets` for credentials. An old memory claiming
430
+ that a service is configured cannot replace a successful storage receipt.
434
431
 
435
432
  ## Sandbox / API key auth (no `dench signin` required)
436
433
 
437
434
  Inside a Dench sandbox the Dench API key is set in the environment when the
438
435
  sandbox starts. When `DENCH_API_KEY` is present, the CLI skips the
439
436
  `dench signin` flow entirely and uses the key as a bearer for every org-scoped
440
- command — `dench crm`, `dench files`, `dench fs sync`, etc. The key targets
441
- production.
437
+ command — `dench crm`, `dench files`, and other workspace operations. The
438
+ selected connection determines the backend; hosted credentials stay scoped to
439
+ the authorized workspace and job.
442
440
 
443
441
  ```bash
444
442
  export DENCH_API_KEY=dench_pk_live_…
@@ -477,7 +475,8 @@ dench context --sections organisation,user,memory --json
477
475
  ```
478
476
 
479
477
  Section names are `identity`, `organisation`, `user`, `memory`, `rules`, and
480
- `tools`. Multiple names use one query. The existing `organisation show`,
481
- `user show`, and `mem show` commands use the same saved documents; reading never
482
- fills profiles or writes memory. Personal USER context is unavailable to shared
478
+ `tools`. Multiple names use one query. Reading never fills profiles or writes
479
+ memory. Edit the selected context with
480
+ `dench context set <identity|organisation|user|tools|rules> --stdin`; older profile
481
+ aliases remain compatibility paths. Personal USER context is unavailable to shared
483
482
  channel sessions. `dench context --json` keeps its existing workspace overview.
package/agent-config.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `dench identity / organisation / user / bootstrap / model / daily /
2
+ * `dench identity / organisation / user / bootstrap / model /
3
3
  * mem aggregate` — CLI surface for the OpenClaw-
4
4
  * parity self-updating harness.
5
5
  *
@@ -15,14 +15,13 @@
15
15
  * identity show | edit
16
16
  * organisation show | edit
17
17
  * user show | edit
18
- * tools show | notes-edit
18
+ * tools show | edit
19
19
  * memory show | append <text> | set (MEMORY.md aggregate)
20
20
  * bootstrap status | complete | reopen | template
21
21
  * model default <id> | model default clear |
22
22
  * model thread <threadId> <id> | model thread <threadId> clear
23
- * daily today | daily show <YYYY-MM-DD> | daily append <text>
24
23
  *
25
- * `edit` / `notes-edit` / `template` open the
24
+ * `edit` / `template` open the
26
25
  * user's `$EDITOR` (default `vi`) to capture the new body. The
27
26
  * stdin path is also supported via `--stdin`, useful in scripts.
28
27
  */
@@ -81,6 +80,12 @@ type CliCtx = {
81
80
  sessionToken?: string;
82
81
  };
83
82
 
83
+ function consumeOutputFlag(ctx: CliCtx): void {
84
+ // Drain even when the parent already resolved JSON mode: otherwise a free
85
+ // text body or an optional model positional would consume the literal flag.
86
+ ctx.jsonOutput = hasFlag(ctx.args, "--json") || ctx.jsonOutput;
87
+ }
88
+
84
89
  function out(ctx: CliCtx, value: unknown): void {
85
90
  if (ctx.jsonOutput) {
86
91
  console.log(JSON.stringify(value, null, 2));
@@ -229,7 +234,7 @@ async function handleSimpleMagicFile(
229
234
  }
230
235
  if (sub === "edit" || sub === "set") {
231
236
  let content: string;
232
- if (hasFlag(args, "--stdin") || getFlag(args, "--content")) {
237
+ if (args.includes("--stdin") || args.includes("--content")) {
233
238
  content = await resolveContent(args);
234
239
  } else {
235
240
  const config = await loadAgentConfig(ctx);
@@ -315,7 +320,7 @@ async function handleBootstrap(ctx: CliCtx, args: string[]): Promise<void> {
315
320
  }
316
321
  if (sub === "template") {
317
322
  let content: string;
318
- if (hasFlag(args, "--stdin") || getFlag(args, "--content")) {
323
+ if (args.includes("--stdin") || args.includes("--content")) {
319
324
  content = await resolveContent(args);
320
325
  } else {
321
326
  const config = await loadAgentConfig(ctx);
@@ -399,6 +404,7 @@ async function handleModel(ctx: CliCtx, args: string[]): Promise<void> {
399
404
  // ── Entry points consumed by cli/dench.ts ────────────────────────────────
400
405
 
401
406
  export async function runIdentityCommand(ctx: CliCtx): Promise<void> {
407
+ consumeOutputFlag(ctx);
402
408
  await handleSimpleMagicFile(ctx, ctx.args, {
403
409
  label: "identity",
404
410
  field: "identity",
@@ -406,6 +412,7 @@ export async function runIdentityCommand(ctx: CliCtx): Promise<void> {
406
412
  }
407
413
 
408
414
  export async function runOrganisationCommand(ctx: CliCtx): Promise<void> {
415
+ consumeOutputFlag(ctx);
409
416
  await handleSimpleMagicFile(ctx, ctx.args, {
410
417
  label: "organisation",
411
418
  field: "organisation",
@@ -413,6 +420,7 @@ export async function runOrganisationCommand(ctx: CliCtx): Promise<void> {
413
420
  }
414
421
 
415
422
  export async function runUserCommand(ctx: CliCtx): Promise<void> {
423
+ consumeOutputFlag(ctx);
416
424
  await handleSimpleMagicFile(ctx, ctx.args, {
417
425
  label: "user",
418
426
  field: "identity", // unused (perMember=true)
@@ -421,6 +429,7 @@ export async function runUserCommand(ctx: CliCtx): Promise<void> {
421
429
  }
422
430
 
423
431
  export async function runToolsCommand(ctx: CliCtx): Promise<void> {
432
+ consumeOutputFlag(ctx);
424
433
  await handleSimpleMagicFile(ctx, ctx.args, {
425
434
  label: "tools",
426
435
  field: "toolsNotes",
@@ -433,6 +442,7 @@ export async function runToolsCommand(ctx: CliCtx): Promise<void> {
433
442
  * show | append <text> | set
434
443
  */
435
444
  export async function runMemoryAggregateCommand(ctx: CliCtx): Promise<void> {
445
+ consumeOutputFlag(ctx);
436
446
  const sub = ctx.args[0];
437
447
  if (!sub || sub === "show") {
438
448
  const config = await loadAgentConfig(ctx);
@@ -451,7 +461,7 @@ export async function runMemoryAggregateCommand(ctx: CliCtx): Promise<void> {
451
461
  }
452
462
  if (sub === "set" || sub === "edit") {
453
463
  let content: string;
454
- if (hasFlag(ctx.args, "--stdin") || getFlag(ctx.args, "--content")) {
464
+ if (ctx.args.includes("--stdin") || ctx.args.includes("--content")) {
455
465
  content = await resolveContent(ctx.args);
456
466
  } else {
457
467
  const config = await loadAgentConfig(ctx);
@@ -476,72 +486,26 @@ export async function runMemoryAggregateCommand(ctx: CliCtx): Promise<void> {
476
486
  }
477
487
 
478
488
  export async function runBootstrapCommand(ctx: CliCtx): Promise<void> {
489
+ consumeOutputFlag(ctx);
479
490
  await handleBootstrap(ctx, ctx.args);
480
491
  }
481
492
 
482
493
  export async function runModelCommand(ctx: CliCtx): Promise<void> {
494
+ consumeOutputFlag(ctx);
483
495
  await handleModel(ctx, ctx.args);
484
496
  }
485
497
 
486
- /**
487
- * Daily activity log subcommands (real fileTree files under
488
- * `/workspace/daily/`). Today / show <YYYY-MM-DD> read the inline
489
- * cache; append delegates to the agent action so timestamps and
490
- * heading wrappers stay consistent.
491
- */
492
- export async function runDailyCommand(ctx: CliCtx): Promise<void> {
493
- const sub = ctx.args[0];
494
- if (!sub || sub === "today") {
495
- const today = new Date();
496
- const yyyy = today.getUTCFullYear();
497
- const mm = String(today.getUTCMonth() + 1).padStart(2, "0");
498
- const dd = String(today.getUTCDate()).padStart(2, "0");
499
- const path = `/daily/${yyyy}-${mm}-${dd}.md`;
500
- // Daily logs are real files — fetch via the workspace file API
501
- // hop so the same auth (Convex Auth or API key) works.
502
- out(
503
- ctx,
504
- ctx.jsonOutput
505
- ? { path }
506
- : `Today's daily log lives at ${path}. Use \`dench fs cat ${path}\` to read it, or open it in the workspace UI.`,
507
- );
508
- return;
509
- }
510
- if (sub === "show") {
511
- const date = ctx.args[1];
512
- if (!date) {
513
- throw new AgentConfigCliError("Usage: dench daily show <YYYY-MM-DD>");
514
- }
515
- out(
516
- ctx,
517
- ctx.jsonOutput
518
- ? { path: `/daily/${date}.md` }
519
- : `Daily log for ${date} lives at /daily/${date}.md. Use \`dench fs cat\` to read it.`,
520
- );
521
- return;
522
- }
523
- if (sub === "append") {
524
- throw new AgentConfigCliError(
525
- "Daily append is currently only available via the agent's `append_daily_log` tool. Use the chat to log entries with timestamps.",
526
- );
527
- }
528
- throw new AgentConfigCliError(
529
- `Unknown daily subcommand: "${sub}". Try "today", "show <YYYY-MM-DD>".`,
530
- );
531
- }
532
-
533
498
  export function printAgentConfigCliHelp(): void {
534
499
  console.log(
535
- `Self-updating agent harness:
500
+ `Workspace context compatibility aliases (prefer dench context --sections / context set):
536
501
 
537
502
  dench identity show | edit IDENTITY.md (org-wide)
538
503
  dench organisation show | edit ORGANISATION.md
539
504
  dench user show | edit USER.md (per-member)
540
- dench tools show | notes-edit TOOLS.md notes section
505
+ dench tools show | edit TOOLS.md notes section
541
506
  dench mem show | append <text> | set MEMORY.md aggregate
542
507
  dench bootstrap status | complete | reopen | template
543
508
  dench model default <id|clear> | model thread <threadId> <id|clear>
544
- dench daily today | show <YYYY-MM-DD> Activity log paths
545
509
 
546
510
  Editing flags:
547
511
  --content "<markdown>" Inline body