@dench.com/cli 3.11.26-staging.630 → 3.11.28-staging.639
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 +9 -9
- package/app-sdk.d.ts +6 -172
- package/dench.ts +6 -164
- package/lib/api-schemas.ts +9 -65
- package/lib/app-sdk-catalog.generated.ts +0 -8
- package/lib/app-sdk-surface.ts +0 -21
- package/lib/command-registry.ts +0 -36
- package/lib/references.generated.json +12 -12
- package/package.json +1 -1
- package/tools.ts +7 -24
package/README.md
CHANGED
|
@@ -105,7 +105,7 @@ a tracked entry (confirm field names with `dench crm fields list task`
|
|
|
105
105
|
first — unknown fields are rejected). For ad-hoc requests, work directly.
|
|
106
106
|
|
|
107
107
|
Use `dench context` when you need to know who you are, which workspace you
|
|
108
|
-
are using,
|
|
108
|
+
are using, connected apps, and the best
|
|
109
109
|
next commands. Add `--json` for structured output.
|
|
110
110
|
|
|
111
111
|
## Past chat threads
|
|
@@ -188,19 +188,19 @@ In the JSON, each connection has a `source` of `app` or `dench`, and
|
|
|
188
188
|
`nativeAvailable: false` means Dench-connected accounts could not be checked.
|
|
189
189
|
|
|
190
190
|
Start with compact `dench tool search` output. It lists ranked tools with slug,
|
|
191
|
-
toolkit, connection status, and read-only/
|
|
191
|
+
toolkit, connection status, and a read-only/writes hint. Add `--json` only when
|
|
192
192
|
you need full raw schemas or exact argument details.
|
|
193
193
|
|
|
194
|
-
Run clear read-only information retrieval tools through Dench
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
Run clear read-only information retrieval tools through Dench directly. This
|
|
195
|
+
includes slugs containing `FETCH`, `GET`, `LIST`, `SEARCH`, `READ`, or `FIND`,
|
|
196
|
+
such as `GMAIL_FETCH_EMAILS`:
|
|
197
197
|
|
|
198
198
|
```bash
|
|
199
199
|
dench tool run GMAIL_FETCH_EMAILS --args '{"max_results":10}' --json
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
Anything else acts in the connected app as soon as it runs; Dench has no
|
|
203
|
+
approval step, so confirm it with the human first unless they asked for it.
|
|
204
204
|
|
|
205
205
|
For Gmail and other email tools, summarize safely. Prefer metadata and snippets.
|
|
206
206
|
Do not repeat OTP codes, security codes, passwords, tokens, API keys, or secrets
|
|
@@ -458,8 +458,8 @@ Auth precedence:
|
|
|
458
458
|
Plain terminal usage without a saved session or `DENCH_API_KEY` returns
|
|
459
459
|
`login_required`.
|
|
460
460
|
|
|
461
|
-
Commands that need to impersonate a specific agent (
|
|
462
|
-
`dench
|
|
461
|
+
Commands that need to impersonate a specific agent (such as
|
|
462
|
+
`dench memory`) still require an agent session
|
|
463
463
|
(`dench signin`) — the unified API key is org-scoped and cannot speak
|
|
464
464
|
as a single agent. Those commands return a clear "agent session
|
|
465
465
|
required" error in API-key mode.
|
package/app-sdk.d.ts
CHANGED
|
@@ -738,8 +738,6 @@ export interface ApiRequests {
|
|
|
738
738
|
"workspace.status": Record<string, unknown>;
|
|
739
739
|
/** List agents visible in the workspace status payload. — `dench agents` — GET /api/v1/agents */
|
|
740
740
|
"workspace.agents": Record<string, unknown>;
|
|
741
|
-
/** List approval requests visible in the workspace status payload. — `dench approvals` — GET /api/v1/approvals */
|
|
742
|
-
"workspace.approvals.list": Record<string, unknown>;
|
|
743
741
|
/** List artifacts for the authenticated workspace. — `dench artifacts` — GET /api/v1/artifacts */
|
|
744
742
|
"workspace.artifacts.list": {
|
|
745
743
|
limit?: number;
|
|
@@ -856,22 +854,6 @@ export interface ApiRequests {
|
|
|
856
854
|
confidence?: number;
|
|
857
855
|
importance?: number;
|
|
858
856
|
};
|
|
859
|
-
/** Request human approval. — `dench approval request` — POST /api/v1/approvals */
|
|
860
|
-
"approval.request": {
|
|
861
|
-
/** What needs human approval. */
|
|
862
|
-
title: string;
|
|
863
|
-
reason?: string;
|
|
864
|
-
/** Risk level. */
|
|
865
|
-
risk: "low" | "medium" | "high";
|
|
866
|
-
};
|
|
867
|
-
/** Record an approval decision. — `dench approval approve|reject` — POST /api/v1/approvals/{approvalId}/decision */
|
|
868
|
-
"approval.decide": {
|
|
869
|
-
approvalId: string;
|
|
870
|
-
/** Human decision for an approval request. */
|
|
871
|
-
decision: "approved" | "rejected";
|
|
872
|
-
/** Required when the requesting agent records its own decision. */
|
|
873
|
-
evidence?: string;
|
|
874
|
-
};
|
|
875
857
|
/** Get billing and AI credit status. — `dench billing status` — GET /api/v1/billing/status */
|
|
876
858
|
"billing.status": Record<string, unknown>;
|
|
877
859
|
/** Create an AI credit top-up checkout link. — `dench billing topup` — POST /api/v1/billing/topup */
|
|
@@ -4028,17 +4010,8 @@ export interface ApiResponses {
|
|
|
4028
4010
|
kind: string;
|
|
4029
4011
|
lastSeenAt?: number;
|
|
4030
4012
|
}[];
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
title: string;
|
|
4034
|
-
reason: string;
|
|
4035
|
-
kind?: string;
|
|
4036
|
-
/** Risk level. */
|
|
4037
|
-
risk: "low" | "medium" | "high";
|
|
4038
|
-
agentId?: string;
|
|
4039
|
-
createdAt: number;
|
|
4040
|
-
[key: string]: unknown;
|
|
4041
|
-
}>;
|
|
4013
|
+
/** Always empty: approvals were removed. Kept for older clients. */
|
|
4014
|
+
pendingApprovals: Record<string, unknown>[];
|
|
4042
4015
|
recentArtifacts: Array<{
|
|
4043
4016
|
id: string;
|
|
4044
4017
|
runId: string;
|
|
@@ -4085,7 +4058,6 @@ export interface ApiResponses {
|
|
|
4085
4058
|
tools: {
|
|
4086
4059
|
discovery: string[];
|
|
4087
4060
|
cli: string[];
|
|
4088
|
-
approvalPolicy: string;
|
|
4089
4061
|
};
|
|
4090
4062
|
nextActions: string[];
|
|
4091
4063
|
};
|
|
@@ -4120,17 +4092,8 @@ export interface ApiResponses {
|
|
|
4120
4092
|
kind: string;
|
|
4121
4093
|
lastSeenAt?: number;
|
|
4122
4094
|
}[];
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
title: string;
|
|
4126
|
-
reason: string;
|
|
4127
|
-
kind?: string;
|
|
4128
|
-
/** Risk level. */
|
|
4129
|
-
risk: "low" | "medium" | "high";
|
|
4130
|
-
agentId?: string;
|
|
4131
|
-
createdAt: number;
|
|
4132
|
-
[key: string]: unknown;
|
|
4133
|
-
}>;
|
|
4095
|
+
/** Always empty: approvals were removed. Kept for older clients. */
|
|
4096
|
+
pendingApprovals: Record<string, unknown>[];
|
|
4134
4097
|
recentArtifacts: Array<{
|
|
4135
4098
|
id: string;
|
|
4136
4099
|
runId: string;
|
|
@@ -4177,7 +4140,6 @@ export interface ApiResponses {
|
|
|
4177
4140
|
tools: {
|
|
4178
4141
|
discovery: string[];
|
|
4179
4142
|
cli: string[];
|
|
4180
|
-
approvalPolicy: string;
|
|
4181
4143
|
};
|
|
4182
4144
|
nextActions: string[];
|
|
4183
4145
|
};
|
|
@@ -4204,17 +4166,8 @@ export interface ApiResponses {
|
|
|
4204
4166
|
kind: string;
|
|
4205
4167
|
lastSeenAt?: number;
|
|
4206
4168
|
}[];
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
title: string;
|
|
4210
|
-
reason: string;
|
|
4211
|
-
kind?: string;
|
|
4212
|
-
/** Risk level. */
|
|
4213
|
-
risk: "low" | "medium" | "high";
|
|
4214
|
-
agentId?: string;
|
|
4215
|
-
createdAt: number;
|
|
4216
|
-
[key: string]: unknown;
|
|
4217
|
-
}>;
|
|
4169
|
+
/** Always empty: approvals were removed. Kept for older clients. */
|
|
4170
|
+
pendingApprovals: Record<string, unknown>[];
|
|
4218
4171
|
recentArtifacts: Array<{
|
|
4219
4172
|
id: string;
|
|
4220
4173
|
runId: string;
|
|
@@ -4261,91 +4214,6 @@ export interface ApiResponses {
|
|
|
4261
4214
|
tools: {
|
|
4262
4215
|
discovery: string[];
|
|
4263
4216
|
cli: string[];
|
|
4264
|
-
approvalPolicy: string;
|
|
4265
|
-
};
|
|
4266
|
-
nextActions: string[];
|
|
4267
|
-
};
|
|
4268
|
-
"workspace.approvals.list": {
|
|
4269
|
-
workspace: {
|
|
4270
|
-
id: string;
|
|
4271
|
-
name: string;
|
|
4272
|
-
slug?: string;
|
|
4273
|
-
};
|
|
4274
|
-
agent: {
|
|
4275
|
-
id: string;
|
|
4276
|
-
name: string;
|
|
4277
|
-
kind: string;
|
|
4278
|
-
};
|
|
4279
|
-
rules: Array<{
|
|
4280
|
-
id: string;
|
|
4281
|
-
title: string;
|
|
4282
|
-
body: string;
|
|
4283
|
-
scope: "organization" | "project";
|
|
4284
|
-
}>;
|
|
4285
|
-
activeAgents: {
|
|
4286
|
-
id: string;
|
|
4287
|
-
name: string;
|
|
4288
|
-
kind: string;
|
|
4289
|
-
lastSeenAt?: number;
|
|
4290
|
-
}[];
|
|
4291
|
-
pendingApprovals: Array<{
|
|
4292
|
-
id: string;
|
|
4293
|
-
title: string;
|
|
4294
|
-
reason: string;
|
|
4295
|
-
kind?: string;
|
|
4296
|
-
/** Risk level. */
|
|
4297
|
-
risk: "low" | "medium" | "high";
|
|
4298
|
-
agentId?: string;
|
|
4299
|
-
createdAt: number;
|
|
4300
|
-
[key: string]: unknown;
|
|
4301
|
-
}>;
|
|
4302
|
-
recentArtifacts: Array<{
|
|
4303
|
-
id: string;
|
|
4304
|
-
runId: string;
|
|
4305
|
-
title: string;
|
|
4306
|
-
type: "note" | "draft" | "report" | "task_suggestion" | "patch" | "other";
|
|
4307
|
-
status: "draft" | "approved" | "rejected" | "applied" | "archived";
|
|
4308
|
-
content: string;
|
|
4309
|
-
createdAt: number;
|
|
4310
|
-
updatedAt: number;
|
|
4311
|
-
}>;
|
|
4312
|
-
suggestedWork: Array<{
|
|
4313
|
-
id: string;
|
|
4314
|
-
runId: string;
|
|
4315
|
-
title: string;
|
|
4316
|
-
type: "note" | "draft" | "report" | "task_suggestion" | "patch" | "other";
|
|
4317
|
-
status: "draft" | "approved" | "rejected" | "applied" | "archived";
|
|
4318
|
-
content: string;
|
|
4319
|
-
createdAt: number;
|
|
4320
|
-
updatedAt: number;
|
|
4321
|
-
nextCommands: string[];
|
|
4322
|
-
}>;
|
|
4323
|
-
memory: Array<{
|
|
4324
|
-
id: string;
|
|
4325
|
-
key: string;
|
|
4326
|
-
/** Memory classification. */
|
|
4327
|
-
kind: "fact" | "decision" | "preference" | "goal" | "tool_note" | "other" | "convention" | "project_context" | "agent_lesson" | "docs_knowledge" | "open_goal";
|
|
4328
|
-
text: string;
|
|
4329
|
-
tags: string[];
|
|
4330
|
-
status: "active" | "needs_review" | "archived";
|
|
4331
|
-
updatedAt: number;
|
|
4332
|
-
}>;
|
|
4333
|
-
chatAgents: {
|
|
4334
|
-
nextCommands: string[];
|
|
4335
|
-
activeRuns: {
|
|
4336
|
-
id: string;
|
|
4337
|
-
goal: string;
|
|
4338
|
-
status: string;
|
|
4339
|
-
model: string;
|
|
4340
|
-
createdAt: number;
|
|
4341
|
-
[key: string]: unknown;
|
|
4342
|
-
}[];
|
|
4343
|
-
templates: string[];
|
|
4344
|
-
};
|
|
4345
|
-
tools: {
|
|
4346
|
-
discovery: string[];
|
|
4347
|
-
cli: string[];
|
|
4348
|
-
approvalPolicy: string;
|
|
4349
4217
|
};
|
|
4350
4218
|
nextActions: string[];
|
|
4351
4219
|
};
|
|
@@ -4415,20 +4283,6 @@ export interface ApiResponses {
|
|
|
4415
4283
|
memoryId: string;
|
|
4416
4284
|
status: "active" | "needs_review" | "archived";
|
|
4417
4285
|
};
|
|
4418
|
-
"approval.request": {
|
|
4419
|
-
ok: boolean;
|
|
4420
|
-
approvalId: string;
|
|
4421
|
-
};
|
|
4422
|
-
"approval.decide": {
|
|
4423
|
-
ok: true;
|
|
4424
|
-
/** Human decision for an approval request. */
|
|
4425
|
-
status: "approved" | "rejected";
|
|
4426
|
-
} | {
|
|
4427
|
-
ok: false;
|
|
4428
|
-
/** e.g. approval_not_pending. */
|
|
4429
|
-
code: string;
|
|
4430
|
-
error: string;
|
|
4431
|
-
};
|
|
4432
4286
|
"billing.status": {
|
|
4433
4287
|
workspace: {
|
|
4434
4288
|
id: string;
|
|
@@ -8956,12 +8810,6 @@ export type DenchApiTree = {
|
|
|
8956
8810
|
show(args?: Req<"agentConfig.user.show">): Promise<Res<"agentConfig.user.show">>;
|
|
8957
8811
|
};
|
|
8958
8812
|
};
|
|
8959
|
-
approval: {
|
|
8960
|
-
/** Record an approval decision. (`dench approval approve|reject`) */
|
|
8961
|
-
decide(args: Req<"approval.decide">): Promise<Res<"approval.decide">>;
|
|
8962
|
-
/** Request human approval. (`dench approval request`) */
|
|
8963
|
-
request(args: Req<"approval.request">): Promise<Res<"approval.request">>;
|
|
8964
|
-
};
|
|
8965
8813
|
apps: {
|
|
8966
8814
|
/** Scaffold and register a new App Store app. (`dench apps create`) */
|
|
8967
8815
|
create(args: Req<"apps.create">): Promise<Res<"apps.create">>;
|
|
@@ -9975,10 +9823,6 @@ export type DenchApiTree = {
|
|
|
9975
9823
|
workspace: {
|
|
9976
9824
|
/** List agents visible in the workspace status payload. (`dench agents`) */
|
|
9977
9825
|
agents(args?: Req<"workspace.agents">): Promise<Res<"workspace.agents">>;
|
|
9978
|
-
approvals: {
|
|
9979
|
-
/** List approval requests visible in the workspace status payload. (`dench approvals`) */
|
|
9980
|
-
list(args?: Req<"workspace.approvals.list">): Promise<Res<"workspace.approvals.list">>;
|
|
9981
|
-
};
|
|
9982
9826
|
artifacts: {
|
|
9983
9827
|
/** List artifacts for the authenticated workspace. (`dench artifacts`) */
|
|
9984
9828
|
list(args?: Req<"workspace.artifacts.list">): Promise<Res<"workspace.artifacts.list">>;
|
|
@@ -10480,15 +10324,6 @@ export interface DenchBilling {
|
|
|
10480
10324
|
upgrade(opts?: Req<"billing.upgrade">): Promise<Res<"billing.upgrade">>;
|
|
10481
10325
|
}
|
|
10482
10326
|
|
|
10483
|
-
export interface DenchApprovals {
|
|
10484
|
-
/** Pending approvals in the workspace. Permission: `approvals:read`. Wraps `workspace.approvals.list`. */
|
|
10485
|
-
list(): Promise<Res<"workspace.approvals.list">>;
|
|
10486
|
-
/** Ask a human to approve an action. Permission: `approvals:write`. Wraps `approval.request`. */
|
|
10487
|
-
request(request: Req<"approval.request">): Promise<Res<"approval.request">>;
|
|
10488
|
-
/** Approve or reject a pending approval. Permission: `approvals:write`. Wraps `approval.decide`. */
|
|
10489
|
-
decide(approvalId: string, decision: Req<"approval.decide">["decision"], opts?: Omit<Req<"approval.decide">, "approvalId" | "decision">): Promise<Res<"approval.decide">>;
|
|
10490
|
-
}
|
|
10491
|
-
|
|
10492
10327
|
export interface DenchMemory {
|
|
10493
10328
|
/** The workspace's saved memories (legacy shape). Permission: `memory:read`. @deprecated Use memory.search(query). */
|
|
10494
10329
|
get(): Promise<unknown>;
|
|
@@ -10750,7 +10585,6 @@ export interface Dench {
|
|
|
10750
10585
|
campaigns: DenchCampaigns;
|
|
10751
10586
|
email: DenchEmail;
|
|
10752
10587
|
billing: DenchBilling;
|
|
10753
|
-
approvals: DenchApprovals;
|
|
10754
10588
|
memory: DenchMemory;
|
|
10755
10589
|
workspace: DenchWorkspace;
|
|
10756
10590
|
search: DenchSearch;
|
package/dench.ts
CHANGED
|
@@ -119,7 +119,6 @@ function createCliConvexClient(convexUrl: string): ConvexHttpClient {
|
|
|
119
119
|
type WorkspaceOverview = {
|
|
120
120
|
agents: Array<{ _id: string } & JsonRecord>;
|
|
121
121
|
projects: JsonRecord[];
|
|
122
|
-
approvals: Array<{ status?: string } & JsonRecord>;
|
|
123
122
|
rules: JsonRecord[];
|
|
124
123
|
recentArtifacts?: JsonRecord[];
|
|
125
124
|
activeRuns?: JsonRecord[];
|
|
@@ -134,21 +133,14 @@ type AgentStatus = {
|
|
|
134
133
|
agent?: { id?: string } & JsonRecord;
|
|
135
134
|
counts?: JsonRecord;
|
|
136
135
|
rules?: JsonRecord[];
|
|
137
|
-
approvals?: Array<{ status?: string; agentId?: string } & JsonRecord>;
|
|
138
136
|
};
|
|
139
137
|
|
|
140
138
|
const api = {
|
|
141
139
|
functions: {
|
|
142
140
|
agentWorkspace: {
|
|
143
|
-
agentDecideApproval: makeFunctionReference<"mutation">(
|
|
144
|
-
"functions/agentWorkspace:agentDecideApproval",
|
|
145
|
-
),
|
|
146
141
|
agentListArtifacts: makeFunctionReference<"query">(
|
|
147
142
|
"functions/agentWorkspace:agentListArtifacts",
|
|
148
143
|
),
|
|
149
|
-
agentRequestApproval: makeFunctionReference<"mutation">(
|
|
150
|
-
"functions/agentWorkspace:agentRequestApproval",
|
|
151
|
-
),
|
|
152
144
|
agentSaveMemory: makeFunctionReference<"mutation">(
|
|
153
145
|
"functions/agentWorkspace:agentSaveMemory",
|
|
154
146
|
),
|
|
@@ -170,9 +162,6 @@ const api = {
|
|
|
170
162
|
devListWorkspaceOverview: makeFunctionReference<"query">(
|
|
171
163
|
"functions/agentWorkspace:devListWorkspaceOverview",
|
|
172
164
|
),
|
|
173
|
-
devRequestApproval: makeFunctionReference<"mutation">(
|
|
174
|
-
"functions/agentWorkspace:devRequestApproval",
|
|
175
|
-
),
|
|
176
165
|
pollSignInRequest: makeFunctionReference<"mutation">(
|
|
177
166
|
"functions/agentWorkspace:pollSignInRequest",
|
|
178
167
|
),
|
|
@@ -330,16 +319,6 @@ function stringArrayField(record: JsonRecord | undefined, name: string) {
|
|
|
330
319
|
: [];
|
|
331
320
|
}
|
|
332
321
|
|
|
333
|
-
function throwIfCliError(value: unknown) {
|
|
334
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
const record = value as JsonRecord;
|
|
338
|
-
if (record.ok === false && typeof record.error === "string") {
|
|
339
|
-
throw new CliError(record.error, publicErrorDetails(record));
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
|
|
343
322
|
function normalizeCliError(error: unknown): CliError {
|
|
344
323
|
if (error instanceof CliError) {
|
|
345
324
|
error.payload = { ...error.payload, ...publicErrorDetails(error.payload) };
|
|
@@ -512,16 +491,13 @@ Usage:
|
|
|
512
491
|
dench companies find --name "Acme" [--domain acme.com] [--keywords fintech] [--save-as "Target accounts"] [--limit 500] [--page-token <token>] [--json]
|
|
513
492
|
dench jobs find --titles "Account Executive" [--locations "San Francisco"] [--save-as "AE openings"] [--limit 500] [--page-token <token>] [--json]
|
|
514
493
|
dench suggested-work [--json]
|
|
515
|
-
dench approval request "message" [--json]
|
|
516
|
-
dench approval approve <approvalId> [--evidence "User said yes in chat"] [--json]
|
|
517
|
-
dench approval reject <approvalId> [--evidence "User said no in chat"] [--json]
|
|
518
494
|
dench billing status [--json]
|
|
519
495
|
dench billing topup --amount 5 [--no-open] [--json]
|
|
520
496
|
dench integrations [--json]
|
|
521
497
|
dench tool status [toolkit] [--json]
|
|
522
498
|
dench tool connect <toolkit> [--json]
|
|
523
499
|
dench tool search "create github issue" [--toolkit github] [--limit 20] [--compact] [--json]
|
|
524
|
-
dench tool run <tool_slug> --args '{"key":"value"}' [--account <connected_account_id>] [--
|
|
500
|
+
dench tool run <tool_slug> --args '{"key":"value"}' [--account <connected_account_id>] [--json]
|
|
525
501
|
CRM:
|
|
526
502
|
dench crm objects <list|get|create|update|rename|delete> ...
|
|
527
503
|
dench crm fields <list|create|update|delete|reorder> <object> ...
|
|
@@ -716,8 +692,8 @@ Usage:
|
|
|
716
692
|
dench context --sections organisation,user,memory [--json]
|
|
717
693
|
dench context set <identity|organisation|user|tools|rules> --stdin | --content "text" [--json]
|
|
718
694
|
|
|
719
|
-
Shows the current workspace, current agent, assigned tasks,
|
|
720
|
-
|
|
695
|
+
Shows the current workspace, current agent, assigned tasks, connected apps
|
|
696
|
+
when available, and useful next commands.
|
|
721
697
|
|
|
722
698
|
Use --instructions (or dench instructions) to print the standing workspace
|
|
723
699
|
instructions for the current workspace. Context and memory do not persist
|
|
@@ -842,7 +818,7 @@ Usage:
|
|
|
842
818
|
|
|
843
819
|
Notes:
|
|
844
820
|
--mine and --self return the current workspace, current agent, counts, rules,
|
|
845
|
-
assigned tasks
|
|
821
|
+
and assigned tasks.
|
|
846
822
|
Use dench status --mine --json during setup verification.
|
|
847
823
|
`);
|
|
848
824
|
}
|
|
@@ -2985,7 +2961,6 @@ function workspaceUrls(host: string, workspaceSlug: string | undefined) {
|
|
|
2985
2961
|
const base = normalizeHost(host);
|
|
2986
2962
|
return {
|
|
2987
2963
|
dashboardUrl: `${base}/${workspaceSlug}`,
|
|
2988
|
-
approvalsUrl: `${base}/${workspaceSlug}/approvals`,
|
|
2989
2964
|
};
|
|
2990
2965
|
}
|
|
2991
2966
|
|
|
@@ -2994,7 +2969,6 @@ function nextContextCommands() {
|
|
|
2994
2969
|
"dench context --json",
|
|
2995
2970
|
"dench crm entries list task --json",
|
|
2996
2971
|
'dench tool search "what you need" --toolkit <app>',
|
|
2997
|
-
'dench approval request "Risky action to approve"',
|
|
2998
2972
|
];
|
|
2999
2973
|
}
|
|
3000
2974
|
|
|
@@ -3050,10 +3024,6 @@ async function buildContext(runtime: Runtime) {
|
|
|
3050
3024
|
};
|
|
3051
3025
|
}
|
|
3052
3026
|
|
|
3053
|
-
function formatCount(value: unknown) {
|
|
3054
|
-
return typeof value === "number" ? String(value) : "0";
|
|
3055
|
-
}
|
|
3056
|
-
|
|
3057
3027
|
function agentDisplayName(agent: JsonRecord | undefined) {
|
|
3058
3028
|
return (
|
|
3059
3029
|
stringField(agent, "name") ??
|
|
@@ -3065,12 +3035,10 @@ function agentDisplayName(agent: JsonRecord | undefined) {
|
|
|
3065
3035
|
}
|
|
3066
3036
|
|
|
3067
3037
|
function formatContext(context: JsonRecord) {
|
|
3068
|
-
const counts = asRecord(context.counts);
|
|
3069
3038
|
const agent = asRecord(context.agent);
|
|
3070
3039
|
const workspace = asRecord(context.workspace);
|
|
3071
3040
|
const connectedApps = asRecord(context.connectedApps);
|
|
3072
3041
|
const connections = asRecordArray(connectedApps?.connections);
|
|
3073
|
-
const approvals = asRecordArray(context.pendingApprovals);
|
|
3074
3042
|
const suggestedWork = asRecordArray(context.suggestedWork);
|
|
3075
3043
|
const memories = asRecordArray(context.memory);
|
|
3076
3044
|
const nextActions = Array.isArray(context.nextActions)
|
|
@@ -3092,33 +3060,10 @@ function formatContext(context: JsonRecord) {
|
|
|
3092
3060
|
`Agent: ${agentDisplayName(agent)}${
|
|
3093
3061
|
stringField(agent, "kind") ? ` [${stringField(agent, "kind")}]` : ""
|
|
3094
3062
|
}`,
|
|
3095
|
-
`Counts: ${formatCount(
|
|
3096
|
-
counts?.myPendingApprovals ?? approvals.length,
|
|
3097
|
-
)} pending approvals`,
|
|
3098
3063
|
];
|
|
3099
3064
|
|
|
3100
3065
|
const dashboardUrl = stringField(context, "dashboardUrl");
|
|
3101
|
-
|
|
3102
|
-
if (dashboardUrl || approvalsUrl) {
|
|
3103
|
-
lines.push(
|
|
3104
|
-
`Dashboard: ${dashboardUrl ?? "unknown"}`,
|
|
3105
|
-
`Approvals: ${approvalsUrl ?? "unknown"}`,
|
|
3106
|
-
);
|
|
3107
|
-
}
|
|
3108
|
-
|
|
3109
|
-
lines.push("", "Pending approvals requested by me:");
|
|
3110
|
-
if (approvals.length === 0) {
|
|
3111
|
-
lines.push(" none");
|
|
3112
|
-
} else {
|
|
3113
|
-
lines.push(
|
|
3114
|
-
...approvals
|
|
3115
|
-
.slice(0, 5)
|
|
3116
|
-
.map(
|
|
3117
|
-
(approval) =>
|
|
3118
|
-
` - ${stringField(approval, "title") ?? stringField(approval, "id") ?? "untitled"} [${stringField(approval, "risk") ?? "unknown"}]`,
|
|
3119
|
-
),
|
|
3120
|
-
);
|
|
3121
|
-
}
|
|
3066
|
+
if (dashboardUrl) lines.push(`Dashboard: ${dashboardUrl}`);
|
|
3122
3067
|
|
|
3123
3068
|
lines.push("", "Connected apps:");
|
|
3124
3069
|
// The two brokers fail independently. Listing whichever half we DID get, and
|
|
@@ -3243,28 +3188,11 @@ function summarizeDevOverview(workspaceSlug: string, data: WorkspaceOverview) {
|
|
|
3243
3188
|
workspace: workspaceSlug,
|
|
3244
3189
|
agents: data.agents.length,
|
|
3245
3190
|
projects: data.projects.length,
|
|
3246
|
-
approvals: data.approvals.filter(
|
|
3247
|
-
(approval) => approval.status === "pending",
|
|
3248
|
-
).length,
|
|
3249
3191
|
rules: data.rules.length,
|
|
3250
3192
|
};
|
|
3251
3193
|
}
|
|
3252
3194
|
|
|
3253
|
-
function compactApproval(approval: JsonRecord) {
|
|
3254
|
-
return {
|
|
3255
|
-
id: approval.id ?? approval._id,
|
|
3256
|
-
title: approval.title,
|
|
3257
|
-
risk: approval.risk,
|
|
3258
|
-
status: approval.status,
|
|
3259
|
-
createdAt: approval.createdAt,
|
|
3260
|
-
};
|
|
3261
|
-
}
|
|
3262
|
-
|
|
3263
3195
|
function summarizeAgentStatus(status: AgentStatus, host?: string) {
|
|
3264
|
-
const agentId = status.agent?.id;
|
|
3265
|
-
const pendingApprovals = (status.approvals ?? []).filter(
|
|
3266
|
-
(approval) => approval.status === "pending" && approval.agentId === agentId,
|
|
3267
|
-
);
|
|
3268
3196
|
const urls = host ? workspaceUrls(host, status.workspaceSlug) : {};
|
|
3269
3197
|
|
|
3270
3198
|
return {
|
|
@@ -3272,21 +3200,14 @@ function summarizeAgentStatus(status: AgentStatus, host?: string) {
|
|
|
3272
3200
|
workspaceSlug: status.workspaceSlug,
|
|
3273
3201
|
...urls,
|
|
3274
3202
|
agent: status.agent,
|
|
3275
|
-
counts: {
|
|
3276
|
-
...(status.counts ?? {}),
|
|
3277
|
-
myPendingApprovals: pendingApprovals.length,
|
|
3278
|
-
},
|
|
3203
|
+
counts: status.counts ?? {},
|
|
3279
3204
|
rules: status.rules ?? [],
|
|
3280
|
-
pendingApprovals: pendingApprovals.map(compactApproval),
|
|
3281
3205
|
};
|
|
3282
3206
|
}
|
|
3283
3207
|
|
|
3284
3208
|
function summarizeDevMine(workspaceSlug: string, data: WorkspaceOverview) {
|
|
3285
3209
|
const agentId = option("--agent") ?? data.agents[0]?._id;
|
|
3286
3210
|
const agent = data.agents.find((item) => item._id === agentId) ?? null;
|
|
3287
|
-
const pendingApprovals = data.approvals.filter(
|
|
3288
|
-
(approval) => approval.status === "pending" && approval.agentId === agentId,
|
|
3289
|
-
);
|
|
3290
3211
|
|
|
3291
3212
|
return {
|
|
3292
3213
|
workspace: workspaceSlug,
|
|
@@ -3294,14 +3215,9 @@ function summarizeDevMine(workspaceSlug: string, data: WorkspaceOverview) {
|
|
|
3294
3215
|
counts: {
|
|
3295
3216
|
agents: data.agents.length,
|
|
3296
3217
|
projects: data.projects.length,
|
|
3297
|
-
pendingApprovals: data.approvals.filter(
|
|
3298
|
-
(approval) => approval.status === "pending",
|
|
3299
|
-
).length,
|
|
3300
3218
|
rules: data.rules.length,
|
|
3301
|
-
myPendingApprovals: pendingApprovals.length,
|
|
3302
3219
|
},
|
|
3303
3220
|
rules: data.rules,
|
|
3304
|
-
pendingApprovals: pendingApprovals.map(compactApproval),
|
|
3305
3221
|
};
|
|
3306
3222
|
}
|
|
3307
3223
|
|
|
@@ -5684,22 +5600,6 @@ async function main() {
|
|
|
5684
5600
|
return;
|
|
5685
5601
|
}
|
|
5686
5602
|
|
|
5687
|
-
if (command === "approvals") {
|
|
5688
|
-
if (runtime.mode === "session" || runtime.mode === "apiKey") {
|
|
5689
|
-
const status = await runtime.client.query(
|
|
5690
|
-
api.functions.agentWorkspace.whatCanIDoHere,
|
|
5691
|
-
{
|
|
5692
|
-
sessionToken: runtime.sessionToken,
|
|
5693
|
-
},
|
|
5694
|
-
);
|
|
5695
|
-
print(status.approvals);
|
|
5696
|
-
return;
|
|
5697
|
-
}
|
|
5698
|
-
const data = await devOverview(runtime);
|
|
5699
|
-
print(data.approvals);
|
|
5700
|
-
return;
|
|
5701
|
-
}
|
|
5702
|
-
|
|
5703
5603
|
if (command === "project" && subcommand === "create") {
|
|
5704
5604
|
if (runtime.mode !== "dev") {
|
|
5705
5605
|
throw new Error(
|
|
@@ -5721,64 +5621,6 @@ async function main() {
|
|
|
5721
5621
|
return;
|
|
5722
5622
|
}
|
|
5723
5623
|
|
|
5724
|
-
if (command === "approval" && subcommand === "request") {
|
|
5725
|
-
const title = positional(2);
|
|
5726
|
-
if (!title) throw new Error("Missing approval title");
|
|
5727
|
-
if (runtime.mode === "session" || runtime.mode === "apiKey") {
|
|
5728
|
-
print(
|
|
5729
|
-
await runtime.client.mutation(
|
|
5730
|
-
api.functions.agentWorkspace.agentRequestApproval,
|
|
5731
|
-
{
|
|
5732
|
-
sessionToken: runtime.sessionToken,
|
|
5733
|
-
title,
|
|
5734
|
-
reason: option("--reason"),
|
|
5735
|
-
risk: (option("--risk") ?? "high") as "low" | "medium" | "high",
|
|
5736
|
-
},
|
|
5737
|
-
),
|
|
5738
|
-
);
|
|
5739
|
-
return;
|
|
5740
|
-
}
|
|
5741
|
-
const approvalId = await runtime.client.mutation(
|
|
5742
|
-
api.functions.agentWorkspace.devRequestApproval,
|
|
5743
|
-
{
|
|
5744
|
-
...runtime.workspaceArgs,
|
|
5745
|
-
title,
|
|
5746
|
-
reason:
|
|
5747
|
-
option("--reason") ??
|
|
5748
|
-
"Agent requests human approval before a risky action.",
|
|
5749
|
-
risk: (option("--risk") ?? "high") as "low" | "medium" | "high",
|
|
5750
|
-
agentId: option("--agent") as never,
|
|
5751
|
-
},
|
|
5752
|
-
);
|
|
5753
|
-
print({ ok: true, approvalId });
|
|
5754
|
-
return;
|
|
5755
|
-
}
|
|
5756
|
-
|
|
5757
|
-
if (
|
|
5758
|
-
command === "approval" &&
|
|
5759
|
-
(subcommand === "approve" || subcommand === "reject")
|
|
5760
|
-
) {
|
|
5761
|
-
const approvalId = positional(2);
|
|
5762
|
-
if (!approvalId) throw new Error("Missing approval id");
|
|
5763
|
-
const authedRuntime = requireAuthenticatedRuntime(
|
|
5764
|
-
runtime,
|
|
5765
|
-
"dench approval approve/reject",
|
|
5766
|
-
);
|
|
5767
|
-
const decision = subcommand === "approve" ? "approved" : "rejected";
|
|
5768
|
-
const result = await authedRuntime.client.mutation(
|
|
5769
|
-
api.functions.agentWorkspace.agentDecideApproval,
|
|
5770
|
-
{
|
|
5771
|
-
sessionToken: authedRuntime.sessionToken,
|
|
5772
|
-
approvalId: approvalId as never,
|
|
5773
|
-
decision,
|
|
5774
|
-
evidence: option("--evidence"),
|
|
5775
|
-
},
|
|
5776
|
-
);
|
|
5777
|
-
throwIfCliError(result);
|
|
5778
|
-
print(result);
|
|
5779
|
-
return;
|
|
5780
|
-
}
|
|
5781
|
-
|
|
5782
5624
|
throw new Error(`Unknown command: ${filteredArgs.join(" ")}`);
|
|
5783
5625
|
}
|
|
5784
5626
|
|