@dejima/sdk 0.8.68 → 0.8.70
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/dist/client.d.ts +15 -4
- package/dist/client.js +18 -5
- package/dist/index.d.ts +13 -3
- package/dist/index.js +13 -3
- package/dist/session.d.ts +1 -1
- package/dist/session.js +7 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -32,8 +32,16 @@ export declare class Client {
|
|
|
32
32
|
private island;
|
|
33
33
|
/** All islands, most-recently-used first. */
|
|
34
34
|
listIslands(): Promise<any[]>;
|
|
35
|
-
/** Provision an island. `repo` is a git URL or local path.
|
|
36
|
-
|
|
35
|
+
/** Provision an island. `repo` is a git URL or local path.
|
|
36
|
+
*
|
|
37
|
+
* `noRepo` instead provisions an island with an empty `/workspace` and no
|
|
38
|
+
* origin — for the things that genuinely have no repo (assistant brains,
|
|
39
|
+
* headless task runners, scratch sandboxes). It requires `name` and refuses
|
|
40
|
+
* `repo`/`seedPath`: the daemon never infers the mode from an empty `repo`, so
|
|
41
|
+
* a URL eaten by the shell fails loudly instead of quietly producing an island
|
|
42
|
+
* indistinguishable from a failed clone. */
|
|
43
|
+
createIsland(repo?: string, opts?: {
|
|
44
|
+
noRepo?: boolean;
|
|
37
45
|
agent?: string;
|
|
38
46
|
name?: string;
|
|
39
47
|
image?: string;
|
|
@@ -83,8 +91,11 @@ export declare class Client {
|
|
|
83
91
|
getAgent(name: string, agentId: string): Promise<any>;
|
|
84
92
|
/** Rename an agent's cosmetic label (`""` clears it). */
|
|
85
93
|
updateAgent(name: string, agentId: string, label: string): Promise<any>;
|
|
86
|
-
/** Remove
|
|
87
|
-
|
|
94
|
+
/** Remove an agent (kills its session, prunes its worktree; the branch and its
|
|
95
|
+
* commits are kept). The daemon refuses with a 409 when that worktree holds
|
|
96
|
+
* uncommitted changes — pruning it discards them permanently — or when it
|
|
97
|
+
* can't check (island hibernated, container wedged); `force` removes anyway. */
|
|
98
|
+
removeAgent(name: string, agentId: string, force?: boolean): Promise<void>;
|
|
88
99
|
/** Relaunch an agent in place so it picks up a changed environment (e.g. a new
|
|
89
100
|
* secret). `resume` continues its previous conversation where supported. */
|
|
90
101
|
restartAgent(name: string, agentId: string, opts?: {
|
package/dist/client.js
CHANGED
|
@@ -87,10 +87,18 @@ export class Client {
|
|
|
87
87
|
listIslands() {
|
|
88
88
|
return this.json("GET", "/v1/islands");
|
|
89
89
|
}
|
|
90
|
-
/** Provision an island. `repo` is a git URL or local path.
|
|
91
|
-
|
|
90
|
+
/** Provision an island. `repo` is a git URL or local path.
|
|
91
|
+
*
|
|
92
|
+
* `noRepo` instead provisions an island with an empty `/workspace` and no
|
|
93
|
+
* origin — for the things that genuinely have no repo (assistant brains,
|
|
94
|
+
* headless task runners, scratch sandboxes). It requires `name` and refuses
|
|
95
|
+
* `repo`/`seedPath`: the daemon never infers the mode from an empty `repo`, so
|
|
96
|
+
* a URL eaten by the shell fails loudly instead of quietly producing an island
|
|
97
|
+
* indistinguishable from a failed clone. */
|
|
98
|
+
createIsland(repo = "", opts = {}) {
|
|
92
99
|
const body = clean({
|
|
93
100
|
repo,
|
|
101
|
+
no_repo: opts.noRepo || undefined,
|
|
94
102
|
agent: opts.agent,
|
|
95
103
|
name: opts.name,
|
|
96
104
|
image: opts.image,
|
|
@@ -170,9 +178,14 @@ export class Client {
|
|
|
170
178
|
updateAgent(name, agentId, label) {
|
|
171
179
|
return this.json("PATCH", `${this.island(name)}/agents/${this.seg(agentId)}`, { json: { label } });
|
|
172
180
|
}
|
|
173
|
-
/** Remove
|
|
174
|
-
|
|
175
|
-
|
|
181
|
+
/** Remove an agent (kills its session, prunes its worktree; the branch and its
|
|
182
|
+
* commits are kept). The daemon refuses with a 409 when that worktree holds
|
|
183
|
+
* uncommitted changes — pruning it discards them permanently — or when it
|
|
184
|
+
* can't check (island hibernated, container wedged); `force` removes anyway. */
|
|
185
|
+
async removeAgent(name, agentId, force = false) {
|
|
186
|
+
await this.request("DELETE", `${this.island(name)}/agents/${this.seg(agentId)}`, {
|
|
187
|
+
query: force ? { force: true } : undefined,
|
|
188
|
+
});
|
|
176
189
|
}
|
|
177
190
|
/** Relaunch an agent in place so it picks up a changed environment (e.g. a new
|
|
178
191
|
* secret). `resume` continues its previous conversation where supported. */
|
package/dist/index.d.ts
CHANGED
|
@@ -8,12 +8,22 @@
|
|
|
8
8
|
* console.log(await dj.listIslands());
|
|
9
9
|
* ```
|
|
10
10
|
*
|
|
11
|
-
* Alpha (0.x): fields may change until 1.0.
|
|
12
|
-
*
|
|
11
|
+
* Alpha (0.x): fields may change until 1.0.
|
|
12
|
+
*
|
|
13
|
+
* THIS CLIENT IS HAND-WRITTEN, not generated. It is kept in step with
|
|
14
|
+
* `openapi.yaml` by hand, and it lags: methods return `any` rather than domain
|
|
15
|
+
* types, and a field documented in the spec does not reach you until someone
|
|
16
|
+
* adds it here. An earlier version of this comment said the REST layer
|
|
17
|
+
* "mirrors openapi.yaml", which reads as generated-and-therefore-current and
|
|
18
|
+
* is what a client author would reasonably rely on.
|
|
19
|
+
*
|
|
20
|
+
* If you want types, generate them from `openapi.yaml` directly — the spec is
|
|
21
|
+
* gated against the daemon on every commit (sdk/openapi_field_parity.py), so it
|
|
22
|
+
* is the trustworthy source. This client is not.
|
|
13
23
|
*/
|
|
14
24
|
export { Client } from "./client.js";
|
|
15
25
|
export type { ClientOptions } from "./client.js";
|
|
16
26
|
export { Session } from "./session.js";
|
|
17
27
|
export type { SessionEnvelope, WebSocketLike } from "./session.js";
|
|
18
28
|
export { DejimaError } from "./errors.js";
|
|
19
|
-
export declare const VERSION = "0.8.
|
|
29
|
+
export declare const VERSION = "0.8.70";
|
package/dist/index.js
CHANGED
|
@@ -8,10 +8,20 @@
|
|
|
8
8
|
* console.log(await dj.listIslands());
|
|
9
9
|
* ```
|
|
10
10
|
*
|
|
11
|
-
* Alpha (0.x): fields may change until 1.0.
|
|
12
|
-
*
|
|
11
|
+
* Alpha (0.x): fields may change until 1.0.
|
|
12
|
+
*
|
|
13
|
+
* THIS CLIENT IS HAND-WRITTEN, not generated. It is kept in step with
|
|
14
|
+
* `openapi.yaml` by hand, and it lags: methods return `any` rather than domain
|
|
15
|
+
* types, and a field documented in the spec does not reach you until someone
|
|
16
|
+
* adds it here. An earlier version of this comment said the REST layer
|
|
17
|
+
* "mirrors openapi.yaml", which reads as generated-and-therefore-current and
|
|
18
|
+
* is what a client author would reasonably rely on.
|
|
19
|
+
*
|
|
20
|
+
* If you want types, generate them from `openapi.yaml` directly — the spec is
|
|
21
|
+
* gated against the daemon on every commit (sdk/openapi_field_parity.py), so it
|
|
22
|
+
* is the trustworthy source. This client is not.
|
|
13
23
|
*/
|
|
14
24
|
export { Client } from "./client.js";
|
|
15
25
|
export { Session } from "./session.js";
|
|
16
26
|
export { DejimaError } from "./errors.js";
|
|
17
|
-
export const VERSION = "0.8.
|
|
27
|
+
export const VERSION = "0.8.70";
|
package/dist/session.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DejimaError } from "./errors.js";
|
|
2
2
|
/** One PTY session envelope on the wire (see openapi.yaml `SessionEnvelope`). */
|
|
3
3
|
export interface SessionEnvelope {
|
|
4
|
-
type: "hello" | "data" | "resize" | "error";
|
|
4
|
+
type: "hello" | "data" | "resize" | "error" | "exit";
|
|
5
5
|
b64?: string;
|
|
6
6
|
rows?: number;
|
|
7
7
|
cols?: number;
|
package/dist/session.js
CHANGED
|
@@ -84,6 +84,13 @@ export class Session {
|
|
|
84
84
|
this.finish();
|
|
85
85
|
break;
|
|
86
86
|
}
|
|
87
|
+
case "exit":
|
|
88
|
+
// The bridged terminal itself ended (a detach, an `exit`, a tmux that
|
|
89
|
+
// died on start) — end the session rather than waiting for the socket.
|
|
90
|
+
// Distinct from a transport drop on purpose: a caller that treats it as
|
|
91
|
+
// one reconnects forever, respawning a shell nobody can escape.
|
|
92
|
+
this.finish();
|
|
93
|
+
break;
|
|
87
94
|
}
|
|
88
95
|
}
|
|
89
96
|
finish() {
|
package/package.json
CHANGED