@slopus/happy-agent-client 0.0.75 → 0.0.76
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 -0
- package/dist/HappyAgentClient.d.ts +25 -0
- package/dist/HappyAgentClient.d.ts.map +1 -1
- package/dist/HappyAgentClient.js +80 -0
- package/dist/HappyAgentClient.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/protocol/bootstrap.d.ts +70 -0
- package/dist/protocol/bootstrap.d.ts.map +1 -1
- package/dist/protocol/bootstrap.js +8 -0
- package/dist/protocol/bootstrap.js.map +1 -1
- package/dist/protocol/events.d.ts +146 -1
- package/dist/protocol/events.d.ts.map +1 -1
- package/dist/protocol/events.js +22 -0
- package/dist/protocol/events.js.map +1 -1
- package/dist/protocol/tasks.d.ts +282 -0
- package/dist/protocol/tasks.d.ts.map +1 -0
- package/dist/protocol/tasks.js +88 -0
- package/dist/protocol/tasks.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/** Tasks: bot-like conversations for one piece of work, with an owner and per-person lists. */
|
|
2
|
+
import { Type } from "@sinclair/typebox";
|
|
3
|
+
import { agentSchema } from "./agents.js";
|
|
4
|
+
import { computeSchema, cuid2Schema, mutationIdSchema, Nullable, resourceVersionSchema, timestampSchema, } from "./common.js";
|
|
5
|
+
import { userIdSchema } from "./userId.js";
|
|
6
|
+
/** A human display name: nonblank, bounded, and free of ASCII control characters. */
|
|
7
|
+
export const taskNameSchema = Type.String({
|
|
8
|
+
maxLength: 256,
|
|
9
|
+
minLength: 1,
|
|
10
|
+
pattern: "^(?=.*\\S)[^\\x00-\\x1f\\x7f]+$",
|
|
11
|
+
});
|
|
12
|
+
/** The immutable local folder name chosen when a task is created. */
|
|
13
|
+
export const taskFolderNameSchema = Type.String({
|
|
14
|
+
maxLength: 64,
|
|
15
|
+
minLength: 1,
|
|
16
|
+
pattern: "^[a-z][a-z0-9_]{0,63}$",
|
|
17
|
+
});
|
|
18
|
+
/** A task and its one independently versioned agent. Tasks have no avatar and no order. */
|
|
19
|
+
export const taskSchema = Type.Object({
|
|
20
|
+
/** The task's one agent, embedded in full for list rendering. */
|
|
21
|
+
agent: agentSchema,
|
|
22
|
+
archivedAt: Nullable(timestampSchema),
|
|
23
|
+
/**
|
|
24
|
+
* Whether the caller may archive and unarchive the task. Caller-relative: absent from
|
|
25
|
+
* `task.created` events and from daemons older than task archival routes.
|
|
26
|
+
*/
|
|
27
|
+
canArchive: Type.Optional(Type.Boolean()),
|
|
28
|
+
/** Mirrors the dedicated workspace's compute. */
|
|
29
|
+
compute: computeSchema,
|
|
30
|
+
createdAt: timestampSchema,
|
|
31
|
+
/** The agent whose `create_task` call created the task. */
|
|
32
|
+
creatorAgentId: Nullable(cuid2Schema),
|
|
33
|
+
/** Immutable local snake_case folder name. */
|
|
34
|
+
folderName: taskFolderNameSchema,
|
|
35
|
+
id: cuid2Schema,
|
|
36
|
+
name: taskNameSchema,
|
|
37
|
+
/** The person the task belongs to; `null` in standalone mode or when nobody was identified. */
|
|
38
|
+
ownerUserId: Nullable(userIdSchema),
|
|
39
|
+
status: Type.Union([Type.Literal("active"), Type.Literal("archived")]),
|
|
40
|
+
updatedAt: timestampSchema,
|
|
41
|
+
version: resourceVersionSchema,
|
|
42
|
+
/** The task's dedicated workspace, distinct from the task and agent IDs. */
|
|
43
|
+
workspaceId: cuid2Schema,
|
|
44
|
+
});
|
|
45
|
+
/** One person's place in one task: joining puts the task in their own ordered list. */
|
|
46
|
+
export const taskMembershipSchema = Type.Object({
|
|
47
|
+
joinedAt: timestampSchema,
|
|
48
|
+
/** An opaque sort key within this member's own list. */
|
|
49
|
+
orderKey: Type.String(),
|
|
50
|
+
taskId: cuid2Schema,
|
|
51
|
+
/** The member, or `null` for the one person of a standalone installation. */
|
|
52
|
+
userId: Nullable(userIdSchema),
|
|
53
|
+
});
|
|
54
|
+
/** `GET /v0/tasks` query: every task, or only the caller's joined tasks in the caller's order. */
|
|
55
|
+
export const taskListScopeSchema = Type.Union([Type.Literal("all"), Type.Literal("joined")]);
|
|
56
|
+
/** `GET /v0/tasks` — `memberships` is always every membership of the caller, in their order. */
|
|
57
|
+
export const taskListResponseSchema = Type.Object({
|
|
58
|
+
memberships: Type.Array(taskMembershipSchema),
|
|
59
|
+
tasks: Type.Array(taskSchema),
|
|
60
|
+
});
|
|
61
|
+
/** Every single-task route answers with the task and the caller's membership in it. */
|
|
62
|
+
export const taskResponseSchema = Type.Object({
|
|
63
|
+
membership: Nullable(taskMembershipSchema),
|
|
64
|
+
task: taskSchema,
|
|
65
|
+
});
|
|
66
|
+
/** `POST /v0/tasks/:taskId/join` */
|
|
67
|
+
export const joinTaskRequestSchema = Type.Object({
|
|
68
|
+
mutationId: Type.Optional(mutationIdSchema),
|
|
69
|
+
});
|
|
70
|
+
/** `POST /v0/tasks/:taskId/leave` */
|
|
71
|
+
export const leaveTaskRequestSchema = Type.Object({
|
|
72
|
+
mutationId: Type.Optional(mutationIdSchema),
|
|
73
|
+
});
|
|
74
|
+
/** `POST /v0/tasks/:taskId/reorder` — moves the task within the caller's own list only. */
|
|
75
|
+
export const reorderTaskRequestSchema = Type.Object({
|
|
76
|
+
/** The joined task to place this one after, or `null` to move it first. */
|
|
77
|
+
afterId: Nullable(cuid2Schema),
|
|
78
|
+
mutationId: Type.Optional(mutationIdSchema),
|
|
79
|
+
});
|
|
80
|
+
/** `POST /v0/tasks/:taskId/archive` — requires `If-Match`; the owner or team owner only. */
|
|
81
|
+
export const archiveTaskRequestSchema = Type.Object({
|
|
82
|
+
mutationId: Type.Optional(mutationIdSchema),
|
|
83
|
+
});
|
|
84
|
+
/** `POST /v0/tasks/:taskId/unarchive` — requires `If-Match`; the owner or team owner only. */
|
|
85
|
+
export const unarchiveTaskRequestSchema = Type.Object({
|
|
86
|
+
mutationId: Type.Optional(mutationIdSchema),
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=tasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../sources/protocol/tasks.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAE/F,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACH,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,qBAAqB,EACrB,eAAe,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,qFAAqF;AACrF,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC;IACtC,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,CAAC;IACZ,OAAO,EAAE,iCAAiC;CAC7C,CAAC,CAAC;AAGH,qEAAqE;AACrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC5C,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,CAAC;IACZ,OAAO,EAAE,wBAAwB;CACpC,CAAC,CAAC;AAGH,2FAA2F;AAC3F,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAClC,iEAAiE;IACjE,KAAK,EAAE,WAAW;IAClB,UAAU,EAAE,QAAQ,CAAC,eAAe,CAAC;IACrC;;;OAGG;IACH,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IACzC,iDAAiD;IACjD,OAAO,EAAE,aAAa;IACtB,SAAS,EAAE,eAAe;IAC1B,2DAA2D;IAC3D,cAAc,EAAE,QAAQ,CAAC,WAAW,CAAC;IACrC,8CAA8C;IAC9C,UAAU,EAAE,oBAAoB;IAChC,EAAE,EAAE,WAAW;IACf,IAAI,EAAE,cAAc;IACpB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