@factory/droid-sdk 0.9.1 → 0.11.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.
Files changed (41) hide show
  1. package/README.md +53 -0
  2. package/dist/api.d.mts +15058 -0
  3. package/dist/api.d.ts +15058 -0
  4. package/dist/api.js +253 -0
  5. package/dist/api.js.map +1 -0
  6. package/dist/api.mjs +253 -0
  7. package/dist/api.mjs.map +1 -0
  8. package/dist/chunk-7ZD7MMNA.mjs +2268 -0
  9. package/dist/chunk-7ZD7MMNA.mjs.map +1 -0
  10. package/dist/{chunk-YSKO6SPT.js → chunk-KAAWCHO4.js} +32033 -17088
  11. package/dist/chunk-KAAWCHO4.js.map +1 -0
  12. package/dist/chunk-NWFX4MPJ.mjs +41630 -0
  13. package/dist/chunk-NWFX4MPJ.mjs.map +1 -0
  14. package/dist/chunk-ZQ7TS73S.js +2268 -0
  15. package/dist/chunk-ZQ7TS73S.js.map +1 -0
  16. package/dist/{index-C06W9tbN.d.mts → index-Cf2WtJqJ.d.mts} +134169 -84330
  17. package/dist/{index-C06W9tbN.d.ts → index-Cf2WtJqJ.d.ts} +134169 -84330
  18. package/dist/index.d.mts +1 -1
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.js +91 -2
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +99 -10
  23. package/dist/node.d.mts +223 -43
  24. package/dist/node.d.ts +223 -43
  25. package/dist/node.js +2033 -776
  26. package/dist/node.js.map +1 -1
  27. package/dist/node.mjs +1756 -499
  28. package/dist/node.mjs.map +1 -1
  29. package/examples/browser/daemon-lifecycle.ts +4 -6
  30. package/examples/node/custom-model-editing-disposable.sh +88 -0
  31. package/examples/node/custom-model-editing-disposable.ts +171 -0
  32. package/examples/node/custom-model-editing.ts +55 -0
  33. package/examples/node/hook-execution.ts +3 -2
  34. package/examples/node/rest-api.ts +55 -0
  35. package/examples/node/sdk-mcp-tool.ts +5 -3
  36. package/examples/node/start-workstream.ts +76 -0
  37. package/examples/node/tool-controls.ts +7 -5
  38. package/package.json +14 -3
  39. package/dist/chunk-TWSTJMV7.mjs +0 -26685
  40. package/dist/chunk-TWSTJMV7.mjs.map +0 -1
  41. package/dist/chunk-YSKO6SPT.js.map +0 -1
package/README.md CHANGED
@@ -17,6 +17,7 @@ The SDK requires Node.js 18 or later.
17
17
  | ------------------------- | --------------- | ----------------------------------------------------------------------------------------- |
18
18
  | `@factory/droid-sdk/node` | Node | Start Droid subprocesses, run prompts, manage local sessions, and define SDK MCP tools |
19
19
  | `@factory/droid-sdk` | Browser or Node | Connect to an existing Droid daemon and use browser-safe schemas, types, and REST helpers |
20
+ | `@factory/droid-sdk/api` | Browser or Node | Call any Factory REST API operation through a client generated from the public API spec |
20
21
 
21
22
  By default, Node session APIs start the `droid` CLI from `PATH` and read
22
23
  `FACTORY_API_KEY`. A custom executable, API key, or transport can be supplied
@@ -55,6 +56,58 @@ the canonical user-facing guide to:
55
56
  Runnable examples are available under [`examples/node`](./examples/node) and
56
57
  [`examples/browser`](./examples/browser).
57
58
 
59
+ ### Custom transport migration
60
+
61
+ - **Breaking agent-client change:** `DroidClientOptions.transport` and custom
62
+ session transports now require `DroidClientTransport`, which exchanges
63
+ `JsonRpcMessage` objects through `send` and `onMessage`. No format marker or
64
+ runtime detection is needed.
65
+ - Built-in `ProcessTransport` owns its stdio JSON codec. Its direct `send` and
66
+ `onMessage` callers must now pass and receive objects rather than strings.
67
+ In-process implementations exchange snapshots without codecs.
68
+ - For an existing custom `StringFramedDroidClientTransport`, explicitly pass
69
+ `withJsonRpcCodec(stringTransport)` to `DroidClient` or session options.
70
+ The adapter and both interfaces are exported from `@factory/droid-sdk/node`.
71
+ Do not wrap an already typed transport.
72
+ - **Breaking daemon-client change:** replace `DaemonClient.onMessage` with
73
+ `onTransportMessage` and remove `JSON.parse` from callbacks. Custom
74
+ `DaemonClientTransport.send` and `message` listeners now exchange
75
+ `JsonRpcMessage` objects. Put codecs inside transports that cross a serialized
76
+ boundary. External wire formats are unchanged.
77
+
78
+ ### Shared display messages
79
+
80
+ - `filterMessagesForUI` no longer copies messages. A message with nothing to
81
+ hide comes back as the same object, and a stripped message as a projection
82
+ that later calls return again. Treat the results as read-only: mutating one
83
+ changes your input or what later calls return. Replace a message instead of
84
+ editing it.
85
+
86
+ ### Open status values (0.11.0)
87
+
88
+ - `RemoteSession['status']`, `MachineTemplateBuildStatus['status']`, and
89
+ `MachineTemplateBuildStatus['failureReason']` now accept values a newer
90
+ server adds instead of failing the response. An exhaustive `switch` over
91
+ one of them needs a branch for an unknown value.
92
+ - Those fields of `RemoteSessionSchema` and
93
+ `MachineTemplateBuildStatusSchema` are unions now, not enums: `.enum` on
94
+ them is gone, and `.options` lists the union's member schemas rather than
95
+ the known values.
96
+
97
+ ### Machine template list (0.11.0)
98
+
99
+ - `listMachineTemplates` no longer takes `limit` or `cursor`. The API
100
+ returns every template in one response, with `pagination.hasMore` always
101
+ `false` and `pagination.nextCursor` always `null`.
102
+ - `ListMachineTemplatesOptions` drops `limit` and `cursor` but stays an
103
+ interface over `FactoryApiOptions`, so declaration merging into it keeps
104
+ compiling. An options object literal that passes either field fails
105
+ typecheck; a variable typed with extra properties compiles, and the helper
106
+ does not send them.
107
+
108
+ The [canonical SDK guide](https://docs.factory.ai/sdk/typescript) remains the
109
+ full API reference.
110
+
58
111
  ## Browser security
59
112
 
60
113
  The daemon client currently authenticates with a Factory API key. Browser