iterate 0.2.6 → 0.3.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 (218) hide show
  1. package/README.md +86 -76
  2. package/THIRD_PARTY_NOTICES.md +55 -0
  3. package/bin/iterate.js +18 -3
  4. package/dist/api-url-B6404M82.mjs +17 -0
  5. package/dist/api-url-B6404M82.mjs.map +1 -0
  6. package/dist/app-ref-BipL0feU.mjs +35 -0
  7. package/dist/app-ref-BipL0feU.mjs.map +1 -0
  8. package/dist/app-ref-C1CrgXqX.mjs +7 -0
  9. package/dist/app-ref-C1CrgXqX.mjs.map +1 -0
  10. package/dist/app-ref-DYai_om1.mjs +7 -0
  11. package/dist/app-ref-DYai_om1.mjs.map +1 -0
  12. package/dist/cli-D0c-pDL_.mjs +1010 -0
  13. package/dist/cli-D0c-pDL_.mjs.map +1 -0
  14. package/dist/client.d.ts +3 -0
  15. package/dist/client.mjs +4 -0
  16. package/dist/cloudflare-BTm90gQ4.mjs +951 -0
  17. package/dist/cloudflare-BTm90gQ4.mjs.map +1 -0
  18. package/dist/contract-s4FW4eES.mjs +309 -0
  19. package/dist/contract-s4FW4eES.mjs.map +1 -0
  20. package/dist/document-review/index.d.ts +5 -0
  21. package/dist/document-review/types.d.ts +107 -0
  22. package/dist/document-review.mjs +7015 -0
  23. package/dist/document-review.mjs.map +1 -0
  24. package/dist/durable-object-processor-durability-CNsTjAJS.mjs +205 -0
  25. package/dist/durable-object-processor-durability-CNsTjAJS.mjs.map +1 -0
  26. package/dist/idempotency-DleloJNt.mjs +28 -0
  27. package/dist/idempotency-DleloJNt.mjs.map +1 -0
  28. package/dist/index.mjs +1 -1
  29. package/dist/itx/api-url.d.ts +6 -0
  30. package/dist/itx/itx-node-client.d.ts +65 -0
  31. package/dist/itx/itx-session.d.ts +215 -0
  32. package/dist/itx/owned-rpc-session.d.ts +14 -0
  33. package/dist/itx/query-client.d.ts +10 -0
  34. package/dist/itx-api.generated.d.ts +6195 -0
  35. package/dist/itx-session-sjud8GiT.mjs +534 -0
  36. package/dist/itx-session-sjud8GiT.mjs.map +1 -0
  37. package/dist/live-state-BJNqOwFw.mjs +299 -0
  38. package/dist/live-state-BJNqOwFw.mjs.map +1 -0
  39. package/dist/next/api.d.ts +479 -0
  40. package/dist/next/api.mjs +0 -0
  41. package/dist/next/app-server.d.ts +44 -0
  42. package/dist/next/app-server.mjs +479 -0
  43. package/dist/next/app-server.mjs.map +1 -0
  44. package/dist/next/app-session.d.ts +49 -0
  45. package/dist/next/app-session.mjs +238 -0
  46. package/dist/next/app-session.mjs.map +1 -0
  47. package/dist/next/app.d.ts +29 -0
  48. package/dist/next/app.mjs +141 -0
  49. package/dist/next/app.mjs.map +1 -0
  50. package/dist/next/client/live-state.d.ts +63 -0
  51. package/dist/next/client/oauth.d.ts +12 -0
  52. package/dist/next/client/react.d.ts +109 -0
  53. package/dist/next/client/socket.d.ts +6 -0
  54. package/dist/next/client.mjs +156 -0
  55. package/dist/next/client.mjs.map +1 -0
  56. package/dist/next/expression.d.ts +146 -0
  57. package/dist/next/expression.mjs +399 -0
  58. package/dist/next/expression.mjs.map +1 -0
  59. package/dist/next/lib.d.ts +56 -0
  60. package/dist/next/lib.mjs +199 -0
  61. package/dist/next/lib.mjs.map +1 -0
  62. package/dist/next/oauth-scopes.d.ts +32 -0
  63. package/dist/next/oauth-scopes.mjs +40 -0
  64. package/dist/next/oauth-scopes.mjs.map +1 -0
  65. package/dist/next/oauth.mjs +29 -0
  66. package/dist/next/oauth.mjs.map +1 -0
  67. package/dist/next/principal.d.ts +64 -0
  68. package/dist/next/principal.mjs +98 -0
  69. package/dist/next/principal.mjs.map +1 -0
  70. package/dist/next/project-ingress.d.ts +37 -0
  71. package/dist/next/project-ingress.mjs +75 -0
  72. package/dist/next/project-ingress.mjs.map +1 -0
  73. package/dist/next/react.mjs +285 -0
  74. package/dist/next/react.mjs.map +1 -0
  75. package/dist/next/sdk/auth.d.ts +5 -0
  76. package/dist/next/sdk/index.d.ts +112 -0
  77. package/dist/next/sdk.mjs +139 -0
  78. package/dist/next/sdk.mjs.map +1 -0
  79. package/dist/next/stream/processor.d.ts +378 -0
  80. package/dist/next/stream/processor.mjs +582 -0
  81. package/dist/next/stream/processor.mjs.map +1 -0
  82. package/dist/next/stream/run.d.ts +58 -0
  83. package/dist/next/stream/run.mjs +40 -0
  84. package/dist/next/stream/run.mjs.map +1 -0
  85. package/dist/next-node.d.ts +15 -0
  86. package/dist/next-node.mjs +51 -0
  87. package/dist/next-node.mjs.map +1 -0
  88. package/dist/node.d.ts +3 -0
  89. package/dist/node.mjs +185 -0
  90. package/dist/node.mjs.map +1 -0
  91. package/dist/processor-host-capabilities-BMFH3KTM.mjs +56 -0
  92. package/dist/processor-host-capabilities-BMFH3KTM.mjs.map +1 -0
  93. package/dist/processors/cloudflare.d.ts +3 -0
  94. package/dist/processors/durable-object-processor-durability.d.ts +79 -0
  95. package/dist/processors/event-consumption-metrics.d.ts +82 -0
  96. package/dist/processors/idempotency.d.ts +13 -0
  97. package/dist/processors/index.d.ts +12 -0
  98. package/dist/processors/processor-contracts.d.ts +342 -0
  99. package/dist/processors/processor-facet.d.ts +186 -0
  100. package/dist/processors/processor-host-capabilities.d.ts +60 -0
  101. package/dist/processors/prompt-sections.d.ts +17 -0
  102. package/dist/processors/rpc-types.d.ts +515 -0
  103. package/dist/processors/schemas.d.ts +102 -0
  104. package/dist/processors/stream-handle.d.ts +45 -0
  105. package/dist/processors/stream-processor-keepalive.d.ts +95 -0
  106. package/dist/processors/stream-processor-registry.d.ts +233 -0
  107. package/dist/processors/stream-processor-runner.d.ts +289 -0
  108. package/dist/processors/stream-processor.d.ts +339 -0
  109. package/dist/processors/stream-runtime-metrics.d.ts +107 -0
  110. package/dist/processors/testing.d.ts +302 -0
  111. package/dist/processors-BoNyeBfQ.mjs +10 -0
  112. package/dist/processors-BoNyeBfQ.mjs.map +1 -0
  113. package/dist/processors-cloudflare.mjs +3 -0
  114. package/dist/processors-testing.mjs +435 -0
  115. package/dist/processors-testing.mjs.map +1 -0
  116. package/dist/processors.mjs +52 -0
  117. package/dist/processors.mjs.map +1 -0
  118. package/dist/protocol-DnK_f2m6.mjs +251 -0
  119. package/dist/protocol-DnK_f2m6.mjs.map +1 -0
  120. package/dist/sdk/capnweb/index.d.ts +2 -0
  121. package/dist/sdk/capnweb/live-state/compact.d.ts +5 -0
  122. package/dist/sdk/capnweb/live-state/diff.d.ts +41 -0
  123. package/dist/sdk/capnweb/live-state/engine.d.ts +44 -0
  124. package/dist/sdk/capnweb/live-state/index.d.ts +41 -0
  125. package/dist/sdk/capnweb/live-state/protocol.d.ts +87 -0
  126. package/dist/sdk/capnweb/live-state/retain.d.ts +23 -0
  127. package/dist/sdk/capnweb/live-state/store.d.ts +20 -0
  128. package/dist/sdk/capnweb/live-state/types.d.ts +11 -0
  129. package/dist/sdk/capnweb/react.d.ts +45 -0
  130. package/dist/sdk/capnweb/react.mjs +316 -0
  131. package/dist/sdk/capnweb/react.mjs.map +1 -0
  132. package/dist/sdk/capnweb.mjs +4 -0
  133. package/dist/sdk/itx/react.d.ts +191 -0
  134. package/dist/sdk/itx/react.mjs +383 -0
  135. package/dist/sdk/itx/react.mjs.map +1 -0
  136. package/dist/sdk-DMB-IM11.mjs +933 -0
  137. package/dist/sdk-DMB-IM11.mjs.map +1 -0
  138. package/dist/sdk.d.ts +339 -0
  139. package/dist/sdk.mjs +2 -0
  140. package/dist/serve-itx.d.ts +46 -0
  141. package/dist/starter-apps/flake-dashboard/app-ref.d.ts +31 -0
  142. package/dist/starter-apps/flake-dashboard/configured-worker.mjs +1055 -0
  143. package/dist/starter-apps/flake-dashboard/configured-worker.mjs.map +1 -0
  144. package/dist/starter-apps/flake-dashboard/contract.d.ts +4839 -0
  145. package/dist/starter-apps/flake-dashboard/contract.mjs +2 -0
  146. package/dist/starter-apps/flake-dashboard/index.d.ts +17 -0
  147. package/dist/starter-apps/flake-dashboard/index.mjs +56 -0
  148. package/dist/starter-apps/flake-dashboard/index.mjs.map +1 -0
  149. package/dist/starter-apps/flake-dashboard/worker.d.ts +4607 -0
  150. package/dist/starter-apps/github-ai-linter/ai-linter.d.ts +8914 -0
  151. package/dist/starter-apps/github-ai-linter/configured-worker.mjs +17987 -0
  152. package/dist/starter-apps/github-ai-linter/configured-worker.mjs.map +1 -0
  153. package/dist/starter-apps/github-ai-linter/contract.d.ts +9193 -0
  154. package/dist/starter-apps/github-ai-linter/index.d.ts +10 -0
  155. package/dist/starter-apps/github-ai-linter/index.mjs +36 -0
  156. package/dist/starter-apps/github-ai-linter/index.mjs.map +1 -0
  157. package/dist/starter-apps/github-ai-linter/prompt.d.ts +13 -0
  158. package/dist/starter-apps/github-ai-linter/review-bot.d.ts +808 -0
  159. package/dist/starter-apps/github-ai-linter/rules.d.ts +34 -0
  160. package/dist/starter-apps/github-ai-linter/worker-ref.d.ts +19 -0
  161. package/dist/starter-apps/github-ai-linter/worker.d.ts +19 -0
  162. package/dist/starter-apps/github-ai-linter/worker.mjs +947 -0
  163. package/dist/starter-apps/github-ai-linter/worker.mjs.map +1 -0
  164. package/dist/starter-apps/guestbook/app-ref.d.ts +27 -0
  165. package/dist/starter-apps/guestbook/client.d.ts +7 -0
  166. package/dist/starter-apps/guestbook/client.mjs +59 -0
  167. package/dist/starter-apps/guestbook/configured-worker.mjs +205 -0
  168. package/dist/starter-apps/guestbook/configured-worker.mjs.map +1 -0
  169. package/dist/starter-apps/guestbook/index.d.ts +9 -0
  170. package/dist/starter-apps/guestbook/index.mjs +31 -0
  171. package/dist/starter-apps/guestbook/index.mjs.map +1 -0
  172. package/dist/starter-apps/guestbook/processor.d.ts +2267 -0
  173. package/dist/starter-apps/guestbook/worker.d.ts +26 -0
  174. package/dist/starter-apps/guestbook/worker.mjs +191 -0
  175. package/dist/starter-apps/guestbook/worker.mjs.map +1 -0
  176. package/dist/starter-apps/media/configured-worker.mjs +577 -0
  177. package/dist/starter-apps/media/configured-worker.mjs.map +1 -0
  178. package/dist/starter-apps/media/index.mjs +36 -0
  179. package/dist/starter-apps/media/index.mjs.map +1 -0
  180. package/dist/starter-apps/media/ref.mjs +20 -0
  181. package/dist/starter-apps/media/ref.mjs.map +1 -0
  182. package/dist/starter-apps/media/worker.mjs +579 -0
  183. package/dist/starter-apps/media/worker.mjs.map +1 -0
  184. package/dist/starter-apps/notes/configured-worker.mjs +6134 -0
  185. package/dist/starter-apps/notes/configured-worker.mjs.map +1 -0
  186. package/dist/starter-apps/notes/index.mjs +23 -0
  187. package/dist/starter-apps/notes/index.mjs.map +1 -0
  188. package/dist/starter-apps/notes/ref.mjs +21 -0
  189. package/dist/starter-apps/notes/ref.mjs.map +1 -0
  190. package/dist/starter-apps/notes/worker.mjs +427 -0
  191. package/dist/starter-apps/notes/worker.mjs.map +1 -0
  192. package/dist/starter-apps/todo/client.mjs +59 -0
  193. package/dist/starter-apps/todo/configured-worker.mjs +2864 -0
  194. package/dist/starter-apps/todo/configured-worker.mjs.map +1 -0
  195. package/dist/starter-apps/todo/index.d.ts +8 -0
  196. package/dist/starter-apps/todo/index.mjs +29 -0
  197. package/dist/starter-apps/todo/index.mjs.map +1 -0
  198. package/dist/stream-processor-keepalive-DAQTP6m3.mjs +2082 -0
  199. package/dist/stream-processor-keepalive-DAQTP6m3.mjs.map +1 -0
  200. package/dist/usingCtx-inzbY1Qz.mjs +57 -0
  201. package/dist/usingCtx-mZx5nsAW.mjs +11800 -0
  202. package/dist/usingCtx-mZx5nsAW.mjs.map +1 -0
  203. package/dist/worker-ref-DZxPDmb_.mjs +390 -0
  204. package/dist/worker-ref-DZxPDmb_.mjs.map +1 -0
  205. package/menubar/Iterate.entitlements +12 -0
  206. package/menubar/Iterate.swift +914 -0
  207. package/menubar/IterateIcon.swift +145 -0
  208. package/menubar/README.md +28 -0
  209. package/menubar/build-menubar-app.sh +59 -0
  210. package/package.json +235 -18
  211. package/dist/cli-DMS4kJph.mjs +0 -868
  212. package/dist/cli-DMS4kJph.mjs.map +0 -1
  213. package/dist/config-DtnR7Lv7.mjs +0 -170
  214. package/dist/config-DtnR7Lv7.mjs.map +0 -1
  215. package/dist/index.d.mts.map +0 -1
  216. package/dist/stream-tui/agent-chat-terminal.d.mts +0 -1
  217. package/dist/stream-tui/agent-chat-terminal.mjs +0 -933
  218. package/dist/stream-tui/agent-chat-terminal.mjs.map +0 -1
package/README.md CHANGED
@@ -1,97 +1,107 @@
1
1
  # iterate
2
2
 
3
- CLI for Iterate.
3
+ CLI for OS Next (`apps/os-next`). Requires Node >=22.15; no Bun runtime.
4
4
 
5
- `npx iterate` opens the Iterate chat terminal UI. It is equivalent to
6
- `npx iterate chat`.
7
-
8
- The package also runs as a thin bootstrapper: inside this repo it delegates to
9
- the local `packages/iterate` source, and from npm it runs the published build.
5
+ ```sh
6
+ npx iterate # offline help
7
+ npx iterate login # browser OAuth with project consent
8
+ npx iterate projects list
9
+ npx iterate orgs list
10
+ npx iterate ping
11
+ npx iterate repl --project my-project # local Node REPL
12
+ npx iterate itx run --project my-project --eval 'return await itx.whoami();'
13
+ npx iterate use-my-computer --project my-project --name myComputer
14
+ npx iterate menubar --project my-project # macOS app
15
+ npx iterate logout
16
+ ```
10
17
 
11
- ## Requirements
18
+ The default server is `https://os.iterate2.com`. Login uses that server's OAuth
19
+ issuer, PKCE and a loopback callback. Tokens refresh automatically before a
20
+ command when close to expiry. `ITERATE_BEARER_TOKEN` supplies a token for scripts;
21
+ `APP_CONFIG_ADMIN_API_SECRET` supplies operator credentials and takes precedence.
22
+ `ITERATE_SKIP_BROWSER_OPEN=1` prints the login URL without opening a browser.
23
+
24
+ ## Running scripts
25
+
26
+ `itx run` executes a JavaScript function body on OS Next with `itx` in scope.
27
+ Use `return` for the result. The server records the run and its settlement;
28
+ the CLI never retries a script automatically. Scripts execute on the server,
29
+ so local Node APIs and local filesystem access are unavailable.
30
+
31
+ ```sh
32
+ iterate itx run --project my-project --context /notes --eval '
33
+ await itx.append({ type: "note", payload: { text: "hello" } });
34
+ return await itx.readEvents(0, 10);
35
+ '
36
+ iterate itx run --project my-project --file ./script.js
37
+ cat script.js | iterate itx run --project my-project --file -
38
+ ```
12
39
 
13
- - Node `>=22`
14
- - Bun, for the current OpenTUI-based chat terminal runtime
40
+ Specify exactly one of `--eval` or `--file`. `--context` is a project-local path
41
+ (default `/`). `--project` accepts an id or slug; otherwise the CLI uses the
42
+ config's `defaultProject`, or the only project accessible to the session.
15
43
 
16
- ## Quick start
44
+ ## Use my computer
17
45
 
18
- Run without installing globally:
46
+ `use-my-computer` shares a Mac as a live OS Next capability until Ctrl-C:
19
47
 
20
- ```bash
21
- npx iterate
22
- ```
48
+ - `itx.myComputer.ask({ question, buttons? })`: native choice dialog.
49
+ - `itx.myComputer.notify({ message, title? })`: desktop notification.
50
+ - `itx.myComputer.runSwift({ code })`: Swift with the owner's local permissions.
51
+ - `itx.myComputer.__describe()`: usage instructions and method signatures.
23
52
 
24
- If you are not logged in yet, `iterate chat` starts the browser OAuth flow. The
25
- auth flow asks for project access and can create your first organization and
26
- project before returning to the CLI.
53
+ The command requires macOS, AppleScript and Swift. Share only with a project
54
+ you trust: its callers can run local code. The capability belongs to the live
55
+ connection and is released on exit. A disconnect or token expiry ends sharing
56
+ with an error; rerun the command to refresh authentication and reconnect.
27
57
 
28
- ```bash
29
- npx iterate chat
30
- ```
58
+ ## Configs and migration
31
59
 
32
- For help and other commands:
60
+ Configs live in `${XDG_CONFIG_HOME:-~/.config}/iterate/config.json`. Selection
61
+ order is `--config`, a parent-directory workspace mapping, the default config,
62
+ a single saved config, then built-in `prd`.
33
63
 
34
- ```bash
35
- npx iterate --help
36
- npx iterate login
37
- npx iterate orgs list
38
- npx iterate config list
64
+ ```sh
65
+ iterate config set --name next --os-base-url https://os.iterate2.com \
66
+ --default-project my-project --set-default
67
+ iterate --config next login
68
+ iterate config set --name local --os-base-url http://localhost:8787 --set-workspace
69
+ iterate config list
70
+ iterate config get
39
71
  ```
40
72
 
41
- ## Commands
42
-
43
- - `iterate` - open chat
44
- - `iterate chat` - open the Iterate agent chat terminal UI
45
- - `iterate login` - authenticate with browser-based OAuth
46
- - `iterate logout` - remove the stored session for the current config
47
- - `iterate orgs list`
48
- - `iterate config ...`
49
- - `iterate os ...`
50
-
51
- ## Config file
52
-
53
- Config path:
54
-
55
- `${XDG_CONFIG_HOME:-~/.config}/iterate/config.json`
56
-
57
- Config shape:
58
-
59
- ```json
60
- {
61
- "configs": {
62
- "default": {
63
- "osBaseUrl": "https://os.iterate.com",
64
- "authBaseUrl": "https://auth.iterate.com",
65
- "defaultProject": "my-project"
66
- },
67
- "dev": {
68
- "osBaseUrl": "http://localhost:54896",
69
- "authBaseUrl": "http://localhost:7101"
70
- }
71
- },
72
- "default": "default",
73
- "workspaces": {
74
- "/absolute/workspace/path": "dev"
75
- }
76
- }
77
- ```
73
+ Existing configs keep their server URL. For a config that targets the old OS,
74
+ set its `--os-base-url` to an OS Next deployment and log in again. Changing the
75
+ server clears that config's session. There is no separate `authBaseUrl` setting.
78
76
 
79
- Config resolution priority: `--config` flag > workspace match (walk up from cwd) > `default` key > single-config auto-select.
77
+ The old chat TUI and remotely discovered `iterate os ...` commands are removed.
78
+ The menu bar supports sign-in and computer sharing. Approval code is retained
79
+ but dormant until OS Next supports it. Use `iterate itx run` for scripts;
80
+ its `--project` selects the project and `--context` selects a path within it.
80
81
 
81
- ## Local iterate dev
82
+ ## Node REPL
82
83
 
83
- If you run inside an `iterate/iterate` clone, the CLI auto-detects it and
84
- delegates to the local source instead of the published build.
84
+ `iterate repl` opens a local Node REPL with the authenticated session as `itx`
85
+ (try `await itx.projects.list()`) and the transport's `RpcTarget` constructor.
86
+ Pass `--project my-project --context /` to bind `itx` to a project context;
87
+ a configured `defaultProject` also selects a project. Top-level `await`, Node APIs and `.load` are available. The bindings remain available after `.clear`; `.exit` releases the context and connection. A lost connection
88
+ ends the REPL visibly; it never silently repeats your commands.
85
89
 
86
- ## Publishing (maintainers)
90
+ ## Node connections
87
91
 
88
- From repo root:
92
+ `iterate/next/node` exposes a connection owner for OS Next scripts and live
93
+ providers. It uses the same protocol and cleanup as the CLI:
89
94
 
90
- ```bash
91
- pnpm --filter ./packages/iterate build
92
- pnpm --filter ./packages/iterate typecheck
93
- pnpm --filter ./packages/iterate test
94
- pnpm exec oxlint packages/iterate/src/cli.ts packages/iterate/src/cli.test.ts
95
- pnpm exec oxfmt --check packages/iterate
96
- pnpm --filter ./packages/iterate publish --access public
95
+ ```js
96
+ import { connectOsNext } from "iterate/next/node";
97
+
98
+ using connection = await connectOsNext({
99
+ baseUrl: "https://os.iterate2.com",
100
+ auth: { type: "bearer", token: process.env.ITERATE_BEARER_TOKEN },
101
+ });
102
+ using project = await connection.session.projects.get("my-project");
103
+ console.log(await project.run("async (itx) => await itx.whoami()"));
97
104
  ```
105
+
106
+ The package launcher delegates to repository source during development and
107
+ uses the published build when installed through `npx`.
@@ -0,0 +1,55 @@
1
+ # Third-party notices
2
+
3
+ `dist/document-review.mjs` bundles the following third-party software.
4
+
5
+ ## Roughdraft 0.1.10
6
+
7
+ - Source: https://github.com/Lex-Inc/roughdraft
8
+ - Author: Nathan Baschez
9
+ - License: MIT, as declared by Roughdraft's published package manifest and source README.
10
+
11
+ The Roughdraft source tree and published package manifest do not include a copyright notice. The MIT license text is reproduced below without adding one.
12
+
13
+ ```text
14
+ MIT License
15
+
16
+ Permission is hereby granted, free of charge, to any person obtaining a copy
17
+ of this software and associated documentation files (the "Software"), to deal
18
+ in the Software without restriction, including without limitation the rights
19
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
+ copies of the Software, and to permit persons to whom the Software is
21
+ furnished to do so, subject to the following conditions:
22
+
23
+ The above copyright notice and this permission notice shall be included in all
24
+ copies or substantial portions of the Software.
25
+
26
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32
+ SOFTWARE.
33
+ ```
34
+
35
+ ## yaml 2.9.0
36
+
37
+ - Source: https://github.com/eemeli/yaml/tree/v2.9.0
38
+ - Author: Eemeli Aro <eemeli@gmail.com>
39
+ - License: ISC
40
+
41
+ ```text
42
+ Copyright Eemeli Aro <eemeli@gmail.com>
43
+
44
+ Permission to use, copy, modify, and/or distribute this software for any purpose
45
+ with or without fee is hereby granted, provided that the above copyright notice
46
+ and this permission notice appear in all copies.
47
+
48
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
49
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
50
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
51
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
52
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
53
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
54
+ THIS SOFTWARE.
55
+ ```
package/bin/iterate.js CHANGED
@@ -28,6 +28,18 @@ const __filename = fileURLToPath(import.meta.url);
28
28
  const __dirname = dirname(__filename);
29
29
  const pkgRoot = dirname(__dirname);
30
30
 
31
+ // `npx iterate` and `bunx iterate` should exercise the package that the runner
32
+ // just installed. Normal installed/global executions still delegate to local
33
+ // repo source below, which keeps monorepo development fast.
34
+ const isEphemeralPackageRunner = () =>
35
+ process.env.npm_command === "exec" &&
36
+ (process.env.npm_lifecycle_event === "npx" || process.env.npm_lifecycle_event === "bunx");
37
+
38
+ // The black-box PTY lane builds the package, then exercises this same public
39
+ // bin while the monorepo source tree is still present. Force the published
40
+ // artifact path so that test cannot accidentally fall back to TypeScript.
41
+ const forceBuiltPackage = process.env.ITERATE_FORCE_BUILT_PACKAGE === "1";
42
+
31
43
  /**
32
44
  * Find a local version of the iterate CLI that differs from the currently
33
45
  * running script. Returns an importable module path, or null.
@@ -53,7 +65,10 @@ const findLocalModule = () => {
53
65
  // 2. Check for a local node_modules install
54
66
  const nmRoot = findUp("node_modules/.bin/iterate");
55
67
  if (nmRoot) {
56
- const nmScript = join(nmRoot, "node_modules/.bin/iterate");
68
+ // pnpm's .bin entry is a shell shim, so compare the package's actual bin.
69
+ // Comparing the shim itself mistakes our own package for another install
70
+ // and sends repository development to a stale dist build.
71
+ const nmScript = join(nmRoot, "node_modules/iterate/bin/iterate.js");
57
72
  if (existsSync(nmScript) && realpathSync(nmScript) !== selfReal) {
58
73
  // Published package — use dist
59
74
  const nmDist = join(nmRoot, "node_modules/iterate/dist/index.mjs");
@@ -64,7 +79,7 @@ const findLocalModule = () => {
64
79
  return null;
65
80
  };
66
81
 
67
- const localModule = findLocalModule();
82
+ const localModule = isEphemeralPackageRunner() || forceBuiltPackage ? null : findLocalModule();
68
83
  if (localModule) {
69
84
  const { runCli } = await import(localModule);
70
85
  await runCli();
@@ -73,7 +88,7 @@ if (localModule) {
73
88
  // In monorepo dev: src/index.ts exists. Published: dist/index.mjs exists.
74
89
  const srcPath = join(pkgRoot, "src/index.ts");
75
90
  const distPath = join(pkgRoot, "dist/index.mjs");
76
- const modulePath = existsSync(srcPath) ? srcPath : distPath;
91
+ const modulePath = !forceBuiltPackage && existsSync(srcPath) ? srcPath : distPath;
77
92
  const { runCli } = await import(modulePath);
78
93
  await runCli();
79
94
  }
@@ -0,0 +1,17 @@
1
+ //#region src/itx/api-url.ts
2
+ /**
3
+ * An OS deployment's `/api` WebSocket URL from its http(s) base — the ONE
4
+ * place that knows the path and the ws/wss protocol swap, shared by the
5
+ * shared session and the one-shot Node client.
6
+ */
7
+ function apiWebSocketUrl(baseUrl) {
8
+ const base = baseUrl.trim().replace(/\/+$/, "");
9
+ if (!base) throw new Error("an OS deployment base URL is required (the config's APP_CONFIG_BASE_URL)");
10
+ const url = new URL("/api", base);
11
+ url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
12
+ return url;
13
+ }
14
+ //#endregion
15
+ export { apiWebSocketUrl as t };
16
+
17
+ //# sourceMappingURL=api-url-B6404M82.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-url-B6404M82.mjs","names":[],"sources":["../src/itx/api-url.ts"],"sourcesContent":["/**\n * An OS deployment's `/api` WebSocket URL from its http(s) base — the ONE\n * place that knows the path and the ws/wss protocol swap, shared by the\n * shared session and the one-shot Node client.\n */\nexport function apiWebSocketUrl(baseUrl: string): URL {\n const base = baseUrl.trim().replace(/\\/+$/, \"\");\n if (!base) {\n throw new Error(\"an OS deployment base URL is required (the config's APP_CONFIG_BASE_URL)\");\n }\n const url = new URL(\"/api\", base);\n url.protocol = url.protocol === \"https:\" ? \"wss:\" : \"ws:\";\n return url;\n}\n"],"mappings":";;;;;;AAKA,SAAgB,gBAAgB,SAAsB;CACpD,MAAM,OAAO,QAAQ,KAAK,CAAC,CAAC,QAAQ,QAAQ,EAAE;CAC9C,IAAI,CAAC,MACH,MAAM,IAAI,MAAM,0EAA0E;CAE5F,MAAM,MAAM,IAAI,IAAI,QAAQ,IAAI;CAChC,IAAI,WAAW,IAAI,aAAa,WAAW,SAAS;CACpD,OAAO;AACT"}
@@ -0,0 +1,35 @@
1
+ //#region src/starter-apps/guestbook/app-ref.ts
2
+ const guestbookStreamPath = "/guestbook";
3
+ const guestbookWorkerRef = {
4
+ className: "GuestbookApp",
5
+ durableWorkerKey: "app-guestbook-stream",
6
+ path: "/",
7
+ source: { createWorker: {
8
+ entryPoint: "node_modules/iterate/dist/starter-apps/guestbook/configured-worker.mjs",
9
+ files: {
10
+ include: ["package.json"],
11
+ repoPath: "/repos/config",
12
+ type: "repo"
13
+ }
14
+ } },
15
+ type: "stateful"
16
+ };
17
+ /**
18
+ * The Guestbook's creation facts. The project worker owns committed event
19
+ * delivery through GuestbookApp.processEvent; no stream ever carries an
20
+ * app-specific subscription for the Guestbook (streams that predate the
21
+ * current subscription model are recreated, not migrated), so there is no
22
+ * retirement fact to append — removing a key that was never configured is a
23
+ * hard error.
24
+ */
25
+ function guestbookCreationEvents() {
26
+ return [{
27
+ type: "events.iterate.com/guestbook/created",
28
+ payload: { config: { title: "Guestbook" } },
29
+ idempotencyKey: "guestbook/created"
30
+ }];
31
+ }
32
+ //#endregion
33
+ export { guestbookStreamPath as n, guestbookWorkerRef as r, guestbookCreationEvents as t };
34
+
35
+ //# sourceMappingURL=app-ref-BipL0feU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-ref-BipL0feU.mjs","names":[],"sources":["../src/starter-apps/guestbook/app-ref.ts"],"sourcesContent":["// The Guestbook's physical identity. Keeping the durable key stable preserves\n// its processor storage while the implementation moves out of config repos.\nimport type { StreamEventInput } from \"../../processors/index.ts\";\nimport type { StatefulDynamicWorkerRef } from \"../../sdk.ts\";\n\nexport const guestbookStreamPath = \"/guestbook\";\n\nexport const guestbookWorkerRef = {\n className: \"GuestbookApp\",\n // \"-stream\" keeps clear of a retired predecessor's durable identity.\n durableWorkerKey: \"app-guestbook-stream\",\n path: \"/\",\n source: {\n createWorker: {\n entryPoint: \"node_modules/iterate/dist/starter-apps/guestbook/configured-worker.mjs\",\n files: {\n include: [\"package.json\"],\n repoPath: \"/repos/config\",\n type: \"repo\",\n },\n },\n },\n type: \"stateful\",\n} satisfies StatefulDynamicWorkerRef;\n\n/**\n * The Guestbook's creation facts. The project worker owns committed event\n * delivery through GuestbookApp.processEvent; no stream ever carries an\n * app-specific subscription for the Guestbook (streams that predate the\n * current subscription model are recreated, not migrated), so there is no\n * retirement fact to append — removing a key that was never configured is a\n * hard error.\n */\nexport function guestbookCreationEvents(): StreamEventInput[] {\n return [\n {\n type: \"events.iterate.com/guestbook/created\",\n payload: { config: { title: \"Guestbook\" } },\n idempotencyKey: \"guestbook/created\",\n },\n ];\n}\n"],"mappings":";AAKA,MAAa,sBAAsB;AAEnC,MAAa,qBAAqB;CAChC,WAAW;CAEX,kBAAkB;CAClB,MAAM;CACN,QAAQ,EACN,cAAc;EACZ,YAAY;EACZ,OAAO;GACL,SAAS,CAAC,cAAc;GACxB,UAAU;GACV,MAAM;EACR;CACF,EACF;CACA,MAAM;AACR;;;;;;;;;AAUA,SAAgB,0BAA8C;CAC5D,OAAO,CACL;EACE,MAAM;EACN,SAAS,EAAE,QAAQ,EAAE,OAAO,YAAY,EAAE;EAC1C,gBAAgB;CAClB,CACF;AACF"}
@@ -0,0 +1,7 @@
1
+ import { notesWorkerRef as notesWorkerRef$1 } from "./starter-apps/notes/ref.mjs";
2
+ //#region src/starter-apps/notes/app-ref.ts
3
+ const notesWorkerRef = notesWorkerRef$1;
4
+ //#endregion
5
+ export { notesWorkerRef as t };
6
+
7
+ //# sourceMappingURL=app-ref-C1CrgXqX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-ref-C1CrgXqX.mjs","names":["notesWorkerRefLiteral"],"sources":["../src/starter-apps/notes/app-ref.ts"],"sourcesContent":["// The NotesApp's physical identity: a stable durable key preserves its\n// processor storage across implementation updates. The literal lives in\n// ref.ts (dependency-free for the mobile app); this module holds the\n// satisfies check against the real ref type.\nimport type { StatefulDynamicWorkerRef } from \"../../sdk.ts\";\nimport { notesWorkerRef as notesWorkerRefLiteral } from \"./ref.ts\";\n\nexport { notesRepoPath, notesWorkspacePath } from \"./ref.ts\";\n\nexport const notesWorkerRef = notesWorkerRefLiteral satisfies StatefulDynamicWorkerRef;\n"],"mappings":";;AASA,MAAa,iBAAiBA"}
@@ -0,0 +1,7 @@
1
+ import { mediaWorkerRef as mediaWorkerRef$1 } from "./starter-apps/media/ref.mjs";
2
+ //#region src/starter-apps/media/app-ref.ts
3
+ const mediaWorkerRef = mediaWorkerRef$1;
4
+ //#endregion
5
+ export { mediaWorkerRef as t };
6
+
7
+ //# sourceMappingURL=app-ref-DYai_om1.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-ref-DYai_om1.mjs","names":["mediaWorkerRefLiteral"],"sources":["../src/starter-apps/media/app-ref.ts"],"sourcesContent":["// The MediaApp's physical identity: a stable durable key preserves its\n// processor storage across implementation updates. The literal lives in\n// ref.ts (dependency-free for the mobile e2e); this module holds the\n// satisfies check against the real ref type.\nimport type { StatefulDynamicWorkerRef } from \"../../sdk.ts\";\nimport { mediaWorkerRef as mediaWorkerRefLiteral } from \"./ref.ts\";\n\nexport { mediaStreamPath } from \"./ref.ts\";\n\nexport const mediaWorkerRef = mediaWorkerRefLiteral satisfies StatefulDynamicWorkerRef;\n"],"mappings":";;AASA,MAAa,iBAAiBA"}