@fastagent-sh/fastagent 0.16.0 → 0.16.2

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.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/dist/bind.d.ts +34 -0
  3. package/dist/bind.js +74 -0
  4. package/dist/channels/agentcore-state.js +21 -6
  5. package/dist/channels/control.js +3 -0
  6. package/dist/cli/commands/attach.d.ts +11 -1
  7. package/dist/cli/commands/attach.js +30 -2
  8. package/dist/cli/commands/deploy.d.ts +13 -0
  9. package/dist/cli/commands/deploy.js +18 -6
  10. package/dist/cli/commands/dev.d.ts +1 -0
  11. package/dist/cli/commands/dev.js +15 -4
  12. package/dist/cli/commands/info.js +1 -1
  13. package/dist/cli/commands/logs.d.ts +6 -0
  14. package/dist/cli/commands/logs.js +27 -0
  15. package/dist/cli/commands/start.d.ts +1 -0
  16. package/dist/cli/commands/start.js +11 -3
  17. package/dist/cli/commands/tool.js +10 -2
  18. package/dist/cli/program.js +35 -0
  19. package/dist/cli/serve.d.ts +26 -2
  20. package/dist/cli/serve.js +71 -17
  21. package/dist/cli/shared.d.ts +6 -0
  22. package/dist/cli/shared.js +14 -0
  23. package/dist/deploy/agentcore/logs.d.ts +30 -0
  24. package/dist/deploy/agentcore/logs.js +115 -0
  25. package/dist/deploy/agentcore/plan.d.ts +23 -0
  26. package/dist/deploy/agentcore/plan.js +41 -3
  27. package/dist/deploy/container.js +6 -3
  28. package/dist/deploy/preflight.js +18 -0
  29. package/dist/engines/pi/config.d.ts +7 -3
  30. package/dist/engines/pi/config.js +9 -3
  31. package/dist/engines/pi/create.d.ts +31 -18
  32. package/dist/engines/pi/create.js +46 -17
  33. package/dist/engines/pi/harness.d.ts +31 -33
  34. package/dist/engines/pi/harness.js +24 -76
  35. package/dist/engines/pi/open.d.ts +2 -2
  36. package/dist/engines/pi/open.js +2 -1
  37. package/dist/engines/pi/read-image.d.ts +4 -0
  38. package/dist/engines/pi/read-image.js +62 -0
  39. package/dist/engines/pi/search-tools.d.ts +6 -4
  40. package/dist/engines/pi/search-tools.js +3 -1
  41. package/dist/engines/pi/session-builder.js +7 -2
  42. package/dist/engines/pi/session-control.d.ts +12 -3
  43. package/dist/engines/pi/session-control.js +156 -27
  44. package/dist/engines/pi/session-settings.d.ts +51 -0
  45. package/dist/engines/pi/session-settings.js +73 -0
  46. package/dist/engines/pi/sessions.d.ts +21 -7
  47. package/dist/engines/pi/sessions.js +43 -0
  48. package/dist/engines/pi/tool.d.ts +13 -5
  49. package/dist/engines/pi/wake-tool.d.ts +3 -3
  50. package/dist/host/node.d.ts +2 -0
  51. package/dist/host/node.js +2 -1
  52. package/dist/pi.d.ts +1 -1
  53. package/dist/session.d.ts +34 -9
  54. package/package.json +4 -4
@@ -48,9 +48,11 @@ export declare function router(routes: Routes): ChannelHandler;
48
48
  * Serve `handler` on a Node HTTP server. Thin mechanism: bind, report the port, let the caller stop
49
49
  * accepting or force-close active connections — no logging/signals/exit (the CLI owns those).
50
50
  * `listening` resolves with the bound port (useful for port 0) or rejects on a bind error.
51
+ * `host` is the bind address; unset means all interfaces (what containers need).
51
52
  */
52
53
  export declare function serveNode(handler: ChannelHandler, options: {
53
54
  port: number;
55
+ host?: string;
54
56
  }): {
55
57
  listening: Promise<number>;
56
58
  close: () => Promise<void>;
package/dist/host/node.js CHANGED
@@ -35,12 +35,13 @@ export function router(routes) {
35
35
  * Serve `handler` on a Node HTTP server. Thin mechanism: bind, report the port, let the caller stop
36
36
  * accepting or force-close active connections — no logging/signals/exit (the CLI owns those).
37
37
  * `listening` resolves with the bound port (useful for port 0) or rejects on a bind error.
38
+ * `host` is the bind address; unset means all interfaces (what containers need).
38
39
  */
39
40
  export function serveNode(handler, options) {
40
41
  const server = createServer(nodeListener(async (req) => handler(req)));
41
42
  const listening = new Promise((resolve, reject) => {
42
43
  server.once("error", reject); // a bind failure surfaces here, before "listening"
43
- server.listen(options.port, () => {
44
+ server.listen({ port: options.port, host: options.host }, () => {
44
45
  server.off("error", reject);
45
46
  resolve(server.address().port);
46
47
  });
package/dist/pi.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { createPiAgent, createPiAgentFromDefinition, type CreatePiAgentFromDefinitionOptions, type CreatePiAgentOptions, } from "./engines/pi/create.ts";
2
- export { defineTool, loadTools, type DefineToolOptions, type FastagentTool, type ToolCollision, type ToolContext, } from "./engines/pi/tool.ts";
2
+ export { defineTool, loadTools, type DefineToolOptions, type FastagentTool, type MountedTool, type ToolCollision, type ToolContext, } from "./engines/pi/tool.ts";
3
3
  export type { ReadonlySessionManager, ToolActivation } from "./engines/pi/tool-context.ts";
4
4
  export { z } from "zod";
5
5
  export type { AgentTool, ExecutionEnv, Session, SessionTreeEntry, Skill, SkillDiagnostic, } from "@earendil-works/pi-agent-core";
package/dist/session.d.ts CHANGED
@@ -21,12 +21,17 @@ export interface SessionControl {
21
21
  dispatch(session: string, command: SessionCommand): Promise<SessionResult>;
22
22
  }
23
23
  /**
24
- * Static support declaration, two kinds of flag:
25
- * - COMMAND GATES (`steering`, `followUp`, `manualCompaction`, `modelSelection`, `thinkingLevel`):
24
+ * STATIC support declaration — sessionless, so nothing here may depend on a session. Two kinds of flag:
25
+ * - COMMAND GATES (`steering`, `followUp`, `manualCompaction`, `modelSelection`, `thinkingLevel`,
26
+ * `navigate`):
26
27
  * clients MUST gate dispatch on them; an unsupported command is rejected before acceptance with
27
28
  * {@link UNSUPPORTED_CAPABILITY_CODE}.
28
29
  * - OBSERVATION-QUALITY flags (`toolProgress`, `usage`): whether those events/state fields appear
29
30
  * at all — nothing to dispatch, nothing to reject.
31
+ *
32
+ * `modelSelection` may carry a list because the registry is a deployment fact; thinking levels
33
+ * depend on the session's current model, so they live on {@link SessionState.availableThinkingLevels}.
34
+ *
30
35
  * `state`/`entries`/`events` are mandatory (the reconnect contract) and deliberately absent here.
31
36
  */
32
37
  export interface SessionCapabilities {
@@ -36,9 +41,15 @@ export interface SessionCapabilities {
36
41
  modelSelection: false | {
37
42
  allowedModels: string[];
38
43
  };
39
- thinkingLevel: false | {
40
- allowedLevels: string[];
41
- };
44
+ /** Whether `set_thinking` is servable at all. WHICH levels is per-session — see
45
+ * {@link SessionState.availableThinkingLevels}. */
46
+ thinkingLevel: boolean;
47
+ /** Whether `navigate` is servable at all — `false` both when the engine's sessions are linear and
48
+ * when this deployment has no write path for them; either way the tree the contract publishes
49
+ * (`SessionEntry.parentId` + `SessionEntries.leafEntryId`) is read-only here. Named after its COMMAND, unlike the older gates (`manualCompaction` gates
50
+ * `compact`, `thinkingLevel` gates `set_thinking`): those already force a client to translate,
51
+ * and a gate keyed by the command literal is the only naming a derived map could ever produce. */
52
+ navigate: boolean;
42
53
  toolProgress: boolean;
43
54
  usage: boolean;
44
55
  }
@@ -79,7 +90,7 @@ export declare const NOTHING_TO_COMPACT_CODE = "nothing_to_compact";
79
90
  * command as-is fails again. (A run registered without modulation controls is a capability
80
91
  * problem, not a run problem, and rejects with {@link UNSUPPORTED_CAPABILITY_CODE}.) */
81
92
  export declare const RUN_COMMAND_FAILED_CODE = "run_command_failed";
82
- /** Six commands; deliberately NO `prompt` — starting work is the data plane's definition. */
93
+ /** Seven commands; deliberately NO `prompt` — starting work is the data plane's definition. */
83
94
  export type SessionCommand = {
84
95
  type: "steer";
85
96
  prompt: Prompt;
@@ -97,6 +108,14 @@ export type SessionCommand = {
97
108
  } | {
98
109
  type: "set_thinking";
99
110
  level: string;
111
+ }
112
+ /** Move the session's active leaf to `targetId`, an existing entry — the write verb for the tree
113
+ * `entries()` already publishes (and how sibling branches come to exist: the next turn hangs off
114
+ * the new leaf). Every entry `entries()` publishes is a legal target; a `targetId` that is not
115
+ * one rejects `invalid_command`. A boundary mutation otherwise: same lease as a run. */
116
+ | {
117
+ type: "navigate";
118
+ targetId: string;
100
119
  };
101
120
  /**
102
121
  * Acceptance is not outcome: `ok: true` means admitted or applied, never that the run ultimately
@@ -125,10 +144,13 @@ export interface SessionState {
125
144
  * compaction happens inside a run's activity window and reports as `running`. */
126
145
  status: "idle" | "running" | "compacting";
127
146
  activeRunId?: string;
128
- /** The session's durable overrides (set_model / set_thinking), read from the record so a
129
- * reconnecting client sees them without scanning entries. Absent = the assembly default. */
147
+ /** What this session will RUN with, not what was recorded: overrides resolved against the
148
+ * deployment (a model the registry lost falls back to the configured one; a level the current
149
+ * model cannot do is clamped). Absent where the implementation exposes no model control. */
130
150
  model?: string;
131
151
  thinkingLevel?: string;
152
+ /** What `set_thinking` accepts for THIS session — re-read after a `set_model`. */
153
+ availableThinkingLevels?: string[];
132
154
  pending: {
133
155
  steering: number;
134
156
  followUp: number;
@@ -222,10 +244,13 @@ export type QueueChangedEvent = SessionEvent<"queue_changed", {
222
244
  runId: string;
223
245
  };
224
246
  /** A boundary mutation changed durable session state (L2; no runId — boundary mutations happen
225
- * between runs). */
247
+ * between runs). `leafEntryId` reports a `navigate` — a deliberate move of the branch head, which
248
+ * a second attached client would otherwise have no signal for. It is NOT a general leaf feed:
249
+ * every turn advances the leaf too, and that is read from `entries()`/`state()` after the run. */
226
250
  export type StateChangedEvent = SessionEvent<"state_changed", {
227
251
  model?: string;
228
252
  thinkingLevel?: string;
253
+ leafEntryId?: string;
229
254
  }>;
230
255
  /** Manual compaction bounds (L2): every `compaction_started` is closed by exactly one
231
256
  * `compaction_finished` — `summary` on success, `error` on failure, `aborted: true` on a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastagent-sh/fastagent",
3
- "version": "0.16.0",
3
+ "version": "0.16.2",
4
4
  "description": "Vibe first. Then FastAgent: turn a local agent directory into a live service in your app, on GitHub, Telegram, Slack, or behind any channel.",
5
5
  "keywords": [
6
6
  "agent",
@@ -101,9 +101,9 @@
101
101
  },
102
102
  "dependencies": {
103
103
  "@clack/prompts": "^1.6.0",
104
- "@earendil-works/pi-agent-core": "^0.81.1",
105
- "@earendil-works/pi-ai": "^0.81.1",
106
- "@earendil-works/pi-coding-agent": "^0.81.1",
104
+ "@earendil-works/pi-agent-core": "^0.83.0",
105
+ "@earendil-works/pi-ai": "^0.83.0",
106
+ "@earendil-works/pi-coding-agent": "^0.83.0",
107
107
  "@larksuiteoapi/node-sdk": "^1.71.1",
108
108
  "@octokit/webhooks-methods": "^6.0.0",
109
109
  "@octokit/webhooks-types": "^7.6.1",