@hasna/todos 0.11.81 → 0.11.83

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.
@@ -21,7 +21,7 @@
21
21
  * subnet routing — pure API-client path per the locked architecture.
22
22
  */
23
23
  import { type HasnaStorageClient } from "@hasna/contracts/client/storage";
24
- import type { Task, TaskFilter } from "../types/index.js";
24
+ import type { Agent, Plan, Project, RegisterAgentInput, Task, TaskComment, TaskDependency, TaskFilter } from "../types/index.js";
25
25
  type Env = Record<string, string | undefined>;
26
26
  /**
27
27
  * Resolve the todos cloud storage client from the environment. Returns a ready
@@ -60,6 +60,25 @@ export interface CloudStats {
60
60
  * local SQLite island.
61
61
  */
62
62
  export declare function cloudGetStats(client: HasnaStorageClient): Promise<CloudStats>;
63
+ /** List registered agents from the cloud (`GET /v1/agents`). */
64
+ export declare function cloudListAgents(client: HasnaStorageClient): Promise<Agent[]>;
65
+ /** List projects from the cloud (`GET /v1/projects`). */
66
+ export declare function cloudListProjects(client: HasnaStorageClient): Promise<Project[]>;
67
+ /** List plans from the cloud (`GET /v1/plans`), optionally scoped to a project. */
68
+ export declare function cloudListPlans(client: HasnaStorageClient, projectId?: string): Promise<Plan[]>;
69
+ /**
70
+ * Add a comment to a task in the cloud (`POST /v1/tasks/:id/comments`). The server
71
+ * validates that the task exists and returns 404 (surfaced as a thrown error by the
72
+ * transport) when it does not — so a comment on a missing cloud task fails loudly
73
+ * instead of silently succeeding.
74
+ */
75
+ export declare function cloudAddComment(client: HasnaStorageClient, taskId: string, input: {
76
+ content: string;
77
+ agent_id?: string;
78
+ session_id?: string;
79
+ type?: string;
80
+ progress_pct?: number;
81
+ }): Promise<TaskComment>;
63
82
  /**
64
83
  * Count tasks matching a filter. The `/v1/tasks` list response now returns a
65
84
  * SQL-side `total` (full match count, independent of limit/offset), so we ask for
@@ -67,5 +86,69 @@ export declare function cloudGetStats(client: HasnaStorageClient): Promise<Cloud
67
86
  * client (which previously loaded every matching task over HTTP just to count).
68
87
  */
69
88
  export declare function cloudCountTasks(client: HasnaStorageClient, filter?: TaskFilter): Promise<number>;
89
+ /**
90
+ * Register (or renew) an agent in the shared cloud roster (`POST /v1/agents`).
91
+ * This is the fix for the agent-identity misroute: `todos init` and the MCP
92
+ * `register_agent` tool historically wrote the agent to LOCAL sqlite even on a
93
+ * flipped machine, so the cloud `/v1/agents` roster never saw it. Routing through
94
+ * here writes the agent to the shared dataset with the bearer key. A name that is
95
+ * already actively held by another session comes back as HTTP 409, which the
96
+ * transport throws — surfaced to the caller as a conflict error (parity with the
97
+ * local conflict path) rather than a silent duplicate.
98
+ */
99
+ export declare function cloudRegisterAgent(client: HasnaStorageClient, input: RegisterAgentInput): Promise<Agent>;
100
+ /** Result of a cloud lock/unlock action (mirrors the local `LockResult` shape). */
101
+ export interface CloudLockResult {
102
+ success: boolean;
103
+ locked_by?: string;
104
+ locked_at?: string;
105
+ expires_at?: string;
106
+ error?: string;
107
+ }
108
+ /**
109
+ * Acquire an exclusive lock on a cloud task (`POST /v1/tasks/:id/lock`). Locking is
110
+ * a task-field operation (`locked_by`/`locked_at`) resolved server-side against the
111
+ * shared dataset so a flipped machine coordinates on the SAME lock as every other
112
+ * agent — the previous local-sqlite lookup 404'd cloud tasks ("Task not found").
113
+ */
114
+ export declare function cloudLockTask(client: HasnaStorageClient, id: string, agentId: string): Promise<CloudLockResult>;
115
+ /** Release a lock on a cloud task (`POST /v1/tasks/:id/unlock`). */
116
+ export declare function cloudUnlockTask(client: HasnaStorageClient, id: string, agentId?: string): Promise<boolean>;
117
+ /** A task's dependency edges from the cloud (`GET /v1/tasks/:id/dependencies`). */
118
+ export interface CloudTaskDependencies {
119
+ dependencies: TaskDependency[];
120
+ blocked_by: TaskDependency[];
121
+ }
122
+ /** List a cloud task's dependency edges (`GET /v1/tasks/:id/dependencies`). */
123
+ export declare function cloudGetDependencies(client: HasnaStorageClient, id: string): Promise<CloudTaskDependencies>;
124
+ /** Add a dependency edge to a cloud task (`POST /v1/tasks/:id/dependencies`). */
125
+ export declare function cloudAddDependency(client: HasnaStorageClient, id: string, dependsOn: string): Promise<TaskDependency>;
126
+ /** Remove a dependency edge from a cloud task (`DELETE /v1/tasks/:id/dependencies/:dep`). */
127
+ export declare function cloudRemoveDependency(client: HasnaStorageClient, id: string, dependsOn: string): Promise<boolean>;
128
+ /** A verification record returned by the cloud. */
129
+ export interface CloudTaskVerification {
130
+ id: string;
131
+ task_id: string;
132
+ command: string;
133
+ status: "passed" | "failed" | "unknown";
134
+ output_summary: string | null;
135
+ artifact_path: string | null;
136
+ agent_id: string | null;
137
+ run_at: string;
138
+ created_at: string;
139
+ }
140
+ /**
141
+ * Record a verification command + result against a cloud task
142
+ * (`POST /v1/tasks/:id/verifications`). The previous local path wrote the row to
143
+ * this machine's sqlite where the cloud task does not exist, tripping a FOREIGN
144
+ * KEY constraint; routing to the shared store attaches it to the real task.
145
+ */
146
+ export declare function cloudRecordVerification(client: HasnaStorageClient, id: string, input: {
147
+ command: string;
148
+ status?: string;
149
+ output_summary?: string;
150
+ artifact_path?: string;
151
+ agent_id?: string;
152
+ }): Promise<CloudTaskVerification>;
70
153
  export {};
71
154
  //# sourceMappingURL=cloud-router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cloud-router.d.ts","sourceRoot":"","sources":["../../src/cli/cloud-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAwB,KAAK,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAChG,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE1D,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAI9C;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,GAAwB,GAAG,kBAAkB,GAAG,IAAI,CAiB5F;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAAC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":["../../../src/cli/commands/agent-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,QAkZrD"}
1
+ {"version":3,"file":"agent-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/agent-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,QA0ZrD"}
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-hooks-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/mcp-hooks-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0MzC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,QAqpCxD"}
1
+ {"version":3,"file":"mcp-hooks-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/mcp-hooks-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2MzC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,QAmqCxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"plan-template-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/plan-template-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8BzC,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,OAAO,QAqe5D"}
1
+ {"version":3,"file":"plan-template-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/plan-template-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+BzC,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,OAAO,QAwe5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"project-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/project-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoJzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QA24BvD"}
1
+ {"version":3,"file":"project-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/project-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqJzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QAg8BvD"}
@@ -1 +1 @@
1
- {"version":3,"file":"query-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/query-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6NzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,QA61FrD"}
1
+ {"version":3,"file":"query-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/query-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8NzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,QAg4FrD"}
@@ -1 +1 @@
1
- {"version":3,"file":"task-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/task-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwMzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QA+jCpD"}
1
+ {"version":3,"file":"task-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/task-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0MzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAqlCpD"}