@dench.com/cli 2.3.1 → 2.3.2

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/dench.ts CHANGED
@@ -163,6 +163,14 @@ const api = {
163
163
  "functions/agentWorkspace:whatCanIDoHere",
164
164
  ),
165
165
  },
166
+ agentConfig: {
167
+ workspaceInstructions: makeFunctionReference<"query">(
168
+ "functions/agentConfig:workspaceInstructions",
169
+ ),
170
+ devWorkspaceInstructions: makeFunctionReference<"query">(
171
+ "functions/agentConfig:devWorkspaceInstructions",
172
+ ),
173
+ },
166
174
  files: {
167
175
  listTree: makeFunctionReference<"query">("functions/files:listTree"),
168
176
  deleteFile: makeFunctionReference<"mutation">(
@@ -450,7 +458,8 @@ Usage:
450
458
  dench use <session-key-or-workspace-slug> [--host <host>] [--json]
451
459
  dench logout [session-key-or-workspace-slug] [--session <key-or-scope>] [--host <host>] [--all] [--json]
452
460
  dench backend [show|set|clear] [<production|staging|local|<url>>] [--json]
453
- dench context [--json]
461
+ dench context [--instructions] [--json]
462
+ dench instructions [--json]
454
463
  dench status [--mine|--self] [--json]
455
464
  dench memory search "query" [--limit 8] [--json]
456
465
  dench memory save <key> "text" [--kind fact|decision|preference|goal|tool_note|other] [--tags a,b] [--sensitivity normal|broad|sensitive] [--scope user|org] [--json]
@@ -682,10 +691,14 @@ function contextHelp() {
682
691
  console.log(`Dench context
683
692
 
684
693
  Usage:
685
- dench context [--json]
694
+ dench context [--instructions] [--json]
695
+ dench instructions [--json]
686
696
 
687
697
  Shows the current workspace, current agent, assigned tasks, pending approvals
688
698
  requested by this agent, connected apps when available, and useful next commands.
699
+
700
+ Use --instructions (or dench instructions) to print the standing workspace
701
+ instructions external agents should treat as system-level guidance.
689
702
  `);
690
703
  }
691
704
 
@@ -2900,6 +2913,24 @@ function formatContext(context: JsonRecord) {
2900
2913
  return lines.join("\n");
2901
2914
  }
2902
2915
 
2916
+ async function buildWorkspaceInstructionsContext(
2917
+ runtime: Awaited<ReturnType<typeof getRuntime>>,
2918
+ ) {
2919
+ if (runtime.mode === "dev") {
2920
+ return (await runtime.client.query(
2921
+ api.functions.agentConfig.devWorkspaceInstructions,
2922
+ runtime.workspaceArgs,
2923
+ )) as JsonRecord;
2924
+ }
2925
+ if (runtime.mode !== "session" && runtime.mode !== "apiKey") {
2926
+ throw loginRequiredError("dench context --instructions");
2927
+ }
2928
+ return (await runtime.client.query(
2929
+ api.functions.agentConfig.workspaceInstructions,
2930
+ { sessionToken: runtime.sessionToken },
2931
+ )) as JsonRecord;
2932
+ }
2933
+
2903
2934
  async function devOverview(runtime: Awaited<ReturnType<typeof getRuntime>>) {
2904
2935
  if (runtime.mode !== "dev") {
2905
2936
  throw new Error("Not in dev mode");
@@ -4355,6 +4386,22 @@ async function main() {
4355
4386
  return;
4356
4387
  }
4357
4388
 
4389
+ if (command === "context" && args.includes("--instructions")) {
4390
+ const instructions = await buildWorkspaceInstructionsContext(runtime);
4391
+ print(
4392
+ json ? instructions : (stringField(instructions, "instructions") ?? ""),
4393
+ );
4394
+ return;
4395
+ }
4396
+
4397
+ if (command === "instructions") {
4398
+ const instructions = await buildWorkspaceInstructionsContext(runtime);
4399
+ print(
4400
+ json ? instructions : (stringField(instructions, "instructions") ?? ""),
4401
+ );
4402
+ return;
4403
+ }
4404
+
4358
4405
  if (command === "context") {
4359
4406
  const context = await buildContext(runtime);
4360
4407
  print(json ? context : formatContext(context));
@@ -340,6 +340,18 @@ const workspaceStatusPayload = z
340
340
  "Workspace orientation payload shared by /context, /status, /agents, and /approvals.",
341
341
  );
342
342
 
343
+ const workspaceInstructionsResponse = z.object({
344
+ instructions: z
345
+ .string()
346
+ .describe(
347
+ "Markdown standing instructions for external agents connected to this workspace.",
348
+ ),
349
+ workspace: z.object({
350
+ name: z.string(),
351
+ slug: z.string().optional(),
352
+ }),
353
+ });
354
+
343
355
  const memoryDoc = z
344
356
  .object({
345
357
  _id: z.string(),
@@ -1183,6 +1195,7 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
1183
1195
 
1184
1196
  // Workspace
1185
1197
  "workspace.context": noInput,
1198
+ "workspace.instructions": noInput,
1186
1199
  "workspace.status": noInput,
1187
1200
  "workspace.agents": noInput,
1188
1201
  "workspace.approvals.list": noInput,
@@ -1909,6 +1922,7 @@ export const responseSchemas: Record<string, ZodTypeAny> = {
1909
1922
 
1910
1923
  // Workspace orientation
1911
1924
  "workspace.context": workspaceStatusPayload,
1925
+ "workspace.instructions": workspaceInstructionsResponse,
1912
1926
  "workspace.status": workspaceStatusPayload,
1913
1927
  "workspace.agents": workspaceStatusPayload,
1914
1928
  "workspace.approvals.list": workspaceStatusPayload,
@@ -2757,6 +2771,11 @@ export const responseExamples: Record<string, unknown> = {
2757
2771
  },
2758
2772
  },
2759
2773
  "workspace.context": workspaceStatusExample,
2774
+ "workspace.instructions": {
2775
+ workspace: { name: "Acme", slug: "acme" },
2776
+ instructions:
2777
+ "# Dench Workspace Instructions\n\nWorkspace: Acme (acme)\n\n## Identity\nYou are Dench...",
2778
+ },
2760
2779
  "workspace.status": workspaceStatusExample,
2761
2780
  "workspace.agents": workspaceStatusExample,
2762
2781
  "workspace.approvals.list": workspaceStatusExample,
@@ -245,6 +245,18 @@ const rawApiOperations = [
245
245
  responseSchema: anyResponse,
246
246
  backend: convex("query", "functions/agentWorkspace:whatCanIDoHere"),
247
247
  }),
248
+ op({
249
+ id: "workspace.instructions",
250
+ group: "workspace",
251
+ summary:
252
+ "Return the current workspace's standing instructions for external agents.",
253
+ cli: "dench context --instructions",
254
+ method: "GET",
255
+ path: "/context/instructions",
256
+ requestSchema: noBody,
257
+ responseSchema: anyResponse,
258
+ backend: convex("query", "functions/agentConfig:workspaceInstructions"),
259
+ }),
248
260
  op({
249
261
  id: "workspace.status",
250
262
  group: "workspace",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dench.com/cli",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "Dench agent workspace CLI. v2 unifies auth behind `dench signin`; the legacy `dench login` / `dench onboard` / `dench setup` / `dench what-can-i-do` / `dench register` commands now error with a redirect.",
5
5
  "type": "module",
6
6
  "bin": {