@concord-ai/concord-mcp 0.2.0 → 0.4.0
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 +59 -18
- package/dist/artifacts/index.js +3 -1
- package/dist/artifacts/index.js.map +1 -1
- package/dist/artifacts/work-state-json.d.ts +3 -2
- package/dist/artifacts/work-state-json.js +15 -2
- package/dist/artifacts/work-state-json.js.map +1 -1
- package/dist/artifacts/work-state-view.d.ts +9 -1
- package/dist/artifacts/work-state-view.js +30 -2
- package/dist/artifacts/work-state-view.js.map +1 -1
- package/dist/cli/commands/dashboard.d.ts +4 -0
- package/dist/cli/commands/dashboard.js +41 -0
- package/dist/cli/commands/dashboard.js.map +1 -0
- package/dist/cli/commands/hook.d.ts +17 -0
- package/dist/cli/commands/hook.js +73 -1
- package/dist/cli/commands/hook.js.map +1 -1
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.js +15 -0
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/review-packet.js +1 -1
- package/dist/cli/commands/review-packet.js.map +1 -1
- package/dist/cli/commands/who.d.ts +4 -0
- package/dist/cli/commands/who.js +17 -0
- package/dist/cli/commands/who.js.map +1 -0
- package/dist/cli/dashboard/app.d.ts +9 -0
- package/dist/cli/dashboard/app.js +225 -0
- package/dist/cli/dashboard/app.js.map +1 -0
- package/dist/cli/dashboard/model.d.ts +18 -0
- package/dist/cli/dashboard/model.js +29 -0
- package/dist/cli/dashboard/model.js.map +1 -0
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/config/paths.d.ts +11 -0
- package/dist/config/paths.js +21 -0
- package/dist/config/paths.js.map +1 -1
- package/dist/db/index.d.ts +7 -1
- package/dist/db/index.js +4 -0
- package/dist/db/index.js.map +1 -1
- package/dist/db/repositories/agents.d.ts +27 -0
- package/dist/db/repositories/agents.js +68 -0
- package/dist/db/repositories/agents.js.map +1 -0
- package/dist/db/repositories/task-updates.d.ts +13 -0
- package/dist/db/repositories/task-updates.js +32 -0
- package/dist/db/repositories/task-updates.js.map +1 -0
- package/dist/db/repositories/tasks.d.ts +1 -0
- package/dist/db/repositories/tasks.js +3 -2
- package/dist/db/repositories/tasks.js.map +1 -1
- package/dist/db/rows.d.ts +37 -1
- package/dist/db/rows.js +70 -1
- package/dist/db/rows.js.map +1 -1
- package/dist/db/schema.js +40 -0
- package/dist/db/schema.js.map +1 -1
- package/dist/domain/presence.d.ts +54 -0
- package/dist/domain/presence.js +86 -0
- package/dist/domain/presence.js.map +1 -0
- package/dist/domain/schemas.d.ts +93 -5
- package/dist/domain/schemas.js +55 -0
- package/dist/domain/schemas.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/install/claude-hooks.d.ts +9 -6
- package/dist/install/claude-hooks.js +31 -17
- package/dist/install/claude-hooks.js.map +1 -1
- package/dist/install/instructions.d.ts +1 -1
- package/dist/install/instructions.js +17 -4
- package/dist/install/instructions.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +6 -0
- package/dist/server.js.map +1 -1
- package/dist/tools/claim-work.js +5 -0
- package/dist/tools/claim-work.js.map +1 -1
- package/dist/tools/get-task-context.d.ts +13 -0
- package/dist/tools/get-task-context.js +77 -0
- package/dist/tools/get-task-context.js.map +1 -0
- package/dist/tools/get-work-state.js +6 -3
- package/dist/tools/get-work-state.js.map +1 -1
- package/dist/tools/handoff.js +4 -0
- package/dist/tools/handoff.js.map +1 -1
- package/dist/tools/register-agent.d.ts +23 -0
- package/dist/tools/register-agent.js +83 -0
- package/dist/tools/register-agent.js.map +1 -0
- package/dist/tools/review-ready.js +1 -0
- package/dist/tools/review-ready.js.map +1 -1
- package/dist/tools/update-task.d.ts +10 -0
- package/dist/tools/update-task.js +51 -0
- package/dist/tools/update-task.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -2
|
@@ -6,11 +6,11 @@ export function createTaskRepository(db) {
|
|
|
6
6
|
INSERT INTO tasks (
|
|
7
7
|
task_id, title, owner, agent, branch, worktree,
|
|
8
8
|
expected_files, modules, domains, risk_tags, notes, status,
|
|
9
|
-
parent_task_id, created_at, updated_at
|
|
9
|
+
parent_task_id, agent_id, created_at, updated_at
|
|
10
10
|
) VALUES (
|
|
11
11
|
@task_id, @title, @owner, @agent, @branch, @worktree,
|
|
12
12
|
@expected_files, @modules, @domains, @risk_tags, @notes, @status,
|
|
13
|
-
@parent_task_id, @created_at, @updated_at
|
|
13
|
+
@parent_task_id, @agent_id, @created_at, @updated_at
|
|
14
14
|
)
|
|
15
15
|
`);
|
|
16
16
|
const getStmt = db.prepare('SELECT * FROM tasks WHERE task_id = ?');
|
|
@@ -43,6 +43,7 @@ export function createTaskRepository(db) {
|
|
|
43
43
|
notes: task.notes,
|
|
44
44
|
status: 'active',
|
|
45
45
|
parent_task_id: task.parentTaskId,
|
|
46
|
+
agent_id: task.agentId,
|
|
46
47
|
created_at: now,
|
|
47
48
|
updated_at: now,
|
|
48
49
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../../src/db/repositories/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAoC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../../src/db/repositories/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAoC,MAAM,YAAY,CAAC;AAoClG,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAE3C,MAAM,UAAU,oBAAoB,CAAC,EAAmB;IACtD,MAAM,UAAU,GAAG,EAAE,C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package/dist/db/rows.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
export declare const taskStatusValues: readonly ["active", "handed_off", "review_ready"];
|
|
8
8
|
export type TaskStatus = (typeof taskStatusValues)[number];
|
|
9
9
|
/** Tools that can be recorded as events (used for adoption tracking). */
|
|
10
|
-
export declare const toolNameValues: readonly ["claim_work", "handoff", "review_ready"];
|
|
10
|
+
export declare const toolNameValues: readonly ["claim_work", "update_task", "handoff", "review_ready"];
|
|
11
11
|
export type ToolName = (typeof toolNameValues)[number];
|
|
12
12
|
/** Outcome recorded for an event. */
|
|
13
13
|
export declare const eventStatusValues: readonly ["success", "error"];
|
|
@@ -40,10 +40,25 @@ export interface TaskRecord {
|
|
|
40
40
|
status: TaskStatus;
|
|
41
41
|
/** The parent task this is a subtask of, or null for a top-level task. */
|
|
42
42
|
parentTaskId: string | null;
|
|
43
|
+
/** The agent instance (register_agent identity) that claimed this, or null.
|
|
44
|
+
* Distinct from `agent` (the kind string): used to check the claimant's
|
|
45
|
+
* liveness for stale-claim detection. */
|
|
46
|
+
agentId: string | null;
|
|
43
47
|
createdAt: string;
|
|
44
48
|
updatedAt: string;
|
|
45
49
|
}
|
|
46
50
|
export declare function parseTaskRow(raw: unknown): TaskRecord;
|
|
51
|
+
export declare const taskUpdateKindValues: readonly ["intent", "progress", "assumption", "decision", "question", "answer", "blocker", "finding"];
|
|
52
|
+
export type TaskUpdateKind = (typeof taskUpdateKindValues)[number];
|
|
53
|
+
export interface TaskUpdateRecord {
|
|
54
|
+
id: number;
|
|
55
|
+
taskId: string;
|
|
56
|
+
kind: TaskUpdateKind;
|
|
57
|
+
content: string;
|
|
58
|
+
agent: string | null;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
}
|
|
61
|
+
export declare function parseTaskUpdateRow(raw: unknown): TaskUpdateRecord;
|
|
47
62
|
export interface HandoffRecord {
|
|
48
63
|
id: number;
|
|
49
64
|
taskId: string;
|
|
@@ -82,3 +97,24 @@ export interface EventRecord {
|
|
|
82
97
|
createdAt: string;
|
|
83
98
|
}
|
|
84
99
|
export declare function parseEventRow(raw: unknown): EventRecord;
|
|
100
|
+
/** Status an agent reports about its own work. Liveness (live/idle/away) is
|
|
101
|
+
* derived separately from `last_seen` in `domain/presence.ts`. */
|
|
102
|
+
export declare const agentStatusValues: readonly ["active", "blocked", "waiting_review", "done"];
|
|
103
|
+
export type AgentStatus = (typeof agentStatusValues)[number];
|
|
104
|
+
/** A registered agent instance. `agentId` is a distinct per-session identity
|
|
105
|
+
* (e.g. `claude-code:7p8v`), unlike the `agent` *kind* string on a task. */
|
|
106
|
+
export interface AgentRecord {
|
|
107
|
+
agentId: string;
|
|
108
|
+
kind: string;
|
|
109
|
+
owner: string | null;
|
|
110
|
+
model: string | null;
|
|
111
|
+
pid: number | null;
|
|
112
|
+
cwd: string | null;
|
|
113
|
+
worktree: string | null;
|
|
114
|
+
branch: string | null;
|
|
115
|
+
summary: string | null;
|
|
116
|
+
status: AgentStatus;
|
|
117
|
+
firstSeen: string;
|
|
118
|
+
lastSeen: string;
|
|
119
|
+
}
|
|
120
|
+
export declare function parseAgentRow(raw: unknown): AgentRecord;
|
package/dist/db/rows.js
CHANGED
|
@@ -8,7 +8,7 @@ import { z } from 'zod';
|
|
|
8
8
|
export const taskStatusValues = ['active', 'handed_off', 'review_ready'];
|
|
9
9
|
const taskStatusSchema = z.enum(taskStatusValues);
|
|
10
10
|
/** Tools that can be recorded as events (used for adoption tracking). */
|
|
11
|
-
export const toolNameValues = ['claim_work', 'handoff', 'review_ready'];
|
|
11
|
+
export const toolNameValues = ['claim_work', 'update_task', 'handoff', 'review_ready'];
|
|
12
12
|
const toolNameSchema = z.enum(toolNameValues);
|
|
13
13
|
/** Outcome recorded for an event. */
|
|
14
14
|
export const eventStatusValues = ['success', 'error'];
|
|
@@ -46,6 +46,7 @@ const taskDbRowSchema = z.object({
|
|
|
46
46
|
notes: z.string().nullable(),
|
|
47
47
|
status: taskStatusSchema,
|
|
48
48
|
parent_task_id: z.string().nullable(),
|
|
49
|
+
agent_id: z.string().nullable(),
|
|
49
50
|
created_at: z.string(),
|
|
50
51
|
updated_at: z.string(),
|
|
51
52
|
});
|
|
@@ -65,10 +66,42 @@ export function parseTaskRow(raw) {
|
|
|
65
66
|
notes: row.notes,
|
|
66
67
|
status: row.status,
|
|
67
68
|
parentTaskId: row.parent_task_id,
|
|
69
|
+
agentId: row.agent_id,
|
|
68
70
|
createdAt: row.created_at,
|
|
69
71
|
updatedAt: row.updated_at,
|
|
70
72
|
};
|
|
71
73
|
}
|
|
74
|
+
// --- task updates -----------------------------------------------------------
|
|
75
|
+
export const taskUpdateKindValues = [
|
|
76
|
+
'intent',
|
|
77
|
+
'progress',
|
|
78
|
+
'assumption',
|
|
79
|
+
'decision',
|
|
80
|
+
'question',
|
|
81
|
+
'answer',
|
|
82
|
+
'blocker',
|
|
83
|
+
'finding',
|
|
84
|
+
];
|
|
85
|
+
const taskUpdateKindSchema = z.enum(taskUpdateKindValues);
|
|
86
|
+
const taskUpdateDbRowSchema = z.object({
|
|
87
|
+
id: z.number().int(),
|
|
88
|
+
task_id: z.string(),
|
|
89
|
+
kind: taskUpdateKindSchema,
|
|
90
|
+
content: z.string(),
|
|
91
|
+
agent: z.string().nullable(),
|
|
92
|
+
created_at: z.string(),
|
|
93
|
+
});
|
|
94
|
+
export function parseTaskUpdateRow(raw) {
|
|
95
|
+
const row = taskUpdateDbRowSchema.parse(raw);
|
|
96
|
+
return {
|
|
97
|
+
id: row.id,
|
|
98
|
+
taskId: row.task_id,
|
|
99
|
+
kind: row.kind,
|
|
100
|
+
content: row.content,
|
|
101
|
+
agent: row.agent,
|
|
102
|
+
createdAt: row.created_at,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
72
105
|
const handoffDbRowSchema = z.object({
|
|
73
106
|
id: z.number().int(),
|
|
74
107
|
task_id: z.string(),
|
|
@@ -148,4 +181,40 @@ export function parseEventRow(raw) {
|
|
|
148
181
|
createdAt: row.created_at,
|
|
149
182
|
};
|
|
150
183
|
}
|
|
184
|
+
// --- agents ----------------------------------------------------------------
|
|
185
|
+
/** Status an agent reports about its own work. Liveness (live/idle/away) is
|
|
186
|
+
* derived separately from `last_seen` in `domain/presence.ts`. */
|
|
187
|
+
export const agentStatusValues = ['active', 'blocked', 'waiting_review', 'done'];
|
|
188
|
+
const agentStatusSchema = z.enum(agentStatusValues);
|
|
189
|
+
const agentDbRowSchema = z.object({
|
|
190
|
+
agent_id: z.string(),
|
|
191
|
+
kind: z.string(),
|
|
192
|
+
owner: z.string().nullable(),
|
|
193
|
+
model: z.string().nullable(),
|
|
194
|
+
pid: z.number().int().nullable(),
|
|
195
|
+
cwd: z.string().nullable(),
|
|
196
|
+
worktree: z.string().nullable(),
|
|
197
|
+
branch: z.string().nullable(),
|
|
198
|
+
summary: z.string().nullable(),
|
|
199
|
+
status: agentStatusSchema,
|
|
200
|
+
first_seen: z.string(),
|
|
201
|
+
last_seen: z.string(),
|
|
202
|
+
});
|
|
203
|
+
export function parseAgentRow(raw) {
|
|
204
|
+
const row = agentDbRowSchema.parse(raw);
|
|
205
|
+
return {
|
|
206
|
+
agentId: row.agent_id,
|
|
207
|
+
kind: row.kind,
|
|
208
|
+
owner: row.owner,
|
|
209
|
+
model: row.model,
|
|
210
|
+
pid: row.pid,
|
|
211
|
+
cwd: row.cwd,
|
|
212
|
+
worktree: row.worktree,
|
|
213
|
+
branch: row.branch,
|
|
214
|
+
summary: row.summary,
|
|
215
|
+
status: row.status,
|
|
216
|
+
firstSeen: row.first_seen,
|
|
217
|
+
lastSeen: row.last_seen,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
151
220
|
//# sourceMappingURL=rows.js.map
|
package/dist/db/rows.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rows.js","sourceRoot":"","sources":["../../src/db/rows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AAE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,MAAM,GAAG,GAAG,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,OAAO;QACL,OAAO,EAAE,GAAG,CAAC,QAAQ;QACrB,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,QAAQ,EAAE,GAAG,CAAC,SAAS;KACxB,CAAC;AACJ,CAAC"}
|
package/dist/db/schema.js
CHANGED
|
@@ -73,6 +73,46 @@ export const migrations = [
|
|
|
73
73
|
// may be claimed before or without its parent existing.
|
|
74
74
|
`
|
|
75
75
|
ALTER TABLE tasks ADD COLUMN parent_task_id TEXT;
|
|
76
|
+
`,
|
|
77
|
+
// 004 — append-only, task-scoped memory shared between agent sessions.
|
|
78
|
+
`
|
|
79
|
+
CREATE TABLE task_updates (
|
|
80
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
81
|
+
task_id TEXT NOT NULL REFERENCES tasks(task_id),
|
|
82
|
+
kind TEXT NOT NULL,
|
|
83
|
+
content TEXT NOT NULL,
|
|
84
|
+
agent TEXT,
|
|
85
|
+
created_at TEXT NOT NULL
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
CREATE INDEX idx_task_updates_task_id ON task_updates(task_id);
|
|
89
|
+
`,
|
|
90
|
+
// 005 — agent presence registry. Each running agent registers a distinct
|
|
91
|
+
// instance identity (agent_id) so concurrent agents are distinguishable and
|
|
92
|
+
// can see who else is active. Liveness is derived from last_seen, not stored.
|
|
93
|
+
`
|
|
94
|
+
CREATE TABLE agents (
|
|
95
|
+
agent_id TEXT PRIMARY KEY,
|
|
96
|
+
kind TEXT NOT NULL,
|
|
97
|
+
owner TEXT,
|
|
98
|
+
model TEXT,
|
|
99
|
+
pid INTEGER,
|
|
100
|
+
cwd TEXT,
|
|
101
|
+
worktree TEXT,
|
|
102
|
+
branch TEXT,
|
|
103
|
+
summary TEXT,
|
|
104
|
+
status TEXT NOT NULL DEFAULT 'active',
|
|
105
|
+
first_seen TEXT NOT NULL,
|
|
106
|
+
last_seen TEXT NOT NULL
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
CREATE INDEX idx_agents_last_seen ON agents(last_seen);
|
|
110
|
+
`,
|
|
111
|
+
// 006 — link a claim to the agent instance that made it, so stale claims
|
|
112
|
+
// (an active task whose owning agent has gone away) can be detected. A soft
|
|
113
|
+
// reference (no FK): the agent may register after, or not at all.
|
|
114
|
+
`
|
|
115
|
+
ALTER TABLE tasks ADD COLUMN agent_id TEXT;
|
|
76
116
|
`,
|
|
77
117
|
];
|
|
78
118
|
//# sourceMappingURL=schema.js.map
|
package/dist/db/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsB;IAC3C,iDAAiD;IACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CC;IACD,iDAAiD;IACjD;;;;;;;;;;;;;;;GAeC;IACD,6EAA6E;IAC7E,wDAAwD;IACxD;;GAEC;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsB;IAC3C,iDAAiD;IACjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CC;IACD,iDAAiD;IACjD;;;;;;;;;;;;;;;GAeC;IACD,6EAA6E;IAC7E,wDAAwD;IACxD;;GAEC;IACD,uEAAuE;IACvE;;;;;;;;;;;GAWC;IACD,yEAAyE;IACzE,4EAA4E;IAC5E,8EAA8E;IAC9E;;;;;;;;;;;;;;;;;GAiBC;IACD,yEAAyE;IACzE,4EAA4E;IAC5E,kEAAkE;IAClE;;GAEC;CACF,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { AgentRecord, AgentStatus, TaskRecord } from '../db/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Liveness is *derived* from how long ago an agent was last seen — never stored.
|
|
4
|
+
* A registered claim is durable, but presence must decay so a crashed or
|
|
5
|
+
* walked-away agent stops looking active. Distinct from the agent's *reported*
|
|
6
|
+
* status (active/blocked/waiting_review/done), which says what it is doing.
|
|
7
|
+
*/
|
|
8
|
+
export type Liveness = 'live' | 'idle' | 'away';
|
|
9
|
+
/** How long since `last_seen` before an agent is considered idle, then away. */
|
|
10
|
+
export interface PresenceThresholds {
|
|
11
|
+
idleAfterMs: number;
|
|
12
|
+
awayAfterMs: number;
|
|
13
|
+
}
|
|
14
|
+
/** Live under 5 min, idle under 30 min, away beyond. */
|
|
15
|
+
export declare const DEFAULT_PRESENCE_THRESHOLDS: PresenceThresholds;
|
|
16
|
+
/** A single agent's presence for display in a roster. */
|
|
17
|
+
export interface PresenceEntry {
|
|
18
|
+
agentId: string;
|
|
19
|
+
kind: string;
|
|
20
|
+
owner: string | null;
|
|
21
|
+
summary: string | null;
|
|
22
|
+
status: AgentStatus;
|
|
23
|
+
liveness: Liveness;
|
|
24
|
+
lastSeen: string;
|
|
25
|
+
/** Whole seconds since `last_seen`, floored at 0. */
|
|
26
|
+
ageSeconds: number;
|
|
27
|
+
}
|
|
28
|
+
/** Derive liveness from a `last_seen` ISO timestamp relative to `now` (ms since
|
|
29
|
+
* epoch). Unparseable timestamps are treated as `away`. */
|
|
30
|
+
export declare function deriveLiveness(lastSeen: string, now: number, thresholds?: PresenceThresholds): Liveness;
|
|
31
|
+
/**
|
|
32
|
+
* Build the presence roster from registered agents: live agents first, then by
|
|
33
|
+
* most-recently-seen. This is the "who is here and what are they doing" view
|
|
34
|
+
* that other agents read before or while working.
|
|
35
|
+
*/
|
|
36
|
+
/** An active claim whose owning agent is no longer reliably present. */
|
|
37
|
+
export interface StaleClaim {
|
|
38
|
+
taskId: string;
|
|
39
|
+
title: string;
|
|
40
|
+
agentId: string;
|
|
41
|
+
/** Why it is stale: the agent is `away`, or was never seen (unregistered). */
|
|
42
|
+
reason: 'agent-away' | 'agent-unregistered';
|
|
43
|
+
/** Seconds since the owning agent was last seen, or null when unregistered. */
|
|
44
|
+
ageSeconds: number | null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Flag active claims whose owning agent has gone away — the "agent walked off
|
|
48
|
+
* without handing off" case a durable claim alone cannot surface. Only claims
|
|
49
|
+
* carrying an `agentId` are assessed; unattributed claims are left alone (they
|
|
50
|
+
* predate presence and would be noise). A claim is stale when its agent is
|
|
51
|
+
* `away`, or when the referenced agent never registered.
|
|
52
|
+
*/
|
|
53
|
+
export declare function detectStaleClaims(tasks: readonly TaskRecord[], agents: readonly AgentRecord[], now: number, thresholds?: PresenceThresholds): StaleClaim[];
|
|
54
|
+
export declare function buildRoster(agents: readonly AgentRecord[], now: number, thresholds?: PresenceThresholds): PresenceEntry[];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** Live under 5 min, idle under 30 min, away beyond. */
|
|
2
|
+
export const DEFAULT_PRESENCE_THRESHOLDS = {
|
|
3
|
+
idleAfterMs: 5 * 60 * 1000,
|
|
4
|
+
awayAfterMs: 30 * 60 * 1000,
|
|
5
|
+
};
|
|
6
|
+
/** Derive liveness from a `last_seen` ISO timestamp relative to `now` (ms since
|
|
7
|
+
* epoch). Unparseable timestamps are treated as `away`. */
|
|
8
|
+
export function deriveLiveness(lastSeen, now, thresholds = DEFAULT_PRESENCE_THRESHOLDS) {
|
|
9
|
+
const seen = Date.parse(lastSeen);
|
|
10
|
+
if (Number.isNaN(seen)) {
|
|
11
|
+
return 'away';
|
|
12
|
+
}
|
|
13
|
+
const age = now - seen;
|
|
14
|
+
if (age >= thresholds.awayAfterMs) {
|
|
15
|
+
return 'away';
|
|
16
|
+
}
|
|
17
|
+
if (age >= thresholds.idleAfterMs) {
|
|
18
|
+
return 'idle';
|
|
19
|
+
}
|
|
20
|
+
return 'live';
|
|
21
|
+
}
|
|
22
|
+
const LIVENESS_ORDER = { live: 0, idle: 1, away: 2 };
|
|
23
|
+
function ageSecondsOf(lastSeen, now) {
|
|
24
|
+
const seen = Date.parse(lastSeen);
|
|
25
|
+
if (Number.isNaN(seen)) {
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
return Math.max(0, Math.floor((now - seen) / 1000));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Flag active claims whose owning agent has gone away — the "agent walked off
|
|
32
|
+
* without handing off" case a durable claim alone cannot surface. Only claims
|
|
33
|
+
* carrying an `agentId` are assessed; unattributed claims are left alone (they
|
|
34
|
+
* predate presence and would be noise). A claim is stale when its agent is
|
|
35
|
+
* `away`, or when the referenced agent never registered.
|
|
36
|
+
*/
|
|
37
|
+
export function detectStaleClaims(tasks, agents, now, thresholds = DEFAULT_PRESENCE_THRESHOLDS) {
|
|
38
|
+
const byId = new Map(agents.map((agent) => [agent.agentId, agent]));
|
|
39
|
+
const stale = [];
|
|
40
|
+
for (const task of tasks) {
|
|
41
|
+
if (task.status !== 'active' || task.agentId === null) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const agent = byId.get(task.agentId);
|
|
45
|
+
if (agent === undefined) {
|
|
46
|
+
stale.push({
|
|
47
|
+
taskId: task.taskId,
|
|
48
|
+
title: task.title,
|
|
49
|
+
agentId: task.agentId,
|
|
50
|
+
reason: 'agent-unregistered',
|
|
51
|
+
ageSeconds: null,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
else if (deriveLiveness(agent.lastSeen, now, thresholds) === 'away') {
|
|
55
|
+
stale.push({
|
|
56
|
+
taskId: task.taskId,
|
|
57
|
+
title: task.title,
|
|
58
|
+
agentId: task.agentId,
|
|
59
|
+
reason: 'agent-away',
|
|
60
|
+
ageSeconds: ageSecondsOf(agent.lastSeen, now),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return stale;
|
|
65
|
+
}
|
|
66
|
+
export function buildRoster(agents, now, thresholds = DEFAULT_PRESENCE_THRESHOLDS) {
|
|
67
|
+
return agents
|
|
68
|
+
.map((agent) => ({
|
|
69
|
+
agentId: agent.agentId,
|
|
70
|
+
kind: agent.kind,
|
|
71
|
+
owner: agent.owner,
|
|
72
|
+
summary: agent.summary,
|
|
73
|
+
status: agent.status,
|
|
74
|
+
liveness: deriveLiveness(agent.lastSeen, now, thresholds),
|
|
75
|
+
lastSeen: agent.lastSeen,
|
|
76
|
+
ageSeconds: ageSecondsOf(agent.lastSeen, now),
|
|
77
|
+
}))
|
|
78
|
+
.sort((a, b) => {
|
|
79
|
+
const byLiveness = LIVENESS_ORDER[a.liveness] - LIVENESS_ORDER[b.liveness];
|
|
80
|
+
if (byLiveness !== 0) {
|
|
81
|
+
return byLiveness;
|
|
82
|
+
}
|
|
83
|
+
return b.lastSeen.localeCompare(a.lastSeen);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=presence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presence.js","sourceRoot":"","sources":["../../src/domain/presence.ts"],"names":[],"mappings":"AAgBA,wDAAwD;AACxD,MAAM,CAAC,MAAM,2BAA2B,GAAuB;IAC7D,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;IAC1B,WAAW,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;CAC5B,CAAC;AAeF;2DAC2D;AAC3D,M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E,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,cAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,UAAU,CAAC;QACzD,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC;KAC9C,CAAC,CAAC;SACF,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACb,MAAM,UAAU,GAAG,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QAC3E,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,OAAO,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/domain/schemas.d.ts
CHANGED
|
@@ -1,9 +1,51 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
export declare const registerAgentInputShape: {
|
|
3
|
+
readonly agent_id: z.ZodOptional<z.ZodString>;
|
|
4
|
+
readonly kind: z.ZodString;
|
|
5
|
+
readonly owner: z.ZodOptional<z.ZodString>;
|
|
6
|
+
readonly model: z.ZodOptional<z.ZodString>;
|
|
7
|
+
readonly summary: z.ZodOptional<z.ZodString>;
|
|
8
|
+
readonly status: z.ZodOptional<z.ZodEnum<["active", "blocked", "waiting_review", "done"]>>;
|
|
9
|
+
readonly branch: z.ZodOptional<z.ZodString>;
|
|
10
|
+
readonly worktree: z.ZodOptional<z.ZodString>;
|
|
11
|
+
readonly cwd: z.ZodOptional<z.ZodString>;
|
|
12
|
+
readonly pid: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
};
|
|
14
|
+
export declare const registerAgentInputSchema: z.ZodObject<{
|
|
15
|
+
readonly agent_id: z.ZodOptional<z.ZodString>;
|
|
16
|
+
readonly kind: z.ZodString;
|
|
17
|
+
readonly owner: z.ZodOptional<z.ZodString>;
|
|
18
|
+
readonly model: z.ZodOptional<z.ZodString>;
|
|
19
|
+
readonly summary: z.ZodOptional<z.ZodString>;
|
|
20
|
+
readonly status: z.ZodOptional<z.ZodEnum<["active", "blocked", "waiting_review", "done"]>>;
|
|
21
|
+
readonly branch: z.ZodOptional<z.ZodString>;
|
|
22
|
+
readonly worktree: z.ZodOptional<z.ZodString>;
|
|
23
|
+
readonly cwd: z.ZodOptional<z.ZodString>;
|
|
24
|
+
readonly pid: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
kind: string;
|
|
27
|
+
status?: "active" | "blocked" | "waiting_review" | "done" | undefined;
|
|
28
|
+
owner?: string | undefined;
|
|
29
|
+
branch?: string | undefined;
|
|
30
|
+
worktree?: string | undefined;
|
|
31
|
+
agent_id?: string | undefined;
|
|
32
|
+
model?: string | undefined;
|
|
33
|
+
pid?: number | undefined;
|
|
34
|
+
cwd?: string | undefined;
|
|
35
|
+
summary?: string | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
kind: string;
|
|
38
|
+
status?: "active" | "blocked" | "waiting_review" | "done" | undefined;
|
|
39
|
+
owner?: string | undefined;
|
|
40
|
+
branch?: string | undefined;
|
|
41
|
+
worktree?: string | undefined;
|
|
42
|
+
agent_id?: string | undefined;
|
|
43
|
+
model?: string | undefined;
|
|
44
|
+
pid?: number | undefined;
|
|
45
|
+
cwd?: string | undefined;
|
|
46
|
+
summary?: string | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
export type RegisterAgentInput = z.infer<typeof registerAgentInputSchema>;
|
|
7
49
|
export declare const claimWorkInputShape: {
|
|
8
50
|
readonly task_id: z.ZodString;
|
|
9
51
|
readonly title: z.ZodString;
|
|
@@ -17,6 +59,7 @@ export declare const claimWorkInputShape: {
|
|
|
17
59
|
readonly domains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
18
60
|
readonly risk_tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
19
61
|
readonly notes: z.ZodOptional<z.ZodString>;
|
|
62
|
+
readonly agent_id: z.ZodOptional<z.ZodString>;
|
|
20
63
|
};
|
|
21
64
|
export declare const claimWorkInputSchema: z.ZodObject<{
|
|
22
65
|
readonly task_id: z.ZodString;
|
|
@@ -31,6 +74,7 @@ export declare const claimWorkInputSchema: z.ZodObject<{
|
|
|
31
74
|
readonly domains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
32
75
|
readonly risk_tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
33
76
|
readonly notes: z.ZodOptional<z.ZodString>;
|
|
77
|
+
readonly agent_id: z.ZodOptional<z.ZodString>;
|
|
34
78
|
}, "strip", z.ZodTypeAny, {
|
|
35
79
|
task_id: string;
|
|
36
80
|
title: string;
|
|
@@ -44,6 +88,7 @@ export declare const claimWorkInputSchema: z.ZodObject<{
|
|
|
44
88
|
risk_tags?: string[] | undefined;
|
|
45
89
|
notes?: string | undefined;
|
|
46
90
|
parent_task_id?: string | undefined;
|
|
91
|
+
agent_id?: string | undefined;
|
|
47
92
|
}, {
|
|
48
93
|
task_id: string;
|
|
49
94
|
title: string;
|
|
@@ -57,8 +102,47 @@ export declare const claimWorkInputSchema: z.ZodObject<{
|
|
|
57
102
|
risk_tags?: string[] | undefined;
|
|
58
103
|
notes?: string | undefined;
|
|
59
104
|
parent_task_id?: string | undefined;
|
|
105
|
+
agent_id?: string | undefined;
|
|
60
106
|
}>;
|
|
61
107
|
export type ClaimWorkInput = z.infer<typeof claimWorkInputSchema>;
|
|
108
|
+
export declare const updateTaskInputShape: {
|
|
109
|
+
readonly task_id: z.ZodString;
|
|
110
|
+
readonly kind: z.ZodEnum<["intent", "progress", "assumption", "decision", "question", "answer", "blocker", "finding"]>;
|
|
111
|
+
readonly content: z.ZodString;
|
|
112
|
+
readonly agent: z.ZodOptional<z.ZodString>;
|
|
113
|
+
readonly agent_id: z.ZodOptional<z.ZodString>;
|
|
114
|
+
};
|
|
115
|
+
export declare const updateTaskInputSchema: z.ZodObject<{
|
|
116
|
+
readonly task_id: z.ZodString;
|
|
117
|
+
readonly kind: z.ZodEnum<["intent", "progress", "assumption", "decision", "question", "answer", "blocker", "finding"]>;
|
|
118
|
+
readonly content: z.ZodString;
|
|
119
|
+
readonly agent: z.ZodOptional<z.ZodString>;
|
|
120
|
+
readonly agent_id: z.ZodOptional<z.ZodString>;
|
|
121
|
+
}, "strip", z.ZodTypeAny, {
|
|
122
|
+
task_id: string;
|
|
123
|
+
kind: "intent" | "progress" | "assumption" | "decision" | "question" | "answer" | "blocker" | "finding";
|
|
124
|
+
content: string;
|
|
125
|
+
agent?: string | undefined;
|
|
126
|
+
agent_id?: string | undefined;
|
|
127
|
+
}, {
|
|
128
|
+
task_id: string;
|
|
129
|
+
kind: "intent" | "progress" | "assumption" | "decision" | "question" | "answer" | "blocker" | "finding";
|
|
130
|
+
content: string;
|
|
131
|
+
agent?: string | undefined;
|
|
132
|
+
agent_id?: string | undefined;
|
|
133
|
+
}>;
|
|
134
|
+
export type UpdateTaskInput = z.infer<typeof updateTaskInputSchema>;
|
|
135
|
+
export declare const getTaskContextInputShape: {
|
|
136
|
+
readonly task_id: z.ZodString;
|
|
137
|
+
};
|
|
138
|
+
export declare const getTaskContextInputSchema: z.ZodObject<{
|
|
139
|
+
readonly task_id: z.ZodString;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
task_id: string;
|
|
142
|
+
}, {
|
|
143
|
+
task_id: string;
|
|
144
|
+
}>;
|
|
145
|
+
export type GetTaskContextInput = z.infer<typeof getTaskContextInputSchema>;
|
|
62
146
|
export declare const handoffInputShape: {
|
|
63
147
|
readonly task_id: z.ZodString;
|
|
64
148
|
readonly status: z.ZodString;
|
|
@@ -84,6 +168,7 @@ export declare const handoffInputShape: {
|
|
|
84
168
|
field: string;
|
|
85
169
|
source: string;
|
|
86
170
|
}>, "many">>;
|
|
171
|
+
readonly agent_id: z.ZodOptional<z.ZodString>;
|
|
87
172
|
};
|
|
88
173
|
export declare const handoffInputSchema: z.ZodObject<{
|
|
89
174
|
readonly task_id: z.ZodString;
|
|
@@ -110,10 +195,12 @@ export declare const handoffInputSchema: z.ZodObject<{
|
|
|
110
195
|
field: string;
|
|
111
196
|
source: string;
|
|
112
197
|
}>, "many">>;
|
|
198
|
+
readonly agent_id: z.ZodOptional<z.ZodString>;
|
|
113
199
|
}, "strip", z.ZodTypeAny, {
|
|
114
200
|
status: string;
|
|
115
201
|
task_id: string;
|
|
116
202
|
what_changed: string;
|
|
203
|
+
agent_id?: string | undefined;
|
|
117
204
|
changed_files?: string[] | undefined;
|
|
118
205
|
tests_run?: string[] | undefined;
|
|
119
206
|
known_risks?: string[] | undefined;
|
|
@@ -133,6 +220,7 @@ export declare const handoffInputSchema: z.ZodObject<{
|
|
|
133
220
|
status: string;
|
|
134
221
|
task_id: string;
|
|
135
222
|
what_changed: string;
|
|
223
|
+
agent_id?: string | undefined;
|
|
136
224
|
changed_files?: string[] | undefined;
|
|
137
225
|
tests_run?: string[] | undefined;
|
|
138
226
|
known_risks?: string[] | undefined;
|
package/dist/domain/schemas.js
CHANGED
|
@@ -1,9 +1,39 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { agentStatusValues } from '../db/rows.js';
|
|
2
3
|
/**
|
|
3
4
|
* Zod input schemas for the MCP tools. Each tool exposes its schema as a raw
|
|
4
5
|
* shape (the form `McpServer.registerTool` expects) plus an inferred input type.
|
|
5
6
|
* Fields use snake_case to match the tool's public JSON contract.
|
|
6
7
|
*/
|
|
8
|
+
/** Optional instance identity carried by every write so it refreshes presence.
|
|
9
|
+
* Distinct from the `agent` *kind* string — this identifies one running
|
|
10
|
+
* instance (e.g. `claude-code:7p8v`), obtained from `register_agent`. */
|
|
11
|
+
const agentIdField = z
|
|
12
|
+
.string()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe('Identity of the registered agent instance doing this work, e.g. claude-code:7p8v. ' +
|
|
15
|
+
"Supplying it refreshes the agent's presence (liveness) in the roster.");
|
|
16
|
+
export const registerAgentInputShape = {
|
|
17
|
+
agent_id: z
|
|
18
|
+
.string()
|
|
19
|
+
.optional()
|
|
20
|
+
.describe('Stable per-session identity for this agent instance, e.g. claude-code:7p8v. Omit on the ' +
|
|
21
|
+
'first call to have one generated, then reuse the returned id on every later call so ' +
|
|
22
|
+
'presence stays attributed to the same instance.'),
|
|
23
|
+
kind: z.string().min(1).describe('Agent type / provider, e.g. claude-code, codex, cursor'),
|
|
24
|
+
owner: z.string().optional().describe('Human accountable for this agent'),
|
|
25
|
+
model: z.string().optional().describe('Model the agent is running, e.g. opus-4.8'),
|
|
26
|
+
summary: z.string().optional().describe('One line: what this agent is working on right now'),
|
|
27
|
+
status: z
|
|
28
|
+
.enum(agentStatusValues)
|
|
29
|
+
.optional()
|
|
30
|
+
.describe('Reported status: active, blocked, waiting_review, or done (default active)'),
|
|
31
|
+
branch: z.string().optional().describe('Git branch, if known'),
|
|
32
|
+
worktree: z.string().optional().describe('Git worktree path, if used'),
|
|
33
|
+
cwd: z.string().optional().describe('Working directory, for disambiguating instances'),
|
|
34
|
+
pid: z.number().int().optional().describe('Process id, for disambiguating instances'),
|
|
35
|
+
};
|
|
36
|
+
export const registerAgentInputSchema = z.object(registerAgentInputShape);
|
|
7
37
|
export const claimWorkInputShape = {
|
|
8
38
|
task_id: z.string().min(1).describe('Stable identifier for the task, e.g. TASK-12'),
|
|
9
39
|
title: z.string().min(1).describe('Short human-readable title'),
|
|
@@ -26,8 +56,32 @@ export const claimWorkInputShape = {
|
|
|
26
56
|
domains: z.array(z.string()).optional().describe('Product domains touched, e.g. payments'),
|
|
27
57
|
risk_tags: z.array(z.string()).optional().describe('Risk tags, e.g. payment-flow'),
|
|
28
58
|
notes: z.string().optional().describe('Freeform notes'),
|
|
59
|
+
agent_id: agentIdField,
|
|
29
60
|
};
|
|
30
61
|
export const claimWorkInputSchema = z.object(claimWorkInputShape);
|
|
62
|
+
export const updateTaskInputShape = {
|
|
63
|
+
task_id: z.string().min(1).describe('Claimed task receiving this memory entry'),
|
|
64
|
+
kind: z
|
|
65
|
+
.enum([
|
|
66
|
+
'intent',
|
|
67
|
+
'progress',
|
|
68
|
+
'assumption',
|
|
69
|
+
'decision',
|
|
70
|
+
'question',
|
|
71
|
+
'answer',
|
|
72
|
+
'blocker',
|
|
73
|
+
'finding',
|
|
74
|
+
])
|
|
75
|
+
.describe('The kind of task-scoped update'),
|
|
76
|
+
content: z.string().min(1).describe('Concise context another agent needs'),
|
|
77
|
+
agent: z.string().optional().describe('Agent recording the update; defaults to the claimant'),
|
|
78
|
+
agent_id: agentIdField,
|
|
79
|
+
};
|
|
80
|
+
export const updateTaskInputSchema = z.object(updateTaskInputShape);
|
|
81
|
+
export const getTaskContextInputShape = {
|
|
82
|
+
task_id: z.string().min(1).describe('Task whose shared context should be read'),
|
|
83
|
+
};
|
|
84
|
+
export const getTaskContextInputSchema = z.object(getTaskContextInputShape);
|
|
31
85
|
export const handoffInputShape = {
|
|
32
86
|
task_id: z.string().min(1).describe('The task being handed off, e.g. TASK-12'),
|
|
33
87
|
status: z.string().min(1).describe('Handoff status, e.g. done, blocked, in_progress'),
|
|
@@ -54,6 +108,7 @@ export const handoffInputShape = {
|
|
|
54
108
|
.array(z.object({ field: z.string(), source: z.string() }))
|
|
55
109
|
.optional()
|
|
56
110
|
.describe('Where each claim came from, e.g. { field: "tests", source: "command output" }'),
|
|
111
|
+
agent_id: agentIdField,
|
|
57
112
|
};
|
|
58
113
|
export const handoffInputSchema = z.object(handoffInputShape);
|
|
59
114
|
export const reviewReadyInputShape = {
|