@unieai/rabi-web-app 0.2.1-rc.3 → 0.2.2-rc.5

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/cordis.patch.yml CHANGED
@@ -23,20 +23,12 @@
23
23
  # restatement keeps the Web values on one ephemeral in-memory index; a
24
24
  # deployment enabling content search overrides `openAt` to `first-search` in a
25
25
  # later patch layer, which defers the node:sqlite import and in-memory handle
26
- # to the first search so Node 22 startup stays quiet.
26
+ # to the first search so startup stays quiet.
27
27
  - id: session-query-sqlite
28
28
  config:
29
29
  path: ':memory:'
30
30
  openAt: never
31
31
 
32
- - id: tools
33
- config:
34
- # TEMPORARY workaround: RABI_TOOLS_MODE (native|ptc) opts a whole rabi
35
- # process into PTC mode while per-session tool-presentation selection is being
36
- # designed; unset keeps the schema default (native). Remove the env seam
37
- # once the web UI owns the choice per session.
38
- mode: !!js process.env.RABI_TOOLS_MODE
39
-
40
32
  # ── web-only host rows, the transport layer, and the browser roster ─────────
41
33
 
42
34
  # `rabi.client` rows are the browser roster the modules node half scans into
@@ -61,8 +53,8 @@
61
53
  enabled: true
62
54
  appVersion: !!js process.env.RABI_CLIENT_VERSION
63
55
 
64
- # Host-owned opt-in sampled when a new Web session receives its preset
65
- # delegation tools. The Plugins page edits this settings namespace.
56
+ # Host-owned authorization sampled at Agent creation. The Plugins page
57
+ # edits this settings namespace independently of the selected preset.
66
58
  - id: subagent-model-selection-settings
67
59
  name: '@unieai/rabi-tool-subagent/model-selection-settings'
68
60
 
@@ -75,9 +67,9 @@
75
67
  - id: session-log-download
76
68
  name: '@unieai/rabi-session-log-export'
77
69
 
78
- # Session-header "Open In..." split button over the host application
79
- # resolution (macOS/Windows/Linux; a host with no resolved application
80
- # renders no button). Two halves: the host routes and the browser surface.
70
+ # Session-menu application choices over Host resolution on macOS, Windows,
71
+ # and Linux. An empty catalog hides the action. The Host routes and browser
72
+ # controls also serve the file-tree directory opener.
81
73
  - id: open-in-app
82
74
  name: '@unieai/rabi-host-open-in-app'
83
75
  config:
@@ -85,6 +77,10 @@
85
77
  iconTimeoutMs: 10000
86
78
  launchWatchMs: 1000
87
79
 
80
+ - id: ui-file-actions
81
+ name: '@unieai/rabi-client-ui-file-actions'
82
+ - id: ui-context-menu
83
+ name: '@unieai/rabi-client-ui-context-menu'
88
84
  - id: ui-open-in-app
89
85
  name: '@unieai/rabi-client-ui-open-in-app'
90
86
 
@@ -133,7 +129,7 @@
133
129
  name: '@unieai/rabi-api-workspace-files'
134
130
 
135
131
  # The Schedule service owns the task store and delivers each due occurrence
136
- # as a follow-up in its original Session. The clock reading and the four
132
+ # as a follow-up to the task's target Session. The clock reading and the four
137
133
  # reminder tools belong to the `standard`, `cordis`, and `ptc` presets,
138
134
  # which declare them in their own scope.
139
135
  - id: schedule
@@ -144,12 +140,20 @@
144
140
  - id: ui-settings-account
145
141
  name: '@unieai/rabi-client-ui-settings-account'
146
142
 
147
- - id: account-controller
148
- name: '@unieai/rabi-api-account-controller'
143
+ - id: ui-account-notifications
144
+ name: '@unieai/rabi-client-ui-account-notifications'
149
145
 
150
146
  - id: settings-controller
151
147
  name: '@unieai/rabi-api-settings-controller'
152
148
 
149
+ # One shared MCP server fleet: Settings-configured servers plus servers
150
+ # that installed plugins register, with status and recovery over Remote.
151
+ # Credential templates and OAuth grants resolve through the credentials
152
+ # provider, so the manager starts after it.
153
+ - id: mcp-manager
154
+ name: '@unieai/rabi-mcp-manager'
155
+ inject: [credentials]
156
+
153
157
  # Workspace commands and reconnect-safe projection over Typert Remote.
154
158
  - id: workspace-controller
155
159
  name: '@unieai/rabi-api-workspace-controller'
@@ -284,8 +288,27 @@
284
288
  name: '@unieai/rabi-client-ui-sidebar-right'
285
289
 
286
290
 
287
- - id: office-to-pdf
288
- name: '@unieai/rabi-office-to-pdf'
291
+ - id: office-kit
292
+ name: '@unieai/rabi-office-kit'
293
+ config:
294
+ outputDirectory: !!js rabiHomePath('office-kit', 'outputs')
295
+
296
+ # Every profile uses the packaged Office skills. Desktop supplies their Python
297
+ # environment through the primary runtime named by RABI_PRIMARY_RUNTIME and
298
+ # selects `workspace-dependencies`. A Desktop profile launched without a
299
+ # nonempty value disables workspace-dependencies and, like the other
300
+ # profiles, selects `user` to direct the model to the user's Python.
301
+ - id: workspace-dependencies
302
+ name: '@unieai/rabi-tool-workspace-dependencies'
303
+ disabled: !!js "ctx.get('profileContext')?.name !== 'desktop' || !process.env.RABI_PRIMARY_RUNTIME"
304
+ config:
305
+ source: !!js process.env.RABI_PRIMARY_RUNTIME
306
+ root: !!js rabiHomePath('rabi-runtimes', 'rabi-primary-runtime')
307
+
308
+ - id: skill-office
309
+ name: '@unieai/rabi-skill-office'
310
+ config:
311
+ pythonEnvironment: !!js "ctx.get('profileContext')?.name === 'desktop' && process.env.RABI_PRIMARY_RUNTIME ? 'workspace-dependencies' : 'user'"
289
312
 
290
313
  # The right Sidebar's document tab: bounded file reads with selectable
291
314
  # Markdown, code, HTML, PDF, Office, and plain-text renderers.
@@ -329,16 +352,22 @@
329
352
  - id: ui-approval
330
353
  name: '@unieai/rabi-client-ui-approval'
331
354
 
355
+ - id: message-quotes
356
+ name: '@unieai/rabi-message-quotes'
357
+
332
358
  - id: ui-chat
333
359
  name: '@unieai/rabi-client-ui-chat'
334
360
 
335
- # Official occupants for the generic sidebar and conversation brand slots.
361
+ # Official occupants for the sidebar brand slots and the home whale frame layer.
336
362
  - id: ui-brand-official
337
363
  name: '@unieai/rabi-client-ui-brand-official'
338
364
 
339
365
  - id: ui-attachment
340
366
  name: '@unieai/rabi-client-ui-attachment'
341
367
 
368
+ - id: ui-file-drag
369
+ name: '@unieai/rabi-client-ui-file-drag'
370
+
342
371
  # Tool call tree, generic fallback, and keyed business Tool views.
343
372
  - id: ui-tool
344
373
  name: '@unieai/rabi-client-ui-tool'
@@ -346,6 +375,9 @@
346
375
  - id: ui-cordis
347
376
  name: '@unieai/rabi-client-ui-cordis'
348
377
 
378
+ - id: deliverable-file-references
379
+ name: '@unieai/rabi-deliverable-file-references'
380
+
349
381
  # Turn tail: the changed-files card and delivery cards under each closing
350
382
  # assistant message. Remove this entry to turn the surface off; the tail
351
383
  # hole renders empty.
@@ -377,6 +409,9 @@
377
409
  - id: ui-skill
378
410
  name: '@unieai/rabi-client-ui-skill'
379
411
 
412
+ - id: ui-agent-team
413
+ name: '@unieai/rabi-client-ui-agent-team'
414
+
380
415
  - id: ui-subagent
381
416
  name: '@unieai/rabi-client-ui-subagent'
382
417
 
@@ -412,9 +447,6 @@
412
447
  - id: ui-model-selection
413
448
  name: '@unieai/rabi-client-ui-model-selection'
414
449
 
415
- - id: ui-deepseek-model-label-1017
416
- name: '@unieai/rabi-client-ui-deepseek-model-label-1017'
417
-
418
450
  - id: ui-permission
419
451
  name: '@unieai/rabi-client-ui-permission-presets'
420
452
 
@@ -550,19 +582,13 @@
550
582
  - id: tool-result-pruner
551
583
  disabled: true
552
584
 
553
- # The subagent registry and its backends STAY in the host plane. `subagents` is
554
- # a process singleton with a cross-session query surface (`listChildren`,
555
- # `followup`) that the host api-proxy serves to the browser, and a provider
556
- # registers under a globally unique name, so a per-session copy would both
557
- # starve that host row and collide on the second session. What a preset
558
- # chooses is which delegation TOOLS its agent sees, below.
585
+ # The subagent registry and its backends belong in the host composition: browser
586
+ # prompt and interrupt requests share its runtime, and provider names are unique
587
+ # within the registry. Presets select the delegation tools visible to each Agent.
559
588
 
560
589
  - id: tool-subagent-control
561
590
  disabled: true
562
591
 
563
- - id: tool-subagent-list-agents
564
- disabled: true
565
-
566
592
  - id: tool-subagent
567
593
  disabled: true
568
594
 
package/locale/de.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Unterstützung bei der Ausführung von Webanwendungen",
4
+ "description": "Stellen Sie Front-End-Seitenressourcen bereit und verbinden Sie die für die Webanwendung erforderliche laufende Konfiguration."
5
+ }
6
+ }
package/locale/es.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Soporte de ejecución de aplicaciones web",
4
+ "description": "Proporcione recursos de la página de inicio y conecte la configuración en ejecución requerida por la aplicación web."
5
+ }
6
+ }
package/locale/fr.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Prise en charge de l'exécution d'applications Web",
4
+ "description": "Fournissez les ressources de la page frontale et connectez la configuration en cours requise par l'application Web."
5
+ }
6
+ }
package/locale/ja.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Web アプリ実行サポート",
4
+ "description": "フロントエンドのページリソースを提供し、Web アプリに必要な実行設定を接続します。"
5
+ }
6
+ }
package/locale/pt.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Suporte à execução de aplicações web",
4
+ "description": "Fornece recursos de página front-end e conecta a configuração de execução exigida pelo aplicativo da web."
5
+ }
6
+ }
package/locale/ru.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Поддержка выполнения веб-приложений",
4
+ "description": "Предоставьте ресурсы интерфейсной страницы и подключите работающую конфигурацию, необходимую веб-приложению."
5
+ }
6
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Web-Startkonfiguration"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Configuración de inicio web"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Configuration du démarrage Web"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Web 起動設定"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Configuração de inicialização Web"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "Настройки запуска веб-приложения"
4
+ }
5
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unieai/rabi-web-app",
3
3
  "description": "The rabi browser-surface bundle: the web patch layer over rabi-base plus the runtime glue plugin (frontend dist serving, bash runtime variables, URL line)",
4
- "version": "0.2.1-rc.3",
4
+ "version": "0.2.2-rc.5",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -36,6 +36,9 @@
36
36
  "presets/cordis.patch.yml",
37
37
  "lib/public-url-*.js",
38
38
  "lib/types/**/*.d.ts",
39
+ "lib/types/**/*.d.ts.map",
40
+ "lib/**/*.js.map",
41
+ "src",
39
42
  "README.md"
40
43
  ],
41
44
  "license": "MIT",
@@ -51,145 +54,155 @@
51
54
  }
52
55
  },
53
56
  "dependencies": {
54
- "@unieai/rabi-agent-instructions": "0.2.1-rc.3",
55
- "@unieai/rabi-agent-preset": "0.2.1-rc.3",
56
- "@unieai/rabi-agent-preset-registry": "0.2.1-rc.3",
57
- "@unieai/rabi-agent-tool-presentation": "0.2.1-rc.3",
58
- "@unieai/rabi-api-job-controller": "0.2.1-rc.3",
59
- "@unieai/rabi-api-remotes": "0.2.1-rc.3",
60
- "@unieai/rabi-api-session-controller": "0.2.1-rc.3",
61
- "@unieai/rabi-api-settings-controller": "0.2.1-rc.3",
62
- "@unieai/rabi-api-terminal-controller": "0.2.1-rc.3",
63
- "@unieai/rabi-api-workspace-controller": "0.2.1-rc.3",
64
- "@unieai/rabi-api-workspace-files": "0.2.1-rc.3",
65
- "@unieai/rabi-app-boot": "0.2.1-rc.3",
66
- "@unieai/rabi-client-connection": "0.2.1-rc.3",
67
- "@unieai/rabi-client-file-upload": "0.2.1-rc.3",
68
- "@unieai/rabi-client-hmr": "0.2.1-rc.3",
69
- "@unieai/rabi-client-locale": "0.2.1-rc.3",
70
- "@unieai/rabi-client-modules": "0.2.1-rc.3",
71
- "@unieai/rabi-client-resources": "0.2.1-rc.3",
72
- "@unieai/rabi-client-ui-agent-preset": "0.2.1-rc.3",
73
- "@unieai/rabi-client-ui-approval": "0.2.1-rc.3",
74
- "@unieai/rabi-client-ui-attachment": "0.2.1-rc.3",
75
- "@unieai/rabi-client-ui-brand-official": "0.2.1-rc.3",
76
- "@unieai/rabi-client-ui-chat": "0.2.1-rc.3",
77
- "@unieai/rabi-client-ui-commands": "0.2.1-rc.3",
78
- "@unieai/rabi-client-ui-conversation": "0.2.1-rc.3",
79
- "@unieai/rabi-client-ui-cordis": "0.2.1-rc.3",
80
- "@unieai/rabi-client-ui-deliverables": "0.2.1-rc.3",
81
- "@unieai/rabi-client-ui-directory-picker-browse": "0.2.1-rc.3",
82
- "@unieai/rabi-client-ui-directory-picker-native": "0.2.1-rc.3",
83
- "@unieai/rabi-client-ui-entry-customization": "0.2.1-rc.3",
84
- "@unieai/rabi-client-ui-goal": "0.2.1-rc.3",
85
- "@unieai/rabi-client-ui-input-trigger": "0.2.1-rc.3",
86
- "@unieai/rabi-client-ui-jobs": "0.2.1-rc.3",
87
- "@unieai/rabi-client-ui-layout": "0.2.1-rc.3",
88
- "@unieai/rabi-client-ui-message-feedback": "0.2.1-rc.3",
89
- "@unieai/rabi-client-ui-model-selection": "0.2.1-rc.3",
90
- "@unieai/rabi-client-ui-deepseek-model-label-1017": "0.2.1-rc.3",
91
- "@unieai/rabi-client-ui-open-in-app": "0.2.1-rc.3",
92
- "@unieai/rabi-client-ui-permission-presets": "0.2.1-rc.3",
93
- "@unieai/rabi-client-ui-plan": "0.2.1-rc.3",
94
- "@unieai/rabi-client-ui-plugin-manager": "0.2.1-rc.3",
95
- "@unieai/rabi-client-ui-reference": "0.2.1-rc.3",
96
- "@unieai/rabi-client-ui-renderer": "0.2.1-rc.3",
97
- "@unieai/rabi-client-ui-secret-mask": "0.2.1-rc.3",
98
- "@unieai/rabi-client-ui-session": "0.2.1-rc.3",
99
- "@unieai/rabi-client-ui-schedule": "0.2.1-rc.3",
100
- "@unieai/rabi-client-ui-settings": "0.2.1-rc.3",
101
- "@unieai/rabi-client-ui-settings-general": "0.2.1-rc.3",
102
- "@unieai/rabi-client-ui-settings-models": "0.2.1-rc.3",
103
- "@unieai/rabi-client-ui-settings-plugin-inventory": "0.2.1-rc.3",
104
- "@unieai/rabi-client-ui-settings-plugins": "0.2.1-rc.3",
105
- "@unieai/rabi-client-ui-settings-shell": "0.2.1-rc.3",
106
- "@unieai/rabi-client-ui-settings-agent-loop": "0.2.1-rc.3",
107
- "@unieai/rabi-client-ui-settings-subagent": "0.2.1-rc.3",
108
- "@unieai/rabi-client-ui-settings-web-search": "0.2.1-rc.3",
109
- "@unieai/rabi-client-ui-sidebar": "0.2.1-rc.3",
110
- "@unieai/rabi-client-ui-sidebar-browser": "0.2.1-rc.3",
111
- "@unieai/rabi-client-ui-sidebar-documentpreview": "0.2.1-rc.3",
112
- "@unieai/rabi-client-ui-sidebar-files": "0.2.1-rc.3",
113
- "@unieai/rabi-client-ui-sidebar-right": "0.2.1-rc.3",
114
- "@unieai/rabi-client-ui-sidebar-terminal": "0.2.1-rc.3",
115
- "@unieai/rabi-client-ui-skill": "0.2.1-rc.3",
116
- "@unieai/rabi-client-ui-subagent": "0.2.1-rc.3",
117
- "@unieai/rabi-client-ui-theme": "0.2.1-rc.3",
118
- "@unieai/rabi-client-ui-tool": "0.2.1-rc.3",
119
- "@unieai/rabi-client-ui-trajectory": "0.2.1-rc.3",
120
- "@unieai/rabi-client-ui-user-questions": "0.2.1-rc.3",
121
- "@unieai/rabi-client-ui-workflow-run": "0.2.1-rc.3",
122
- "@unieai/rabi-client-ui-workspace": "0.2.1-rc.3",
123
- "@unieai/rabi-cmdline": "0.2.1-rc.3",
124
- "@unieai/rabi-command-compact": "0.2.1-rc.3",
125
- "@unieai/rabi-command-goal": "0.2.1-rc.3",
126
- "@unieai/rabi-compaction-basic": "0.2.1-rc.3",
127
- "@unieai/rabi-compaction-tool-result-pruner": "0.2.1-rc.3",
128
- "@unieai/rabi-cordis-client-runner": "0.2.1-rc.3",
129
- "@unieai/rabi-cordis-host-runner": "0.2.1-rc.3",
130
- "@unieai/rabi-file-reference": "0.2.1-rc.3",
131
- "@unieai/rabi-file-reference-local": "0.2.1-rc.3",
132
- "@unieai/rabi-host-directory-picker-auto": "0.2.1-rc.3",
133
- "@unieai/rabi-host-directory-picker-browse": "0.2.1-rc.3",
134
- "@unieai/rabi-host-directory-picker-native": "0.2.1-rc.3",
135
- "@unieai/rabi-host-frontend-static": "0.2.1-rc.3",
136
- "@unieai/rabi-host-open-in-app": "0.2.1-rc.3",
137
- "@unieai/rabi-host-plugin-inventory": "0.2.1-rc.3",
138
- "@unieai/rabi-host-webserver": "0.2.1-rc.3",
139
- "@unieai/rabi-launch-environment": "0.2.1-rc.3",
140
- "@unieai/rabi-message-feedback": "0.2.1-rc.3",
141
- "@unieai/rabi-office-to-pdf": "0.2.1-rc.3",
142
- "@unieai/rabi-persona": "0.2.1-rc.3",
143
- "@unieai/rabi-plan-mode": "0.2.1-rc.3",
144
- "@unieai/rabi-plugin-manager": "0.2.1-rc.3",
145
- "@unieai/rabi-plugin-market": "0.2.1-rc.3",
146
- "@unieai/rabi-schedule": "0.2.1-rc.3",
147
- "@unieai/rabi-session-log-export": "0.2.1-rc.3",
148
- "@unieai/rabi-session-reference": "0.2.1-rc.3",
149
- "@unieai/rabi-session-stats": "0.2.1-rc.3",
150
- "@unieai/rabi-session-turn-outline": "0.2.1-rc.3",
151
- "@unieai/rabi-skill-filesystem": "0.2.1-rc.3",
152
- "@unieai/rabi-subprocess": "0.2.1-rc.3",
153
- "@unieai/rabi-terminal": "0.2.1-rc.3",
154
- "@unieai/rabi-terminal-bash": "0.2.1-rc.3",
155
- "@unieai/rabi-time-context": "0.2.1-rc.3",
156
- "@unieai/rabi-tool-ask-user": "0.2.1-rc.3",
157
- "@unieai/rabi-tool-bash": "0.2.1-rc.3",
158
- "@unieai/rabi-tool-bash-persistent": "0.2.1-rc.3",
159
- "@unieai/rabi-tool-cordis": "0.2.1-rc.3",
160
- "@unieai/rabi-tool-fs": "0.2.1-rc.3",
161
- "@unieai/rabi-tool-fs-search": "0.2.1-rc.3",
162
- "@unieai/rabi-tool-goal": "0.2.1-rc.3",
163
- "@unieai/rabi-tool-jobs": "0.2.1-rc.3",
164
- "@unieai/rabi-tool-present": "0.2.1-rc.3",
165
- "@unieai/rabi-tool-pwsh": "0.2.1-rc.3",
166
- "@unieai/rabi-tool-pwsh-persistent": "0.2.1-rc.3",
167
- "@unieai/rabi-tool-schedule": "0.2.1-rc.3",
168
- "@unieai/rabi-tool-skill": "0.2.1-rc.3",
169
- "@unieai/rabi-tool-subagent": "0.2.1-rc.3",
170
- "@unieai/rabi-tool-subagent-control": "0.2.1-rc.3",
171
- "@unieai/rabi-tool-todo": "0.2.1-rc.3",
172
- "@unieai/rabi-tool-web": "0.2.1-rc.3",
173
- "@unieai/rabi-tool-workflow": "0.2.1-rc.3",
174
- "@unieai/rabi-web-frontend": "0.2.1-rc.3",
175
- "@unieai/rabi-workflow-ptc": "0.2.1-rc.3",
176
- "@unieai/rabi-workspace": "0.2.1-rc.3",
177
- "@unieai/rabi-workspace-changes": "0.2.1-rc.3",
178
- "@unieai/schemastery": "3.18.5",
57
+ "@unieai/rabi-agent-instructions": "0.2.2-rc.5",
58
+ "@unieai/rabi-agent-preset": "0.2.2-rc.5",
59
+ "@unieai/rabi-agent-preset-registry": "0.2.2-rc.5",
60
+ "@unieai/rabi-agent-tool-presentation": "0.2.2-rc.5",
61
+ "@unieai/rabi-api-job-controller": "0.2.2-rc.5",
62
+ "@unieai/rabi-api-remotes": "0.2.2-rc.5",
63
+ "@unieai/rabi-api-session-controller": "0.2.2-rc.5",
64
+ "@unieai/rabi-api-settings-controller": "0.2.2-rc.5",
65
+ "@unieai/rabi-api-terminal-controller": "0.2.2-rc.5",
66
+ "@unieai/rabi-api-workspace-controller": "0.2.2-rc.5",
67
+ "@unieai/rabi-api-workspace-files": "0.2.2-rc.5",
68
+ "@unieai/rabi-app-boot": "0.2.2-rc.5",
69
+ "@unieai/rabi-client-connection": "0.2.2-rc.5",
70
+ "@unieai/rabi-client-file-upload": "0.2.2-rc.5",
71
+ "@unieai/rabi-client-hmr": "0.2.2-rc.5",
72
+ "@unieai/rabi-client-locale": "0.2.2-rc.5",
73
+ "@unieai/rabi-client-modules": "0.2.2-rc.5",
74
+ "@unieai/rabi-client-product-analytics": "0.2.2-rc.5",
75
+ "@unieai/rabi-client-resources": "0.2.2-rc.5",
76
+ "@unieai/rabi-client-shortcuts": "0.2.2-rc.5",
77
+ "@unieai/rabi-client-ui-account-notifications": "0.2.2-rc.5",
78
+ "@unieai/rabi-client-ui-agent-preset": "0.2.2-rc.5",
79
+ "@unieai/rabi-client-ui-agent-team": "0.2.2-rc.5",
80
+ "@unieai/rabi-client-ui-approval": "0.2.2-rc.5",
81
+ "@unieai/rabi-client-ui-attachment": "0.2.2-rc.5",
82
+ "@unieai/rabi-client-ui-brand-official": "0.2.2-rc.5",
83
+ "@unieai/rabi-client-ui-chat": "0.2.2-rc.5",
84
+ "@unieai/rabi-client-ui-commands": "0.2.2-rc.5",
85
+ "@unieai/rabi-client-ui-context-menu": "0.2.2-rc.5",
86
+ "@unieai/rabi-client-ui-conversation": "0.2.2-rc.5",
87
+ "@unieai/rabi-client-ui-cordis": "0.2.2-rc.5",
88
+ "@unieai/rabi-client-ui-deliverables": "0.2.2-rc.5",
89
+ "@unieai/rabi-client-ui-directory-picker-browse": "0.2.2-rc.5",
90
+ "@unieai/rabi-client-ui-directory-picker-native": "0.2.2-rc.5",
91
+ "@unieai/rabi-client-ui-entry-customization": "0.2.2-rc.5",
92
+ "@unieai/rabi-client-ui-file-actions": "0.2.2-rc.5",
93
+ "@unieai/rabi-client-ui-file-drag": "0.2.2-rc.5",
94
+ "@unieai/rabi-client-ui-goal": "0.2.2-rc.5",
95
+ "@unieai/rabi-client-ui-input-trigger": "0.2.2-rc.5",
96
+ "@unieai/rabi-client-ui-jobs": "0.2.2-rc.5",
97
+ "@unieai/rabi-client-ui-layout": "0.2.2-rc.5",
98
+ "@unieai/rabi-client-ui-message-feedback": "0.2.2-rc.5",
99
+ "@unieai/rabi-client-ui-model-selection": "0.2.2-rc.5",
100
+ "@unieai/rabi-client-ui-open-in-app": "0.2.2-rc.5",
101
+ "@unieai/rabi-client-ui-permission-presets": "0.2.2-rc.5",
102
+ "@unieai/rabi-client-ui-plan": "0.2.2-rc.5",
103
+ "@unieai/rabi-client-ui-plugin-manager": "0.2.2-rc.5",
104
+ "@unieai/rabi-client-ui-reference": "0.2.2-rc.5",
105
+ "@unieai/rabi-client-ui-renderer": "0.2.2-rc.5",
106
+ "@unieai/rabi-client-ui-schedule": "0.2.2-rc.5",
107
+ "@unieai/rabi-client-ui-secret-mask": "0.2.2-rc.5",
108
+ "@unieai/rabi-client-ui-session": "0.2.2-rc.5",
109
+ "@unieai/rabi-client-ui-settings": "0.2.2-rc.5",
110
+ "@unieai/rabi-client-ui-settings-account": "0.2.2-rc.5",
111
+ "@unieai/rabi-client-ui-settings-agent-loop": "0.2.2-rc.5",
112
+ "@unieai/rabi-client-ui-settings-general": "0.2.2-rc.5",
113
+ "@unieai/rabi-client-ui-settings-models": "0.2.2-rc.5",
114
+ "@unieai/rabi-client-ui-settings-plugin-inventory": "0.2.2-rc.5",
115
+ "@unieai/rabi-client-ui-settings-plugins": "0.2.2-rc.5",
116
+ "@unieai/rabi-client-ui-settings-session-log": "0.2.2-rc.5",
117
+ "@unieai/rabi-client-ui-settings-shell": "0.2.2-rc.5",
118
+ "@unieai/rabi-client-ui-settings-subagent": "0.2.2-rc.5",
119
+ "@unieai/rabi-client-ui-settings-web-search": "0.2.2-rc.5",
120
+ "@unieai/rabi-client-ui-shortcuts": "0.2.2-rc.5",
121
+ "@unieai/rabi-client-ui-sidebar": "0.2.2-rc.5",
122
+ "@unieai/rabi-client-ui-sidebar-browser": "0.2.2-rc.5",
123
+ "@unieai/rabi-client-ui-sidebar-documentpreview": "0.2.2-rc.5",
124
+ "@unieai/rabi-client-ui-sidebar-files": "0.2.2-rc.5",
125
+ "@unieai/rabi-client-ui-sidebar-right": "0.2.2-rc.5",
126
+ "@unieai/rabi-client-ui-sidebar-terminal": "0.2.2-rc.5",
127
+ "@unieai/rabi-client-ui-skill": "0.2.2-rc.5",
128
+ "@unieai/rabi-client-ui-subagent": "0.2.2-rc.5",
129
+ "@unieai/rabi-client-ui-theme": "0.2.2-rc.5",
130
+ "@unieai/rabi-client-ui-tool": "0.2.2-rc.5",
131
+ "@unieai/rabi-client-ui-trajectory": "0.2.2-rc.5",
132
+ "@unieai/rabi-client-ui-user-questions": "0.2.2-rc.5",
133
+ "@unieai/rabi-client-ui-workflow-run": "0.2.2-rc.5",
134
+ "@unieai/rabi-client-ui-workspace": "0.2.2-rc.5",
135
+ "@unieai/rabi-cmdline": "0.2.2-rc.5",
136
+ "@unieai/rabi-command-compact": "0.2.2-rc.5",
137
+ "@unieai/rabi-command-goal": "0.2.2-rc.5",
138
+ "@unieai/rabi-compaction-basic": "0.2.2-rc.5",
139
+ "@unieai/rabi-compaction-tool-result-pruner": "0.2.2-rc.5",
140
+ "@unieai/rabi-cordis-client-runner": "0.2.2-rc.5",
141
+ "@unieai/rabi-cordis-host-runner": "0.2.2-rc.5",
142
+ "@unieai/rabi-deliverable-file-references": "0.2.2-rc.5",
143
+ "@unieai/rabi-file-reference": "0.2.2-rc.5",
144
+ "@unieai/rabi-file-reference-local": "0.2.2-rc.5",
145
+ "@unieai/rabi-harness-dev-context": "0.2.2-rc.5",
146
+ "@unieai/rabi-host-directory-picker-auto": "0.2.2-rc.5",
147
+ "@unieai/rabi-host-directory-picker-browse": "0.2.2-rc.5",
148
+ "@unieai/rabi-host-directory-picker-native": "0.2.2-rc.5",
149
+ "@unieai/rabi-host-frontend-static": "0.2.2-rc.5",
150
+ "@unieai/rabi-host-open-in-app": "0.2.2-rc.5",
151
+ "@unieai/rabi-host-plugin-inventory": "0.2.2-rc.5",
152
+ "@unieai/rabi-host-product-telemetry-otel": "0.2.2-rc.5",
153
+ "@unieai/rabi-host-webserver": "0.2.2-rc.5",
154
+ "@unieai/rabi-launch-environment": "0.2.2-rc.5",
155
+ "@unieai/rabi-mcp-manager": "0.2.2-rc.5",
156
+ "@unieai/rabi-message-feedback": "0.2.2-rc.5",
157
+ "@unieai/rabi-message-quotes": "0.2.2-rc.5",
158
+ "@unieai/rabi-office-kit": "0.2.2-rc.5",
159
+ "@unieai/rabi-persona": "0.2.2-rc.5",
160
+ "@unieai/rabi-plan-mode": "0.2.2-rc.5",
161
+ "@unieai/rabi-plugin-manager": "0.2.2-rc.5",
162
+ "@unieai/rabi-plugin-market": "0.2.2-rc.5",
163
+ "@unieai/rabi-schedule": "0.2.2-rc.5",
164
+ "@unieai/rabi-session-log-export": "0.2.2-rc.5",
165
+ "@unieai/rabi-session-reference": "0.2.2-rc.5",
166
+ "@unieai/rabi-session-stats": "0.2.2-rc.5",
167
+ "@unieai/rabi-session-turn-outline": "0.2.2-rc.5",
168
+ "@unieai/rabi-skill-filesystem": "0.2.2-rc.5",
169
+ "@unieai/rabi-skill-office": "0.2.2-rc.5",
170
+ "@unieai/rabi-subprocess": "0.2.2-rc.5",
171
+ "@unieai/rabi-terminal": "0.2.2-rc.5",
172
+ "@unieai/rabi-terminal-bash": "0.2.2-rc.5",
173
+ "@unieai/rabi-time-context": "0.2.2-rc.5",
174
+ "@unieai/rabi-tool-ask-user": "0.2.2-rc.5",
175
+ "@unieai/rabi-tool-bash": "0.2.2-rc.5",
176
+ "@unieai/rabi-tool-bash-persistent": "0.2.2-rc.5",
177
+ "@unieai/rabi-tool-cordis": "0.2.2-rc.5",
178
+ "@unieai/rabi-tool-executor-ptc": "0.2.2-rc.5",
179
+ "@unieai/rabi-tool-fs": "0.2.2-rc.5",
180
+ "@unieai/rabi-tool-fs-search": "0.2.2-rc.5",
181
+ "@unieai/rabi-tool-goal": "0.2.2-rc.5",
182
+ "@unieai/rabi-tool-jobs": "0.2.2-rc.5",
183
+ "@unieai/rabi-tool-office": "0.2.2-rc.5",
184
+ "@unieai/rabi-tool-present": "0.2.2-rc.5",
185
+ "@unieai/rabi-tool-pwsh": "0.2.2-rc.5",
186
+ "@unieai/rabi-tool-pwsh-persistent": "0.2.2-rc.5",
187
+ "@unieai/rabi-tool-schedule": "0.2.2-rc.5",
188
+ "@unieai/rabi-tool-skill": "0.2.2-rc.5",
189
+ "@unieai/rabi-tool-subagent": "0.2.2-rc.5",
190
+ "@unieai/rabi-tool-subagent-control": "0.2.2-rc.5",
191
+ "@unieai/rabi-tool-todo": "0.2.2-rc.5",
192
+ "@unieai/rabi-tool-web": "0.2.2-rc.5",
193
+ "@unieai/rabi-tool-workflow": "0.2.2-rc.5",
194
+ "@unieai/rabi-tool-workspace-dependencies": "0.2.2-rc.5",
195
+ "@unieai/rabi-web-frontend": "0.2.2-rc.5",
196
+ "@unieai/rabi-workflow-ptc": "0.2.2-rc.5",
197
+ "@unieai/rabi-workspace": "0.2.2-rc.5",
198
+ "@unieai/rabi-workspace-changes": "0.2.2-rc.5",
199
+ "@unieai/schemastery": "3.19.0",
179
200
  "commander": "^15.0.0",
180
- "open": "^11.0.2",
181
- "@unieai/rabi-api-account-controller": "0.2.1-rc.3",
182
- "@unieai/rabi-client-ui-settings-account": "0.2.1-rc.3",
183
- "@unieai/rabi-client-shortcuts": "0.2.1-rc.3",
184
- "@unieai/rabi-client-ui-shortcuts": "0.2.1-rc.3",
185
- "@unieai/rabi-client-product-analytics": "0.2.1-rc.3",
186
- "@unieai/rabi-host-product-telemetry-otel": "0.2.1-rc.3",
187
- "@unieai/rabi-client-ui-settings-session-log": "0.2.1-rc.3",
188
- "@unieai/rabi-harness-dev-context": "0.2.1-rc.3"
201
+ "open": "^11.0.2"
189
202
  },
190
203
  "peerDependencies": {
191
- "@unieai/cordis": "4.0.5",
192
- "@unieai/cordis-plugin-loader": "1.0.6",
193
- "@unieai/rabi-shell-env": "0.2.1-rc.3"
204
+ "@unieai/cordis": "4.1.0",
205
+ "@unieai/cordis-plugin-loader": "1.1.0",
206
+ "@unieai/rabi-shell-env": "0.2.2-rc.5"
194
207
  }
195
208
  }
@@ -8,13 +8,13 @@
8
8
  id: cordis
9
9
  order: 4
10
10
  plugins:
11
- # Same persona as `standard`: tool descriptions and the skill catalog carry
12
- # the operating detail, and the skills own the preset-authoring rules.
11
+ # The rabi-doc skill owns plugin implementation and authorization guidance.
13
12
  - id: persona
14
13
  name: '@unieai/rabi-persona'
15
14
  config:
16
15
  prefix: >-
17
16
  You are a coding agent powered by the {{model}} model.
17
+ You help the user customize Rabi Harness itself.
18
18
  - id: agent-instructions
19
19
  name: '@unieai/rabi-agent-instructions'
20
20
  config:
@@ -29,6 +29,9 @@
29
29
  disabled: !!js process.platform !== 'win32'
30
30
  - id: tool-fs
31
31
  name: '@unieai/rabi-tool-fs'
32
+ config:
33
+ # Set true to add the apply_patch tool beside edit.
34
+ applyPatch: false
32
35
  - id: tool-fs-search
33
36
  name: '@unieai/rabi-tool-fs-search'
34
37
  config:
@@ -87,14 +90,15 @@
87
90
  config:
88
91
  - id: tool-subagent-control
89
92
  name: '@unieai/rabi-tool-subagent-control'
90
- - id: tool-subagent-list-agents
91
- name: '@unieai/rabi-tool-subagent-control/list-agents'
93
+ config:
94
+ interrupt: false
92
95
  - id: tool-subagent
93
96
  name: '@unieai/rabi-tool-subagent'
94
97
  config:
95
98
  provider: spawn
96
99
  toolName: subagent
97
- modelSelectionSettings: true
100
+ modelSelection: true
101
+ modelDiscovery: true
98
102
  - id: tool-subagent-fork
99
103
  name: '@unieai/rabi-tool-subagent'
100
104
  config:
@@ -26,6 +26,9 @@
26
26
  disabled: !!js process.platform !== 'win32'
27
27
  - id: tool-fs
28
28
  name: '@unieai/rabi-tool-fs'
29
+ config:
30
+ # Set true to add the apply_patch tool beside edit.
31
+ applyPatch: false
29
32
  - id: tool-fs-search
30
33
  name: '@unieai/rabi-tool-fs-search'
31
34
  config:
@@ -88,14 +91,15 @@
88
91
  config:
89
92
  - id: tool-subagent-control
90
93
  name: '@unieai/rabi-tool-subagent-control'
91
- - id: tool-subagent-list-agents
92
- name: '@unieai/rabi-tool-subagent-control/list-agents'
94
+ config:
95
+ interrupt: false
93
96
  - id: tool-subagent
94
97
  name: '@unieai/rabi-tool-subagent'
95
98
  config:
96
99
  provider: spawn
97
100
  toolName: subagent
98
- modelSelectionSettings: true
101
+ modelSelection: true
102
+ modelDiscovery: true
99
103
  - id: tool-subagent-fork
100
104
  name: '@unieai/rabi-tool-subagent'
101
105
  config:
@@ -120,12 +124,12 @@
120
124
  config:
121
125
  fetch: true
122
126
  searchTimeoutMs: 60000
123
- - id: tool-presentation
124
- name: '@unieai/rabi-agent-tool-presentation'
125
- config:
126
- mode: ptc
127
+ - id: tool-executor-ptc
128
+ name: '@unieai/rabi-tool-executor-ptc'
127
129
  - id: present
128
130
  name: '@unieai/rabi-tool-present'
131
+ - id: tool-office
132
+ name: '@unieai/rabi-tool-office'
129
133
  - id: tool-plugin-manager
130
134
  name: '@unieai/rabi-plugin-manager/tools'
131
135
  disabled: true
@@ -26,6 +26,9 @@
26
26
  disabled: !!js process.platform !== 'win32'
27
27
  - id: tool-fs
28
28
  name: '@unieai/rabi-tool-fs'
29
+ config:
30
+ # Set false to drop the apply_patch tool beside edit.
31
+ applyPatch: false
29
32
  - id: tool-fs-search
30
33
  name: '@unieai/rabi-tool-fs-search'
31
34
  config:
@@ -36,6 +39,9 @@
36
39
  name: '@unieai/rabi-tool-schedule'
37
40
  - id: skill-filesystem
38
41
  name: '@unieai/rabi-skill-filesystem'
42
+ config:
43
+ customSkillDirs:
44
+ - !!js process.getBuiltinModule('node:path').join(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:module').createRequire(baseUrl).resolve('@unieai/rabi-agent-preset/package.json')), 'skills')
39
45
  - id: tool-skill
40
46
  name: '@unieai/rabi-tool-skill'
41
47
  - id: command-goal
@@ -88,14 +94,15 @@
88
94
  config:
89
95
  - id: tool-subagent-control
90
96
  name: '@unieai/rabi-tool-subagent-control'
91
- - id: tool-subagent-list-agents
92
- name: '@unieai/rabi-tool-subagent-control/list-agents'
97
+ config:
98
+ interrupt: false
93
99
  - id: tool-subagent
94
100
  name: '@unieai/rabi-tool-subagent'
95
101
  config:
96
102
  provider: spawn
97
103
  toolName: subagent
98
- modelSelectionSettings: true
104
+ modelSelection: true
105
+ modelDiscovery: true
99
106
  - id: tool-subagent-fork
100
107
  name: '@unieai/rabi-tool-subagent'
101
108
  config:
@@ -120,9 +127,11 @@
120
127
  searchTimeoutMs: 60000
121
128
  - id: present
122
129
  name: '@unieai/rabi-tool-present'
130
+ - id: tool-office
131
+ name: '@unieai/rabi-tool-office'
123
132
  - id: tool-plugin-manager
124
133
  name: '@unieai/rabi-plugin-manager/tools'
125
- disabled: true
134
+ disabled: !!js "!ctx.get('profileContext')"
126
135
  - id: tool-plugin-market
127
136
  name: '@unieai/rabi-plugin-market/tools'
128
137
  disabled: true
package/src/index.ts ADDED
@@ -0,0 +1,261 @@
1
+ /**
2
+ * @unieai/rabi-web-app — the browser-surface bundle's runtime glue plugin
3
+ * plus the bundle patch (`cordis.patch.yml`, declared by the `rabi.bundle.patch`
4
+ * manifest field). The plugin owns the browser-surface glue: it resolves
5
+ * the built frontend dist (workspace knowledge of this bundle, never user
6
+ * config), mounts the `frontend-static` fallback owner over it, registers the
7
+ * bash-visible web runtime variable, the process-token URL line, and the
8
+ * default-browser handoff, and provides the `webApp` service. An advertised
9
+ * `publicUrl` replaces the published bind-address URL. Non-loopback
10
+ * HTTP binds trigger an exposure warning. App command-line values arrive
11
+ * through the `webStartup` service expressions in the bundle patch.
12
+ * @module @unieai/rabi-web-app
13
+ */
14
+
15
+ import { spawn, type ChildProcess } from 'node:child_process'
16
+ import { createRequire } from 'node:module'
17
+ import { dirname, join } from 'node:path'
18
+ import type { Context } from '@unieai/cordis'
19
+ import z from '@unieai/schemastery'
20
+ import { auditStartupEntries } from '@unieai/rabi-app-boot'
21
+ import type {} from '@unieai/rabi-client-connection'
22
+ import * as FrontendStatic from '@unieai/rabi-host-frontend-static'
23
+ import { bindUrlHost, isLoopbackHost } from '@unieai/rabi-host-webserver'
24
+ import { launchedThroughSsh, launchEnvironmentOf } from '@unieai/rabi-launch-environment'
25
+ import { scrubbedParentEnv } from '@unieai/rabi-subprocess'
26
+ import type {} from '@unieai/cordis-plugin-loader'
27
+ import type {} from '@unieai/rabi-shell-env'
28
+ import { parsePublicUrl } from './public-url.ts'
29
+
30
+ /** The Web GUI this process serves, provided by the `web-runtime` row. */
31
+ export interface WebApp {
32
+ /**
33
+ * The URL this GUI advertises, also used for `RABI_WEB_URL` and the startup URL line.
34
+ * @returns the configured `publicUrl`, otherwise the listener origin.
35
+ */
36
+ getAdvertisedUrl(): string
37
+ }
38
+
39
+ declare module '@unieai/cordis' {
40
+ interface Context {
41
+ /** The Web GUI this process serves; absent when no Web runtime is mounted. */
42
+ webApp: WebApp
43
+ }
44
+ }
45
+
46
+ /** Stable Cordis plugin name. */
47
+ export const name = 'web-app'
48
+
49
+ const ANNOUNCED_ROOTS = new WeakSet<Context>()
50
+
51
+ /** Services required before the web runtime can mount. */
52
+ export const inject = ['webServer']
53
+
54
+ /** Plugin config: composed deployment settings plus per-invocation command-line values. */
55
+ export interface Config {
56
+ /** Permit default-browser handoff after the Loader tree settles; an SSH launch suppresses it. */
57
+ openBrowser: boolean
58
+ /** Print the URL line on activation; a non-interactive layer can turn it off. */
59
+ printUrl: boolean
60
+ /**
61
+ * Register the `RABI_WEB_URL` bash variable naming this GUI. A one-shot
62
+ * non-interactive layer can turn it off when its user is not in the GUI.
63
+ */
64
+ surfaceContext: boolean
65
+ /**
66
+ * Canonical HTTP(S) root to advertise in the printed and opened URL,
67
+ * `RABI_WEB_URL`, and `webApp.getAdvertisedUrl()`, which supplies the Web GUI
68
+ * URL in agent runtime context, e.g. `https://app.example/ui/`, normalized to end in `/`. Configures no routing
69
+ * or authentication; see [public deployments](../README.md#public-deployments).
70
+ * Absent or YAML `null` advertises the bind-address URL.
71
+ */
72
+ publicUrl?: string
73
+ }
74
+
75
+ export const Config: z<Config> = z.object({
76
+ openBrowser: z.boolean().default(true),
77
+ printUrl: z.boolean().default(true),
78
+ surfaceContext: z.boolean().default(true),
79
+ publicUrl: z.transform(z.string(), value => parsePublicUrl(value).href),
80
+ })
81
+
82
+ /** Environment variable naming the advertised URL of this Web GUI. */
83
+ const RABI_WEB_URL = 'RABI_WEB_URL' as const
84
+
85
+ const BROWSER_OPENER_MODULE = import.meta.resolve('open')
86
+
87
+ const BROWSER_OPENER_PROGRAM = `
88
+ try {
89
+ const { default: open } = await import(${JSON.stringify(BROWSER_OPENER_MODULE)})
90
+ const launcher = await open(process.argv[1])
91
+ if (process.platform === 'win32') {
92
+ // open resolves at PowerShell spawn; keep it referenced until that launcher hands the URL to Windows.
93
+ const code = launcher.exitCode ?? await new Promise((resolve, reject) => {
94
+ function onError(error) {
95
+ launcher.off('close', onClose)
96
+ reject(error)
97
+ }
98
+ function onClose(code) {
99
+ launcher.off('error', onError)
100
+ resolve(code)
101
+ }
102
+ launcher.ref()
103
+ launcher.once('error', onError)
104
+ launcher.once('close', onClose)
105
+ })
106
+ if (code !== 0) throw new Error('browser operating-system launcher exited with code ' + String(code))
107
+ }
108
+ process.exitCode = 0
109
+ } catch (error) {
110
+ // The parent turns this exit into the manual-URL warning.
111
+ console.error(error)
112
+ process.exitCode = 1
113
+ }
114
+ `
115
+
116
+ /**
117
+ * Dist location is workspace knowledge of this bundle: anchored on the
118
+ * frontend package manifest, not configured. Existence is a request-time
119
+ * concern — the fallback owner reads files per request, so a composition
120
+ * whose page never reaches the fallback seat (the static worker preview
121
+ * ships its own page and carries no dist) boots without one.
122
+ */
123
+ function resolveDistIndex(): string {
124
+ const require = createRequire(import.meta.url)
125
+ try {
126
+ return join(dirname(require.resolve('@unieai/rabi-web-frontend/package.json')), 'dist', 'index.html')
127
+ } catch {
128
+ /* v8 ignore next 2 -- reachable only when the frontend package is absent from the checkout */
129
+ throw new Error('web-app: @unieai/rabi-web-frontend is not resolvable from this composition')
130
+ }
131
+ }
132
+
133
+ /** Start the maintained platform opener without forwarding Harness credentials. */
134
+ function spawnBrowserLauncher(url: string): ChildProcess {
135
+ return spawn(process.execPath, [
136
+ '--input-type=module',
137
+ '--eval', BROWSER_OPENER_PROGRAM,
138
+ '--', url,
139
+ ], {
140
+ env: scrubbedParentEnv(),
141
+ stdio: ['ignore', 'inherit', 'pipe'],
142
+ })
143
+ }
144
+
145
+ /** Hand one URL to the operating system's default browser. */
146
+ async function openBrowser(url: string): Promise<void> {
147
+ const launcher = spawnBrowserLauncher(url)
148
+ let launcherStderr = ''
149
+ launcher.stderr?.setEncoding('utf8')
150
+ launcher.stderr?.on('data', (chunk: string) => { launcherStderr += chunk })
151
+ await new Promise<void>((resolve, reject) => {
152
+ function onError(error: Error): void {
153
+ launcher.off('close', onClose)
154
+ reject(error)
155
+ }
156
+ function onClose(code: number | null): void {
157
+ launcher.off('error', onError)
158
+ if (code !== 0) {
159
+ const firstLine = launcherStderr.trim().split(/\r?\n/u)[0]
160
+ const reason = firstLine === undefined || firstLine === ''
161
+ ? `browser launcher exited with code ${String(code)}`
162
+ : firstLine.replace(/^(?:[A-Za-z]*Error):\s*/u, '')
163
+ reject(new Error(reason))
164
+ return
165
+ }
166
+ if (launcherStderr !== '') process.stderr.write(launcherStderr)
167
+ resolve()
168
+ }
169
+ launcher.once('error', onError)
170
+ launcher.once('close', onClose)
171
+ })
172
+ }
173
+
174
+ /** Test hooks for the built dist and native browser handoff; production never mutates them. */
175
+ export const internals: {
176
+ resolveDistIndex: () => string
177
+ openBrowser: (url: string) => Promise<void>
178
+ } = { resolveDistIndex, openBrowser }
179
+
180
+ /**
181
+ * Mount the Web runtime: dist serving, the bash runtime variable, the URL
182
+ * line, and the default-browser handoff.
183
+ * @param ctx - plugin context carrying the webServer service.
184
+ * @param config - validated {@link Config}.
185
+ */
186
+ export function apply(ctx: Context, config: Config): void {
187
+ // The schema validates a present string; an explicit YAML `null` bypasses
188
+ // the string transform and reaches here, meaning unset.
189
+ const publicUrl = config.publicUrl ?? undefined
190
+ const boundHost = ctx.webServer.host
191
+ if (publicUrl === undefined && bindUrlHost(boundHost) === undefined) {
192
+ throw new Error(
193
+ `web-app: bind address ${JSON.stringify(boundHost)} carries an interface zone id, which no URL can express;`
194
+ + ' pass --public-url with the root browsers actually reach it through',
195
+ )
196
+ }
197
+ if (ctx.webServer.protocol === 'http:' && !isLoopbackHost(boundHost)) {
198
+ console.warn(`rabi web: listening on ${boundHost} over plain HTTP; restrict this port to a trusted proxy or network`)
199
+ }
200
+ // The bind URL belongs to this host. Under SSH, the operator reaches it
201
+ // through a local forwarding address that this process cannot derive.
202
+ const handoffBrowser = config.openBrowser && !launchedThroughSsh(launchEnvironmentOf(ctx))
203
+ /** The advertised root: the canonical `publicUrl`, or the listener's own origin. */
204
+ const appRootUrl = (): string => publicUrl ?? ctx.webServer.getOrigin()
205
+ ctx.provide('webApp', { getAdvertisedUrl: appRootUrl } satisfies WebApp)
206
+ ctx.plugin(FrontendStatic, { distIndex: internals.resolveDistIndex() })
207
+ if (config.surfaceContext) {
208
+ ctx.inject(['shellEnv'], (runtimeCtx) => {
209
+ runtimeCtx.shellEnv.register({
210
+ name: 'web-runtime',
211
+ variables: {
212
+ [RABI_WEB_URL]: { description: 'Advertised URL of the Rabi Harness Web GUI serving this session.' },
213
+ },
214
+ resolve: () => ({ [RABI_WEB_URL]: appRootUrl() }),
215
+ })
216
+ })
217
+ }
218
+ if (config.printUrl || handoffBrowser) {
219
+ ctx.inject(['connection'], (connectionCtx) => {
220
+ // The URL line and browser handoff are readiness signals: supervisors RPC
221
+ // as soon as they observe the line, while a browser requests the page as
222
+ // soon as it opens. Neither may run while sibling rows such as the /api
223
+ // route owner are still mounting. Await Loader settlement first; a
224
+ // hand-built tree without a Loader is already the complete tree.
225
+ const announceReady = (): void => {
226
+ if (ANNOUNCED_ROOTS.has(connectionCtx.root)) return
227
+ const webUrl = appRootUrl()
228
+ const authenticatedUrl = connectionCtx.connection.authenticatedUrl(webUrl)
229
+ ANNOUNCED_ROOTS.add(connectionCtx.root)
230
+ if (config.printUrl) {
231
+ console.log(`rabi web: ${authenticatedUrl}`)
232
+ }
233
+ if (handoffBrowser) {
234
+ console.log('rabi web: opening the default browser; pass --no-open to disable')
235
+ void internals.openBrowser(authenticatedUrl).catch((error: unknown) => {
236
+ const reason = error instanceof Error ? error.message : String(error)
237
+ console.error(`web-app: could not open the default browser because ${reason}; use the rabi web URL printed at startup`)
238
+ })
239
+ }
240
+ }
241
+ // This row's own activation can precede a sibling failure. The app owns
242
+ // readiness by waiting for its Loader tree, or announces at once in a
243
+ // hand-built tree without Loader.
244
+ const settled = connectionCtx.get('loader')?.await()
245
+ if (settled === undefined) announceReady()
246
+ else {
247
+ void settled.then(async () => {
248
+ await auditStartupEntries(connectionCtx.root, 'rabi web', () => {})
249
+ // The tree can be disposed while the boot was in flight (early
250
+ // SIGTERM); a URL line or browser tab for a dead server would only
251
+ // mislead, and reading torn-down services would turn a clean shutdown
252
+ // into a crash.
253
+ if (connectionCtx.get('webServer') !== undefined
254
+ && connectionCtx.get('connection') !== undefined) announceReady()
255
+ }).catch(() => {
256
+ // Boot owns the failure diagnostic; readiness remains unpublished.
257
+ })
258
+ }
259
+ })
260
+ }
261
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Canonical public HTTP(S) root parsing shared by this bundle's `publicUrl`
3
+ * config and its CLI startup provider.
4
+ * @module @unieai/rabi-web-app/public-url
5
+ */
6
+
7
+ /**
8
+ * Parse the advertised public HTTP(S) root of a prefix-stripping proxy
9
+ * deployment, rejecting the hazards WHATWG URL parsing would accept on its own,
10
+ * then normalize the path to end in `/`.
11
+ * @param value - advertised public HTTP(S) root.
12
+ * @param label - field name or CLI flag included in rejection messages.
13
+ * @returns the parsed URL with a trailing-slash pathname.
14
+ * @throws when the value is not a usable advertised root, naming the reason.
15
+ */
16
+ export function parsePublicUrl(value: string, label = 'publicUrl'): URL {
17
+ if (/[\u0000-\u0020\u007f]/u.test(value)) {
18
+ throw new Error(`${label} must not contain ASCII whitespace or control characters`)
19
+ }
20
+ if (!/^https?:\/\//iu.test(value)) {
21
+ throw new Error(`${label} must be an absolute http or https URL of the form http(s)://host[/prefix]`)
22
+ }
23
+ if (value.includes('?') || value.includes('#')) {
24
+ throw new Error(`${label} must not include a query or fragment (? or #)`)
25
+ }
26
+ // Userinfo lives in the raw authority (before the first path slash); the
27
+ // empty-authority forms (`https://`, `https:///ui`, `http:///ui`) fail here too.
28
+ const [authority = ''] = value.slice(value.indexOf('://') + 3).split(/[/\\]/, 1)
29
+ if (authority === '') {
30
+ throw new Error(`${label} must name a host after http:// or https://`)
31
+ }
32
+ if (authority.includes('@')) {
33
+ throw new Error(`${label} must not include credentials (a username or password before @, including an empty user)`)
34
+ }
35
+ const url = URL.parse(value)
36
+ if (url === null) throw new Error(`${label} must be an absolute http or https URL`)
37
+ if (!url.pathname.endsWith('/')) url.pathname += '/'
38
+ return url
39
+ }
package/src/startup.ts ADDED
@@ -0,0 +1,124 @@
1
+ /**
2
+ * The web app's command-line provider: it parses the `rabi --profile web` flag
3
+ * family (`--host`, `--port`, `--public-url`, `--trusted-host`, `--no-open`, TLS)
4
+ * and its `--help` text, then provides the immutable values as
5
+ * {@link WEB_STARTUP_SERVICE}. Ordinary rows inject that service before
6
+ * reading it from lazy config.
7
+ * @module @unieai/rabi-web-app/startup
8
+ */
9
+
10
+ import { Command } from 'commander'
11
+ import type { Context } from '@unieai/cordis'
12
+ import { parseCmdline } from '@unieai/rabi-cmdline'
13
+ import { isWildcardHost, type TlsConfig } from '@unieai/rabi-host-webserver'
14
+ import { parsePublicUrl } from './public-url.ts'
15
+
16
+ /** Stable Cordis plugin name. */
17
+ export const name = 'web-startup'
18
+
19
+ /** Services required before the flags can be resolved. */
20
+ export const inject = ['cmdlineArgs']
21
+
22
+ /** Service provided by this ordinary plugin and injected by flag-configured rows. */
23
+ export const WEB_STARTUP_SERVICE = 'webStartup'
24
+
25
+ /** What the web rows read from {@link WEB_STARTUP_SERVICE}. */
26
+ export interface WebStartupValues {
27
+ /** Whether this invocation opens the default browser after startup. */
28
+ openBrowser: boolean
29
+ /** `--host`, absent when the invocation did not name one. */
30
+ host?: string
31
+ /** `--port`, absent when the invocation did not name one. */
32
+ port?: number
33
+ /**
34
+ * `--public-url`, absent when not specified: the advertised HTTP(S) root.
35
+ * See [public deployments](../README.md#public-deployments).
36
+ */
37
+ publicUrl?: string
38
+ /** Explicit `--trusted-host` authorities, in argument order. */
39
+ trustedHosts: string[]
40
+ /** Server certificate chain and unencrypted private key supplied together. */
41
+ tls?: TlsConfig
42
+ }
43
+
44
+ /** The web flag family, as commander parsed it. */
45
+ interface WebOptions {
46
+ host?: string
47
+ open: boolean
48
+ port?: string
49
+ publicUrl?: string
50
+ trustedHost?: string[]
51
+ tlsCert?: string
52
+ tlsKey?: string
53
+ }
54
+
55
+ /**
56
+ * This app's command: its flags, its description, and its help text.
57
+ * @returns a fresh program, so one process can parse more than once (tests).
58
+ */
59
+ function webCommand(): Command {
60
+ return new Command()
61
+ .name('rabi --profile web')
62
+ .description('Serve the Rabi Harness browser UI.')
63
+ .helpOption('-h, --help', 'show this help')
64
+ .option('--host <host>', 'bind address: one concrete IPv4 or IPv6 literal of a local interface; wildcard addresses are rejected')
65
+ .option('--no-open', 'do not open the Web UI in the default browser')
66
+ .option('--port <port>', 'listen port; pass 0 to let the OS pick a free one')
67
+ .option('--public-url <url>', 'advertise this HTTP(S) root in the printed, opened, runtime-context, and RABI_WEB_URL forms; grants no trust')
68
+ .option('--trusted-host <authority...>', 'extra authority the /api browser-trust fence accepts (host or host:port; repeatable)')
69
+ .option('--tls-cert <file>', 'PEM server certificate chain; requires --tls-key')
70
+ .option('--tls-key <file>', 'unencrypted PEM private key; requires --tls-cert')
71
+ .addHelpText('after', `
72
+ Examples:
73
+ rabi --profile web serve on the composed host and port
74
+ rabi --profile web --no-open serve without opening a browser
75
+ rabi --profile web --port 8080 serve on another port
76
+ rabi --profile web --host 10.0.0.7 bind one local interface address
77
+ rabi --profile web --public-url https://app.example/ui/ --trusted-host app.example
78
+ advertise a prefix-stripping HTTPS proxy entry and admit its authority
79
+ rabi --profile web --tls-cert ./server-chain.pem --tls-key ./server-key.pem
80
+ serve HTTPS with an existing certificate and key
81
+ `)
82
+ }
83
+
84
+ /**
85
+ * Parse and provide the Web invocation as an ordinary Cordis service. The
86
+ * command's action publishes the flags this invocation named. Invalid flags,
87
+ * including an unpaired TLS certificate or key, are usage errors; rejection
88
+ * and `--help` provide no service.
89
+ * @param ctx - plugin context carrying the command line.
90
+ */
91
+ export function apply(ctx: Context): void {
92
+ const program = webCommand()
93
+ program.action(() => {
94
+ const options = program.opts<WebOptions>()
95
+ if (options.host !== undefined && isWildcardHost(options.host)) {
96
+ program.error(`error: --host ${options.host} is an unspecified (wildcard) address, which is not supported: binding every interface would expose remote code execution to the network; bind one concrete IPv4 or IPv6 address instead`)
97
+ }
98
+ if (options.port !== undefined && !/^\d+$/.test(options.port)) {
99
+ program.error(`error: --port must be a number, got ${JSON.stringify(options.port)}`)
100
+ }
101
+ let tls: TlsConfig | undefined
102
+ if (options.tlsCert !== undefined && options.tlsKey !== undefined) {
103
+ tls = { certFile: options.tlsCert, keyFile: options.tlsKey }
104
+ } else if (options.tlsCert !== undefined || options.tlsKey !== undefined) {
105
+ program.error('error: --tls-cert and --tls-key must be supplied together')
106
+ }
107
+ if (options.publicUrl !== undefined) {
108
+ try {
109
+ parsePublicUrl(options.publicUrl, '--public-url')
110
+ } catch (error) {
111
+ program.error(`error: ${(error as Error).message}`)
112
+ }
113
+ }
114
+ ctx.provide(WEB_STARTUP_SERVICE, {
115
+ openBrowser: options.open,
116
+ ...options.host !== undefined && { host: options.host },
117
+ ...options.port !== undefined && { port: Number(options.port) },
118
+ ...options.publicUrl !== undefined && { publicUrl: options.publicUrl },
119
+ ...tls !== undefined && { tls },
120
+ trustedHosts: options.trustedHost ?? [],
121
+ } satisfies WebStartupValues)
122
+ })
123
+ parseCmdline(ctx, program)
124
+ }