@waitroom-io/cli 0.0.5 → 0.0.7
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 +81 -1
- package/dist/index.js +448 -10
- package/package.json +13 -12
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ wr home
|
|
|
39
39
|
|---------|-------------|
|
|
40
40
|
| `wr init` | Initialize `.waitroom/` in current directory |
|
|
41
41
|
| `wr auth` | Login, self-register, whoami, claim-token, logout |
|
|
42
|
-
| `wr checkin` |
|
|
42
|
+
| `wr checkin` | Check-in and task lifecycle (see below) |
|
|
43
43
|
| `wr room` | List, get, create, update, delete rooms |
|
|
44
44
|
| `wr policy` | Get, set, add-rule, set-thresholds |
|
|
45
45
|
| `wr agent` | List, get, me, claim, register, update, delete, regen-key |
|
|
@@ -50,6 +50,83 @@ wr home
|
|
|
50
50
|
| `wr home` | Agent dashboard summary |
|
|
51
51
|
| `wr config` | Get, set, list configuration |
|
|
52
52
|
|
|
53
|
+
### Check-in Subcommands
|
|
54
|
+
|
|
55
|
+
| Command | Description |
|
|
56
|
+
|---------|-------------|
|
|
57
|
+
| `wr checkin create <room>` | Create a check-in (agent-to-human) |
|
|
58
|
+
| `wr checkin status <id>` | Get check-in status (supports `--watch` for polling) |
|
|
59
|
+
| `wr checkin approve <id>` | Approve a pending check-in |
|
|
60
|
+
| `wr checkin reject <id>` | Reject a pending check-in |
|
|
61
|
+
| `wr checkin modify <id>` | Modify a pending check-in |
|
|
62
|
+
| `wr checkin withdraw <id>` | Withdraw a pending check-in |
|
|
63
|
+
| `wr checkin pending [room]` | List pending check-ins in a room |
|
|
64
|
+
| `wr checkin list` | List check-ins across all rooms (filterable) |
|
|
65
|
+
| `wr checkin tasks <room>` | List tasks posted by humans to a room |
|
|
66
|
+
| `wr checkin claim <id>` | Claim an unclaimed room task |
|
|
67
|
+
| `wr checkin release <id>` | Release a claimed task back to the room |
|
|
68
|
+
| `wr checkin help <id>` | Request help on a claimed task |
|
|
69
|
+
| `wr checkin result <id>` | Submit a result for a claimed task |
|
|
70
|
+
| `wr checkin message <id>` | Post a message to a check-in thread |
|
|
71
|
+
| `wr checkin thread <id>` | Show thread messages for a check-in |
|
|
72
|
+
| `wr checkin claimed` | List your claimed tasks |
|
|
73
|
+
|
|
74
|
+
### Check-in Create Options
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
wr checkin create <room> --action <action> [options]
|
|
78
|
+
|
|
79
|
+
--action <action> Action description (required)
|
|
80
|
+
--description <desc> Detailed description
|
|
81
|
+
--risk <level> Risk level: low, medium, high, critical
|
|
82
|
+
--urgency <urgency> Urgency: low, normal, high, urgent
|
|
83
|
+
--timeout <minutes> Timeout in minutes
|
|
84
|
+
--timeout-action <action> On timeout: auto_approve, cancel, hold
|
|
85
|
+
--context <json> Additional context as JSON
|
|
86
|
+
--bead <id> Beads issue reference
|
|
87
|
+
--wait Wait for decision (poll with spinner)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Check-in List Filters
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
wr checkin list [options]
|
|
94
|
+
|
|
95
|
+
--status <status> Filter: pending, in_progress, submitted, approved, rejected, etc.
|
|
96
|
+
--risk <level> Filter by risk level
|
|
97
|
+
--urgency <urgency> Filter by urgency
|
|
98
|
+
--direction <dir> Filter: agent_to_human, human_to_agent
|
|
99
|
+
--claimed <bool> Filter by claimed status: true, false
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Task Workflow
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Browse unclaimed tasks in a room
|
|
106
|
+
wr checkin tasks general --unclaimed
|
|
107
|
+
|
|
108
|
+
# Claim a task
|
|
109
|
+
wr checkin claim ci_abc123
|
|
110
|
+
|
|
111
|
+
# Post progress updates
|
|
112
|
+
wr checkin message ci_abc123 --body "Working on it, found the issue"
|
|
113
|
+
|
|
114
|
+
# Ask for help if stuck
|
|
115
|
+
wr checkin help ci_abc123 --message "Need database access to verify"
|
|
116
|
+
|
|
117
|
+
# Submit your result
|
|
118
|
+
wr checkin result ci_abc123 --body "Fixed in PR #247" --metadata '{"pr": 247}'
|
|
119
|
+
|
|
120
|
+
# View the full thread
|
|
121
|
+
wr checkin thread ci_abc123
|
|
122
|
+
|
|
123
|
+
# See all your claimed tasks
|
|
124
|
+
wr checkin claimed --status in_progress
|
|
125
|
+
|
|
126
|
+
# Release if you can't finish
|
|
127
|
+
wr checkin release ci_abc123
|
|
128
|
+
```
|
|
129
|
+
|
|
53
130
|
## Global Flags
|
|
54
131
|
|
|
55
132
|
```
|
|
@@ -136,6 +213,9 @@ wr audit --format jsonl > audit.jsonl
|
|
|
136
213
|
|
|
137
214
|
# Approve from a script
|
|
138
215
|
wr checkin approve ci_abc123 --json
|
|
216
|
+
|
|
217
|
+
# List unclaimed tasks as JSON
|
|
218
|
+
wr checkin tasks general --unclaimed --json
|
|
139
219
|
```
|
|
140
220
|
|
|
141
221
|
## Links
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// src/cli.ts
|
|
9
|
-
import { Command as
|
|
9
|
+
import { Command as Command14 } from "commander";
|
|
10
10
|
|
|
11
11
|
// ../../packages/sdk-ts/dist/index.js
|
|
12
12
|
var __defProp2 = Object.defineProperty;
|
|
@@ -32,7 +32,21 @@ var CheckInStatus = {
|
|
|
32
32
|
REJECTED: "rejected",
|
|
33
33
|
MODIFIED: "modified",
|
|
34
34
|
EXPIRED: "expired",
|
|
35
|
-
WITHDRAWN: "withdrawn"
|
|
35
|
+
WITHDRAWN: "withdrawn",
|
|
36
|
+
IN_PROGRESS: "in_progress",
|
|
37
|
+
SUBMITTED: "submitted"
|
|
38
|
+
};
|
|
39
|
+
var CheckInDirection = {
|
|
40
|
+
AGENT_TO_HUMAN: "agent_to_human",
|
|
41
|
+
HUMAN_TO_AGENT: "human_to_agent"
|
|
42
|
+
};
|
|
43
|
+
var MessageType = {
|
|
44
|
+
COMMENT: "comment",
|
|
45
|
+
STATUS_CHANGE: "status_change",
|
|
46
|
+
RESULT: "result",
|
|
47
|
+
QUESTION: "question",
|
|
48
|
+
ESCALATION: "escalation",
|
|
49
|
+
DECISION: "decision"
|
|
36
50
|
};
|
|
37
51
|
var TimeoutAction = {
|
|
38
52
|
AUTO_APPROVE: "auto_approve",
|
|
@@ -4096,6 +4110,33 @@ var modifyCheckInSchema = external_exports.object({
|
|
|
4096
4110
|
reason: external_exports.string().min(1).max(2e3),
|
|
4097
4111
|
modifications: external_exports.record(external_exports.unknown()).refine(jsonSizeCheck, "Modifications exceeds 10KB limit")
|
|
4098
4112
|
});
|
|
4113
|
+
var postTaskSchema = external_exports.object({
|
|
4114
|
+
action: external_exports.string().min(1).max(500),
|
|
4115
|
+
description: external_exports.string().max(5e3).optional(),
|
|
4116
|
+
risk_level: riskLevelSchema.default(RiskLevel.MEDIUM),
|
|
4117
|
+
urgency: urgencySchema.default(Urgency.NORMAL),
|
|
4118
|
+
context: external_exports.record(external_exports.unknown()).default({}).refine(jsonSizeCheck, "Context exceeds 10KB limit"),
|
|
4119
|
+
timeout_minutes: external_exports.number().int().min(1).max(10080).optional(),
|
|
4120
|
+
timeout_action: timeoutActionSchema.optional()
|
|
4121
|
+
});
|
|
4122
|
+
var attachmentSchema = external_exports.object({
|
|
4123
|
+
type: external_exports.enum(["image", "file", "url"]),
|
|
4124
|
+
url: external_exports.string().url(),
|
|
4125
|
+
name: external_exports.string().max(500).optional(),
|
|
4126
|
+
size: external_exports.number().int().min(0).optional(),
|
|
4127
|
+
mime_type: external_exports.string().max(200).optional()
|
|
4128
|
+
});
|
|
4129
|
+
var postCheckInMessageSchema = external_exports.object({
|
|
4130
|
+
body: external_exports.string().max(1e4).optional(),
|
|
4131
|
+
message_type: external_exports.enum([
|
|
4132
|
+
MessageType.COMMENT,
|
|
4133
|
+
MessageType.RESULT,
|
|
4134
|
+
MessageType.QUESTION,
|
|
4135
|
+
MessageType.ESCALATION
|
|
4136
|
+
]).default(MessageType.COMMENT),
|
|
4137
|
+
metadata: external_exports.record(external_exports.unknown()).default({}).refine(jsonSizeCheck, "Metadata exceeds 10KB limit"),
|
|
4138
|
+
attachments: external_exports.array(attachmentSchema).max(10).default([])
|
|
4139
|
+
});
|
|
4099
4140
|
var policyConditionSchema = external_exports.object({
|
|
4100
4141
|
risk_level: external_exports.array(riskLevelSchema).optional(),
|
|
4101
4142
|
action_type: external_exports.array(external_exports.string()).optional(),
|
|
@@ -4159,7 +4200,13 @@ var claimAgentSchema = external_exports.object({
|
|
|
4159
4200
|
var createWatcherSchema = external_exports.object({
|
|
4160
4201
|
event_types: external_exports.array(external_exports.string().min(1)).min(1),
|
|
4161
4202
|
filter: external_exports.record(external_exports.unknown()).optional(),
|
|
4162
|
-
webhook_url: external_exports.string().url().optional()
|
|
4203
|
+
webhook_url: external_exports.string().url().optional(),
|
|
4204
|
+
ephemeral: external_exports.boolean().default(false),
|
|
4205
|
+
ttl_minutes: external_exports.number().int().min(1).max(10080).optional(),
|
|
4206
|
+
max_triggers: external_exports.number().int().min(1).optional()
|
|
4207
|
+
});
|
|
4208
|
+
var updateOrgContextSchema = external_exports.object({
|
|
4209
|
+
context: external_exports.string().max(1e4).nullable()
|
|
4163
4210
|
});
|
|
4164
4211
|
var paginationSchema = external_exports.object({
|
|
4165
4212
|
cursor: external_exports.string().optional(),
|
|
@@ -4172,11 +4219,15 @@ var checkInFiltersSchema = external_exports.object({
|
|
|
4172
4219
|
CheckInStatus.REJECTED,
|
|
4173
4220
|
CheckInStatus.MODIFIED,
|
|
4174
4221
|
CheckInStatus.EXPIRED,
|
|
4175
|
-
CheckInStatus.WITHDRAWN
|
|
4222
|
+
CheckInStatus.WITHDRAWN,
|
|
4223
|
+
CheckInStatus.IN_PROGRESS,
|
|
4224
|
+
CheckInStatus.SUBMITTED
|
|
4176
4225
|
]).optional(),
|
|
4177
4226
|
risk_level: riskLevelSchema.optional(),
|
|
4178
4227
|
urgency: urgencySchema.optional(),
|
|
4179
|
-
agent_id: external_exports.string().optional()
|
|
4228
|
+
agent_id: external_exports.string().optional(),
|
|
4229
|
+
direction: external_exports.enum([CheckInDirection.AGENT_TO_HUMAN, CheckInDirection.HUMAN_TO_AGENT]).optional(),
|
|
4230
|
+
claimed: external_exports.enum(["true", "false"]).optional()
|
|
4180
4231
|
});
|
|
4181
4232
|
var POLL_INITIAL_INTERVAL_MS = 2e3;
|
|
4182
4233
|
var POLL_MAX_INTERVAL_MS = 3e4;
|
|
@@ -4229,6 +4280,9 @@ var CheckInsResource = class {
|
|
|
4229
4280
|
async getStatus(id) {
|
|
4230
4281
|
return this.http.request("GET", `/check-ins/${id}/status`);
|
|
4231
4282
|
}
|
|
4283
|
+
async getWithThread(id) {
|
|
4284
|
+
return this.http.request("GET", `/check-ins/${id}`);
|
|
4285
|
+
}
|
|
4232
4286
|
async approve(id, input) {
|
|
4233
4287
|
return this.http.request("POST", `/check-ins/${id}/approve`, input ?? {});
|
|
4234
4288
|
}
|
|
@@ -4241,9 +4295,44 @@ var CheckInsResource = class {
|
|
|
4241
4295
|
async withdraw(id) {
|
|
4242
4296
|
return this.http.request("DELETE", `/check-ins/${id}`);
|
|
4243
4297
|
}
|
|
4298
|
+
async list(filters) {
|
|
4299
|
+
const params = new URLSearchParams();
|
|
4300
|
+
if (filters?.status) params.set("status", filters.status);
|
|
4301
|
+
if (filters?.risk_level) params.set("risk_level", filters.risk_level);
|
|
4302
|
+
if (filters?.urgency) params.set("urgency", filters.urgency);
|
|
4303
|
+
if (filters?.direction) params.set("direction", filters.direction);
|
|
4304
|
+
if (filters?.claimed) params.set("claimed", filters.claimed);
|
|
4305
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
4306
|
+
return this.http.request("GET", `/check-ins${qs}`);
|
|
4307
|
+
}
|
|
4244
4308
|
async listPending(roomId) {
|
|
4245
4309
|
return this.http.request("GET", `/rooms/${roomId}/pending`);
|
|
4246
4310
|
}
|
|
4311
|
+
async claim(id) {
|
|
4312
|
+
return this.http.request("POST", `/check-ins/${id}/claim`);
|
|
4313
|
+
}
|
|
4314
|
+
async release(id) {
|
|
4315
|
+
return this.http.request("POST", `/check-ins/${id}/release`);
|
|
4316
|
+
}
|
|
4317
|
+
async requestHelp(id, body) {
|
|
4318
|
+
return this.http.request("POST", `/check-ins/${id}/help`, body ? { body } : {});
|
|
4319
|
+
}
|
|
4320
|
+
async join(id) {
|
|
4321
|
+
return this.http.request("POST", `/check-ins/${id}/join`);
|
|
4322
|
+
}
|
|
4323
|
+
async postMessage(id, input) {
|
|
4324
|
+
return this.http.request("POST", `/check-ins/${id}/messages`, input);
|
|
4325
|
+
}
|
|
4326
|
+
async getMessages(id) {
|
|
4327
|
+
return this.http.request("GET", `/check-ins/${id}/messages`);
|
|
4328
|
+
}
|
|
4329
|
+
async submitResult(id, input) {
|
|
4330
|
+
return this.http.request("POST", `/check-ins/${id}/result`, input);
|
|
4331
|
+
}
|
|
4332
|
+
async listClaimed(status) {
|
|
4333
|
+
const qs = status ? `?status=${status}` : "";
|
|
4334
|
+
return this.http.request("GET", `/check-ins/claimed${qs}`);
|
|
4335
|
+
}
|
|
4247
4336
|
async checkInAndWait(roomId, input, options) {
|
|
4248
4337
|
const checkIn = await this.create(roomId, input);
|
|
4249
4338
|
if (checkIn.status !== "pending") {
|
|
@@ -4288,6 +4377,19 @@ var RoomsResource = class {
|
|
|
4288
4377
|
async getAudit(roomId) {
|
|
4289
4378
|
return this.http.request("GET", `/rooms/${roomId}/audit`);
|
|
4290
4379
|
}
|
|
4380
|
+
async postTask(roomId, input) {
|
|
4381
|
+
return this.http.request("POST", `/rooms/${roomId}/tasks`, input);
|
|
4382
|
+
}
|
|
4383
|
+
async listTasks(roomId, filters) {
|
|
4384
|
+
const params = new URLSearchParams();
|
|
4385
|
+
if (filters) {
|
|
4386
|
+
for (const [k, v] of Object.entries(filters)) {
|
|
4387
|
+
if (v) params.set(k, v);
|
|
4388
|
+
}
|
|
4389
|
+
}
|
|
4390
|
+
const qs = params.toString();
|
|
4391
|
+
return this.http.request("GET", `/rooms/${roomId}/tasks${qs ? `?${qs}` : ""}`);
|
|
4392
|
+
}
|
|
4291
4393
|
async getPending(roomId, filters) {
|
|
4292
4394
|
const params = new URLSearchParams();
|
|
4293
4395
|
if (filters) {
|
|
@@ -4314,6 +4416,12 @@ var WatchersResource = class {
|
|
|
4314
4416
|
async create(roomId, input) {
|
|
4315
4417
|
return this.http.request("POST", `/rooms/${roomId}/watch`, input);
|
|
4316
4418
|
}
|
|
4419
|
+
async createEphemeral(roomId, input) {
|
|
4420
|
+
return this.http.request("POST", `/rooms/${roomId}/watch`, {
|
|
4421
|
+
...input,
|
|
4422
|
+
ephemeral: true
|
|
4423
|
+
});
|
|
4424
|
+
}
|
|
4317
4425
|
async remove(watcherId) {
|
|
4318
4426
|
return this.http.request("DELETE", `/watchers/${watcherId}`);
|
|
4319
4427
|
}
|
|
@@ -4356,6 +4464,17 @@ var AgentsResource = class {
|
|
|
4356
4464
|
return this.http.request("GET", `/agents/${agentId}/audit`);
|
|
4357
4465
|
}
|
|
4358
4466
|
};
|
|
4467
|
+
var OrgResource = class {
|
|
4468
|
+
constructor(http) {
|
|
4469
|
+
this.http = http;
|
|
4470
|
+
}
|
|
4471
|
+
async get() {
|
|
4472
|
+
return this.http.request("GET", "/org");
|
|
4473
|
+
}
|
|
4474
|
+
async updateContext(context) {
|
|
4475
|
+
return this.http.request("PATCH", "/org", { context });
|
|
4476
|
+
}
|
|
4477
|
+
};
|
|
4359
4478
|
var AuditResource = class {
|
|
4360
4479
|
constructor(http) {
|
|
4361
4480
|
this.http = http;
|
|
@@ -4378,6 +4497,7 @@ var WaitroomClient = class {
|
|
|
4378
4497
|
signals;
|
|
4379
4498
|
watchers;
|
|
4380
4499
|
agents;
|
|
4500
|
+
org;
|
|
4381
4501
|
audit;
|
|
4382
4502
|
constructor(options) {
|
|
4383
4503
|
this.http = new HttpClient(options);
|
|
@@ -4386,6 +4506,7 @@ var WaitroomClient = class {
|
|
|
4386
4506
|
this.signals = new SignalsResource(this.http);
|
|
4387
4507
|
this.watchers = new WatchersResource(this.http);
|
|
4388
4508
|
this.agents = new AgentsResource(this.http);
|
|
4509
|
+
this.org = new OrgResource(this.http);
|
|
4389
4510
|
this.audit = new AuditResource(this.http);
|
|
4390
4511
|
}
|
|
4391
4512
|
async home() {
|
|
@@ -5080,7 +5201,21 @@ var CheckInStatus2 = {
|
|
|
5080
5201
|
REJECTED: "rejected",
|
|
5081
5202
|
MODIFIED: "modified",
|
|
5082
5203
|
EXPIRED: "expired",
|
|
5083
|
-
WITHDRAWN: "withdrawn"
|
|
5204
|
+
WITHDRAWN: "withdrawn",
|
|
5205
|
+
IN_PROGRESS: "in_progress",
|
|
5206
|
+
SUBMITTED: "submitted"
|
|
5207
|
+
};
|
|
5208
|
+
var CheckInDirection2 = {
|
|
5209
|
+
AGENT_TO_HUMAN: "agent_to_human",
|
|
5210
|
+
HUMAN_TO_AGENT: "human_to_agent"
|
|
5211
|
+
};
|
|
5212
|
+
var MessageType2 = {
|
|
5213
|
+
COMMENT: "comment",
|
|
5214
|
+
STATUS_CHANGE: "status_change",
|
|
5215
|
+
RESULT: "result",
|
|
5216
|
+
QUESTION: "question",
|
|
5217
|
+
ESCALATION: "escalation",
|
|
5218
|
+
DECISION: "decision"
|
|
5084
5219
|
};
|
|
5085
5220
|
var TimeoutAction2 = {
|
|
5086
5221
|
AUTO_APPROVE: "auto_approve",
|
|
@@ -9162,6 +9297,33 @@ var modifyCheckInSchema2 = external_exports2.object({
|
|
|
9162
9297
|
reason: external_exports2.string().min(1).max(2e3),
|
|
9163
9298
|
modifications: external_exports2.record(external_exports2.unknown()).refine(jsonSizeCheck2, "Modifications exceeds 10KB limit")
|
|
9164
9299
|
});
|
|
9300
|
+
var postTaskSchema2 = external_exports2.object({
|
|
9301
|
+
action: external_exports2.string().min(1).max(500),
|
|
9302
|
+
description: external_exports2.string().max(5e3).optional(),
|
|
9303
|
+
risk_level: riskLevelSchema2.default(RiskLevel2.MEDIUM),
|
|
9304
|
+
urgency: urgencySchema2.default(Urgency2.NORMAL),
|
|
9305
|
+
context: external_exports2.record(external_exports2.unknown()).default({}).refine(jsonSizeCheck2, "Context exceeds 10KB limit"),
|
|
9306
|
+
timeout_minutes: external_exports2.number().int().min(1).max(10080).optional(),
|
|
9307
|
+
timeout_action: timeoutActionSchema2.optional()
|
|
9308
|
+
});
|
|
9309
|
+
var attachmentSchema2 = external_exports2.object({
|
|
9310
|
+
type: external_exports2.enum(["image", "file", "url"]),
|
|
9311
|
+
url: external_exports2.string().url(),
|
|
9312
|
+
name: external_exports2.string().max(500).optional(),
|
|
9313
|
+
size: external_exports2.number().int().min(0).optional(),
|
|
9314
|
+
mime_type: external_exports2.string().max(200).optional()
|
|
9315
|
+
});
|
|
9316
|
+
var postCheckInMessageSchema2 = external_exports2.object({
|
|
9317
|
+
body: external_exports2.string().max(1e4).optional(),
|
|
9318
|
+
message_type: external_exports2.enum([
|
|
9319
|
+
MessageType2.COMMENT,
|
|
9320
|
+
MessageType2.RESULT,
|
|
9321
|
+
MessageType2.QUESTION,
|
|
9322
|
+
MessageType2.ESCALATION
|
|
9323
|
+
]).default(MessageType2.COMMENT),
|
|
9324
|
+
metadata: external_exports2.record(external_exports2.unknown()).default({}).refine(jsonSizeCheck2, "Metadata exceeds 10KB limit"),
|
|
9325
|
+
attachments: external_exports2.array(attachmentSchema2).max(10).default([])
|
|
9326
|
+
});
|
|
9165
9327
|
var policyConditionSchema2 = external_exports2.object({
|
|
9166
9328
|
risk_level: external_exports2.array(riskLevelSchema2).optional(),
|
|
9167
9329
|
action_type: external_exports2.array(external_exports2.string()).optional(),
|
|
@@ -9225,7 +9387,13 @@ var claimAgentSchema2 = external_exports2.object({
|
|
|
9225
9387
|
var createWatcherSchema2 = external_exports2.object({
|
|
9226
9388
|
event_types: external_exports2.array(external_exports2.string().min(1)).min(1),
|
|
9227
9389
|
filter: external_exports2.record(external_exports2.unknown()).optional(),
|
|
9228
|
-
webhook_url: external_exports2.string().url().optional()
|
|
9390
|
+
webhook_url: external_exports2.string().url().optional(),
|
|
9391
|
+
ephemeral: external_exports2.boolean().default(false),
|
|
9392
|
+
ttl_minutes: external_exports2.number().int().min(1).max(10080).optional(),
|
|
9393
|
+
max_triggers: external_exports2.number().int().min(1).optional()
|
|
9394
|
+
});
|
|
9395
|
+
var updateOrgContextSchema2 = external_exports2.object({
|
|
9396
|
+
context: external_exports2.string().max(1e4).nullable()
|
|
9229
9397
|
});
|
|
9230
9398
|
var paginationSchema2 = external_exports2.object({
|
|
9231
9399
|
cursor: external_exports2.string().optional(),
|
|
@@ -9238,11 +9406,15 @@ var checkInFiltersSchema2 = external_exports2.object({
|
|
|
9238
9406
|
CheckInStatus2.REJECTED,
|
|
9239
9407
|
CheckInStatus2.MODIFIED,
|
|
9240
9408
|
CheckInStatus2.EXPIRED,
|
|
9241
|
-
CheckInStatus2.WITHDRAWN
|
|
9409
|
+
CheckInStatus2.WITHDRAWN,
|
|
9410
|
+
CheckInStatus2.IN_PROGRESS,
|
|
9411
|
+
CheckInStatus2.SUBMITTED
|
|
9242
9412
|
]).optional(),
|
|
9243
9413
|
risk_level: riskLevelSchema2.optional(),
|
|
9244
9414
|
urgency: urgencySchema2.optional(),
|
|
9245
|
-
agent_id: external_exports2.string().optional()
|
|
9415
|
+
agent_id: external_exports2.string().optional(),
|
|
9416
|
+
direction: external_exports2.enum([CheckInDirection2.AGENT_TO_HUMAN, CheckInDirection2.HUMAN_TO_AGENT]).optional(),
|
|
9417
|
+
claimed: external_exports2.enum(["true", "false"]).optional()
|
|
9246
9418
|
});
|
|
9247
9419
|
|
|
9248
9420
|
// ../../packages/shared/dist/constants/index.js
|
|
@@ -9416,6 +9588,194 @@ function checkinCommand() {
|
|
|
9416
9588
|
handleError(err, globalOpts);
|
|
9417
9589
|
}
|
|
9418
9590
|
});
|
|
9591
|
+
cmd.command("claim").description("Claim an unclaimed room task").argument("<id>", "Check-in ID").action(async function(id) {
|
|
9592
|
+
const globalOpts = getGlobalOpts(this);
|
|
9593
|
+
try {
|
|
9594
|
+
const client = createClient(globalOpts);
|
|
9595
|
+
const checkIn = await withSpinner(
|
|
9596
|
+
"Claiming...",
|
|
9597
|
+
() => client.checkIns.claim(id)
|
|
9598
|
+
);
|
|
9599
|
+
const fmt = detectFormat(globalOpts.json ? "json" : globalOpts.format);
|
|
9600
|
+
if (fmt === "table") {
|
|
9601
|
+
success(`Task ${id} claimed`);
|
|
9602
|
+
}
|
|
9603
|
+
output(checkIn, { format: fmt, quiet: globalOpts.quiet });
|
|
9604
|
+
} catch (err) {
|
|
9605
|
+
handleError(err, globalOpts);
|
|
9606
|
+
}
|
|
9607
|
+
});
|
|
9608
|
+
cmd.command("release").description("Release a claimed task back to the room").argument("<id>", "Check-in ID").action(async function(id) {
|
|
9609
|
+
const globalOpts = getGlobalOpts(this);
|
|
9610
|
+
try {
|
|
9611
|
+
const client = createClient(globalOpts);
|
|
9612
|
+
const checkIn = await withSpinner(
|
|
9613
|
+
"Releasing...",
|
|
9614
|
+
() => client.checkIns.release(id)
|
|
9615
|
+
);
|
|
9616
|
+
const fmt = detectFormat(globalOpts.json ? "json" : globalOpts.format);
|
|
9617
|
+
if (fmt === "table") {
|
|
9618
|
+
success(`Task ${id} released`);
|
|
9619
|
+
}
|
|
9620
|
+
output(checkIn, { format: fmt, quiet: globalOpts.quiet });
|
|
9621
|
+
} catch (err) {
|
|
9622
|
+
handleError(err, globalOpts);
|
|
9623
|
+
}
|
|
9624
|
+
});
|
|
9625
|
+
cmd.command("help").description("Request help on a claimed task").argument("<id>", "Check-in ID").option("--message <msg>", "Description of what help is needed").action(async function(id, opts) {
|
|
9626
|
+
const globalOpts = getGlobalOpts(this);
|
|
9627
|
+
try {
|
|
9628
|
+
const client = createClient(globalOpts);
|
|
9629
|
+
const checkIn = await withSpinner(
|
|
9630
|
+
"Requesting help...",
|
|
9631
|
+
() => client.checkIns.requestHelp(id, opts.message)
|
|
9632
|
+
);
|
|
9633
|
+
const fmt = detectFormat(globalOpts.json ? "json" : globalOpts.format);
|
|
9634
|
+
if (fmt === "table") {
|
|
9635
|
+
success(`Help requested for ${id}`);
|
|
9636
|
+
}
|
|
9637
|
+
output(checkIn, { format: fmt, quiet: globalOpts.quiet });
|
|
9638
|
+
} catch (err) {
|
|
9639
|
+
handleError(err, globalOpts);
|
|
9640
|
+
}
|
|
9641
|
+
});
|
|
9642
|
+
cmd.command("result").description("Submit a result for a claimed task").argument("<id>", "Check-in ID").requiredOption("--body <text>", "Result content (supports markdown)").option("--metadata <json>", "Additional metadata as JSON").action(async function(id, opts) {
|
|
9643
|
+
const globalOpts = getGlobalOpts(this);
|
|
9644
|
+
try {
|
|
9645
|
+
const client = createClient(globalOpts);
|
|
9646
|
+
const metadata = opts.metadata ? JSON.parse(opts.metadata) : void 0;
|
|
9647
|
+
const message = await withSpinner(
|
|
9648
|
+
"Submitting result...",
|
|
9649
|
+
() => client.checkIns.submitResult(id, {
|
|
9650
|
+
body: opts.body,
|
|
9651
|
+
metadata
|
|
9652
|
+
})
|
|
9653
|
+
);
|
|
9654
|
+
const fmt = detectFormat(globalOpts.json ? "json" : globalOpts.format);
|
|
9655
|
+
if (fmt === "table") {
|
|
9656
|
+
success(`Result submitted for ${id}`);
|
|
9657
|
+
}
|
|
9658
|
+
output(message, { format: fmt, quiet: globalOpts.quiet });
|
|
9659
|
+
} catch (err) {
|
|
9660
|
+
handleError(err, globalOpts);
|
|
9661
|
+
}
|
|
9662
|
+
});
|
|
9663
|
+
cmd.command("message").description("Post a message to a check-in thread").argument("<id>", "Check-in ID").requiredOption("--body <text>", "Message content").option("--type <type>", "Message type: comment, result, question", "comment").option("--metadata <json>", "Additional metadata as JSON").action(async function(id, opts) {
|
|
9664
|
+
const globalOpts = getGlobalOpts(this);
|
|
9665
|
+
try {
|
|
9666
|
+
const client = createClient(globalOpts);
|
|
9667
|
+
const metadata = opts.metadata ? JSON.parse(opts.metadata) : void 0;
|
|
9668
|
+
const message = await withSpinner(
|
|
9669
|
+
"Posting message...",
|
|
9670
|
+
() => client.checkIns.postMessage(id, {
|
|
9671
|
+
body: opts.body,
|
|
9672
|
+
message_type: opts.type,
|
|
9673
|
+
metadata
|
|
9674
|
+
})
|
|
9675
|
+
);
|
|
9676
|
+
const fmt = detectFormat(globalOpts.json ? "json" : globalOpts.format);
|
|
9677
|
+
if (fmt === "table") {
|
|
9678
|
+
success(`Message posted to ${id}`);
|
|
9679
|
+
}
|
|
9680
|
+
output(message, { format: fmt, quiet: globalOpts.quiet });
|
|
9681
|
+
} catch (err) {
|
|
9682
|
+
handleError(err, globalOpts);
|
|
9683
|
+
}
|
|
9684
|
+
});
|
|
9685
|
+
cmd.command("thread").description("Show thread messages for a check-in").argument("<id>", "Check-in ID").action(async function(id) {
|
|
9686
|
+
const globalOpts = getGlobalOpts(this);
|
|
9687
|
+
try {
|
|
9688
|
+
const client = createClient(globalOpts);
|
|
9689
|
+
const messages = await client.checkIns.getMessages(id);
|
|
9690
|
+
const fmt = detectFormat(globalOpts.json ? "json" : globalOpts.format);
|
|
9691
|
+
output(messages, {
|
|
9692
|
+
format: fmt,
|
|
9693
|
+
quiet: globalOpts.quiet,
|
|
9694
|
+
columns: [
|
|
9695
|
+
{ key: "id", header: "ID" },
|
|
9696
|
+
{ key: "sender_type", header: "Sender" },
|
|
9697
|
+
{ key: "message_type", header: "Type" },
|
|
9698
|
+
{ key: "body", header: "Body" },
|
|
9699
|
+
{ key: "created_at", header: "Time" }
|
|
9700
|
+
]
|
|
9701
|
+
});
|
|
9702
|
+
} catch (err) {
|
|
9703
|
+
handleError(err, globalOpts);
|
|
9704
|
+
}
|
|
9705
|
+
});
|
|
9706
|
+
cmd.command("claimed").description("List your claimed tasks").option("--status <status>", "Filter by status: in_progress, submitted").action(async function(opts) {
|
|
9707
|
+
const globalOpts = getGlobalOpts(this);
|
|
9708
|
+
try {
|
|
9709
|
+
const client = createClient(globalOpts);
|
|
9710
|
+
const checkIns = await client.checkIns.listClaimed(opts.status);
|
|
9711
|
+
const fmt = detectFormat(globalOpts.json ? "json" : globalOpts.format);
|
|
9712
|
+
output(checkIns, {
|
|
9713
|
+
format: fmt,
|
|
9714
|
+
quiet: globalOpts.quiet,
|
|
9715
|
+
columns: [
|
|
9716
|
+
{ key: "id", header: "ID" },
|
|
9717
|
+
{ key: "action", header: "Action" },
|
|
9718
|
+
{ key: "risk_level", header: "Risk", formatter: (v) => formatRisk(String(v)) },
|
|
9719
|
+
{ key: "status", header: "Status", formatter: (v) => formatStatus(String(v)) },
|
|
9720
|
+
{ key: "created_at", header: "Created" }
|
|
9721
|
+
]
|
|
9722
|
+
});
|
|
9723
|
+
} catch (err) {
|
|
9724
|
+
handleError(err, globalOpts);
|
|
9725
|
+
}
|
|
9726
|
+
});
|
|
9727
|
+
cmd.command("tasks").description("List room tasks posted by humans").argument("<room>", "Room slug or ID").option("--unclaimed", "Show only unclaimed tasks").action(async function(room, opts) {
|
|
9728
|
+
const globalOpts = getGlobalOpts(this);
|
|
9729
|
+
try {
|
|
9730
|
+
const client = createClient(globalOpts);
|
|
9731
|
+
const claimed = opts.unclaimed ? "false" : void 0;
|
|
9732
|
+
const tasks = await client.rooms.listTasks(room, claimed ? { claimed } : void 0);
|
|
9733
|
+
const fmt = detectFormat(globalOpts.json ? "json" : globalOpts.format);
|
|
9734
|
+
output(tasks, {
|
|
9735
|
+
format: fmt,
|
|
9736
|
+
quiet: globalOpts.quiet,
|
|
9737
|
+
columns: [
|
|
9738
|
+
{ key: "id", header: "ID" },
|
|
9739
|
+
{ key: "action", header: "Action" },
|
|
9740
|
+
{ key: "risk_level", header: "Risk", formatter: (v) => formatRisk(String(v)) },
|
|
9741
|
+
{ key: "status", header: "Status", formatter: (v) => formatStatus(String(v)) },
|
|
9742
|
+
{ key: "claimed_by", header: "Claimed By" },
|
|
9743
|
+
{ key: "created_at", header: "Created" }
|
|
9744
|
+
]
|
|
9745
|
+
});
|
|
9746
|
+
} catch (err) {
|
|
9747
|
+
handleError(err, globalOpts);
|
|
9748
|
+
}
|
|
9749
|
+
});
|
|
9750
|
+
cmd.command("list").description("List check-ins across all rooms").option("--status <status>", "Filter by status (pending, in_progress, submitted, approved, rejected, etc.)").option("--risk <level>", "Filter by risk level").option("--urgency <urgency>", "Filter by urgency").option("--direction <dir>", "Filter by direction: agent_to_human, human_to_agent").option("--claimed <bool>", "Filter by claimed status: true, false").action(async function(opts) {
|
|
9751
|
+
const globalOpts = getGlobalOpts(this);
|
|
9752
|
+
try {
|
|
9753
|
+
const client = createClient(globalOpts);
|
|
9754
|
+
const filters = {};
|
|
9755
|
+
if (opts.status) filters.status = opts.status;
|
|
9756
|
+
if (opts.risk) filters.risk_level = opts.risk;
|
|
9757
|
+
if (opts.urgency) filters.urgency = opts.urgency;
|
|
9758
|
+
if (opts.direction) filters.direction = opts.direction;
|
|
9759
|
+
if (opts.claimed) filters.claimed = opts.claimed;
|
|
9760
|
+
const checkIns = await client.checkIns.list(filters);
|
|
9761
|
+
const fmt = detectFormat(globalOpts.json ? "json" : globalOpts.format);
|
|
9762
|
+
output(checkIns, {
|
|
9763
|
+
format: fmt,
|
|
9764
|
+
quiet: globalOpts.quiet,
|
|
9765
|
+
columns: [
|
|
9766
|
+
{ key: "id", header: "ID" },
|
|
9767
|
+
{ key: "action", header: "Action" },
|
|
9768
|
+
{ key: "direction", header: "Direction" },
|
|
9769
|
+
{ key: "risk_level", header: "Risk", formatter: (v) => formatRisk(String(v)) },
|
|
9770
|
+
{ key: "status", header: "Status", formatter: (v) => formatStatus(String(v)) },
|
|
9771
|
+
{ key: "agent_id", header: "Agent" },
|
|
9772
|
+
{ key: "created_at", header: "Created" }
|
|
9773
|
+
]
|
|
9774
|
+
});
|
|
9775
|
+
} catch (err) {
|
|
9776
|
+
handleError(err, globalOpts);
|
|
9777
|
+
}
|
|
9778
|
+
});
|
|
9419
9779
|
cmd.command("pending").description("List pending check-ins in a room").argument("[room]", "Room slug or ID").option("--risk <level>", "Filter by risk level").option("--agent <id>", "Filter by agent ID").action(async function(room, opts) {
|
|
9420
9780
|
const globalOpts = getGlobalOpts(this);
|
|
9421
9781
|
try {
|
|
@@ -10067,6 +10427,83 @@ function auditCommand() {
|
|
|
10067
10427
|
return cmd;
|
|
10068
10428
|
}
|
|
10069
10429
|
|
|
10430
|
+
// src/commands/org.ts
|
|
10431
|
+
import { Command as Command13 } from "commander";
|
|
10432
|
+
import { readFileSync } from "fs";
|
|
10433
|
+
function orgCommand() {
|
|
10434
|
+
const cmd = new Command13("org").description("Organization management commands");
|
|
10435
|
+
const context = cmd.command("context").description("Manage organization context");
|
|
10436
|
+
context.command("get").description("Print current organization context").action(async function() {
|
|
10437
|
+
const globalOpts = getGlobalOpts(this);
|
|
10438
|
+
try {
|
|
10439
|
+
const client = createClient(globalOpts);
|
|
10440
|
+
const org = await client.org.get();
|
|
10441
|
+
const fmt = detectFormat(globalOpts.json ? "json" : globalOpts.format);
|
|
10442
|
+
if (fmt === "table") {
|
|
10443
|
+
if (org.context) {
|
|
10444
|
+
console.log(org.context);
|
|
10445
|
+
} else {
|
|
10446
|
+
console.log("No organization context set.");
|
|
10447
|
+
}
|
|
10448
|
+
} else {
|
|
10449
|
+
output({ context: org.context }, { format: fmt, quiet: globalOpts.quiet });
|
|
10450
|
+
}
|
|
10451
|
+
} catch (err) {
|
|
10452
|
+
handleError(err, globalOpts);
|
|
10453
|
+
}
|
|
10454
|
+
});
|
|
10455
|
+
context.command("set").description("Set organization context from a file or inline").option("--file <path>", "Read context from a file").argument("[text]", "Inline context text").action(async function(text, opts) {
|
|
10456
|
+
const globalOpts = getGlobalOpts(this);
|
|
10457
|
+
try {
|
|
10458
|
+
let content;
|
|
10459
|
+
if (opts.file) {
|
|
10460
|
+
content = readFileSync(opts.file, "utf-8");
|
|
10461
|
+
} else if (text) {
|
|
10462
|
+
content = text;
|
|
10463
|
+
} else {
|
|
10464
|
+
console.error("Provide context text as an argument or use --file <path>");
|
|
10465
|
+
process.exit(1);
|
|
10466
|
+
}
|
|
10467
|
+
if (content.length > 1e4) {
|
|
10468
|
+
console.error(`Context too long: ${content.length} characters (max 10,000)`);
|
|
10469
|
+
process.exit(1);
|
|
10470
|
+
}
|
|
10471
|
+
const client = createClient(globalOpts);
|
|
10472
|
+
const org = await withSpinner(
|
|
10473
|
+
"Saving organization context...",
|
|
10474
|
+
() => client.org.updateContext(content)
|
|
10475
|
+
);
|
|
10476
|
+
const fmt = detectFormat(globalOpts.json ? "json" : globalOpts.format);
|
|
10477
|
+
if (fmt === "table") {
|
|
10478
|
+
success(`Organization context updated (${content.length} characters)`);
|
|
10479
|
+
} else {
|
|
10480
|
+
output({ context: org.context }, { format: fmt, quiet: globalOpts.quiet });
|
|
10481
|
+
}
|
|
10482
|
+
} catch (err) {
|
|
10483
|
+
handleError(err, globalOpts);
|
|
10484
|
+
}
|
|
10485
|
+
});
|
|
10486
|
+
context.command("clear").description("Clear organization context").action(async function() {
|
|
10487
|
+
const globalOpts = getGlobalOpts(this);
|
|
10488
|
+
try {
|
|
10489
|
+
const client = createClient(globalOpts);
|
|
10490
|
+
await withSpinner(
|
|
10491
|
+
"Clearing organization context...",
|
|
10492
|
+
() => client.org.updateContext(null)
|
|
10493
|
+
);
|
|
10494
|
+
const fmt = detectFormat(globalOpts.json ? "json" : globalOpts.format);
|
|
10495
|
+
if (fmt === "table") {
|
|
10496
|
+
success("Organization context cleared");
|
|
10497
|
+
} else {
|
|
10498
|
+
output({ context: null }, { format: fmt, quiet: globalOpts.quiet });
|
|
10499
|
+
}
|
|
10500
|
+
} catch (err) {
|
|
10501
|
+
handleError(err, globalOpts);
|
|
10502
|
+
}
|
|
10503
|
+
});
|
|
10504
|
+
return cmd;
|
|
10505
|
+
}
|
|
10506
|
+
|
|
10070
10507
|
// src/cli.ts
|
|
10071
10508
|
function getGlobalOpts(cmd) {
|
|
10072
10509
|
const root = cmd.optsWithGlobals();
|
|
@@ -10082,7 +10519,7 @@ function getGlobalOpts(cmd) {
|
|
|
10082
10519
|
};
|
|
10083
10520
|
}
|
|
10084
10521
|
function createProgram() {
|
|
10085
|
-
const program = new
|
|
10522
|
+
const program = new Command14();
|
|
10086
10523
|
program.name("wr").description("Waitroom CLI \u2014 coordination layer between AI agents and humans").version("0.0.1").option("-j, --json", "Output as JSON").option("-f, --format <format>", "Output format: table, json, compact, jsonl").option("-p, --profile <name>", "Credential profile to use").option("--api-url <url>", "API base URL").option("--api-key <key>", "API key (overrides stored credentials)").option("--no-color", "Disable color output").option("-v, --verbose", "Verbose output").option("-q, --quiet", "Suppress non-essential output");
|
|
10087
10524
|
program.addCommand(initCommand());
|
|
10088
10525
|
program.addCommand(authCommand());
|
|
@@ -10096,6 +10533,7 @@ function createProgram() {
|
|
|
10096
10533
|
program.addCommand(signalCommand());
|
|
10097
10534
|
program.addCommand(watchCommand());
|
|
10098
10535
|
program.addCommand(auditCommand());
|
|
10536
|
+
program.addCommand(orgCommand());
|
|
10099
10537
|
return program;
|
|
10100
10538
|
}
|
|
10101
10539
|
async function run(argv) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waitroom-io/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Waitroom CLI — coordination layer between AI agents and humans",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsup",
|
|
15
|
+
"typecheck": "tsc --noEmit",
|
|
16
|
+
"test": "vitest run",
|
|
17
|
+
"clean": "rm -rf dist",
|
|
18
|
+
"prepublishOnly": "pnpm build"
|
|
19
|
+
},
|
|
13
20
|
"keywords": [
|
|
14
21
|
"waitroom",
|
|
15
22
|
"cli",
|
|
@@ -26,19 +33,13 @@
|
|
|
26
33
|
"eventsource": "^3.0.0"
|
|
27
34
|
},
|
|
28
35
|
"devDependencies": {
|
|
36
|
+
"@waitroom-io/sdk": "workspace:*",
|
|
37
|
+
"@waitroom-io/shared": "workspace:*",
|
|
29
38
|
"@types/node": "^22.10.7",
|
|
39
|
+
"@waitroom-io/tsconfig": "workspace:*",
|
|
30
40
|
"tsup": "^8.0.0",
|
|
31
41
|
"tsx": "^4.19.2",
|
|
32
42
|
"typescript": "^5.7.3",
|
|
33
|
-
"vitest": "^2.1.8"
|
|
34
|
-
"@waitroom-io/sdk": "0.0.5",
|
|
35
|
-
"@waitroom-io/tsconfig": "0.0.0",
|
|
36
|
-
"@waitroom-io/shared": "0.0.1"
|
|
37
|
-
},
|
|
38
|
-
"scripts": {
|
|
39
|
-
"build": "tsup",
|
|
40
|
-
"typecheck": "tsc --noEmit",
|
|
41
|
-
"test": "vitest run",
|
|
42
|
-
"clean": "rm -rf dist"
|
|
43
|
+
"vitest": "^2.1.8"
|
|
43
44
|
}
|
|
44
|
-
}
|
|
45
|
+
}
|