@unieai/rabi-api-session-controller 0.0.0-stage → 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.
Files changed (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -2
  3. package/lib/client.js +4 -0
  4. package/lib/index.js +4300 -0
  5. package/lib/typert.host.d.ts +3 -0
  6. package/lib/typert.host.js +5013 -0
  7. package/lib/typert.remote-client.d.ts +115 -0
  8. package/lib/typert.remote-client.js +2714 -0
  9. package/lib/types/agent.d.ts +164 -0
  10. package/lib/types/agent.js +484 -0
  11. package/lib/types/archived-session-gate.d.ts +33 -0
  12. package/lib/types/archived-session-gate.js +54 -0
  13. package/lib/types/assistant-stream.d.ts +26 -0
  14. package/lib/types/assistant-stream.js +82 -0
  15. package/lib/types/catalog.d.ts +24 -0
  16. package/lib/types/catalog.js +107 -0
  17. package/lib/types/client/contract/events.d.ts +102 -0
  18. package/lib/types/client/contract/events.js +111 -0
  19. package/lib/types/client/contract/session.d.ts +178 -0
  20. package/lib/types/client/contract/session.js +1 -0
  21. package/lib/types/client/contract/sessions.d.ts +162 -0
  22. package/lib/types/client/contract/sessions.js +1 -0
  23. package/lib/types/client/contract/snapshot.d.ts +84 -0
  24. package/lib/types/client/contract/snapshot.js +1 -0
  25. package/lib/types/client/index.d.ts +39 -0
  26. package/lib/types/client/index.js +60 -0
  27. package/lib/types/client/ordered-baseline.d.ts +12 -0
  28. package/lib/types/client/ordered-baseline.js +40 -0
  29. package/lib/types/client/scope.d.ts +46 -0
  30. package/lib/types/client/scope.js +46 -0
  31. package/lib/types/client/session-wire-event.d.ts +11 -0
  32. package/lib/types/client/session-wire-event.js +42 -0
  33. package/lib/types/client/sessions/assistant-stream.d.ts +56 -0
  34. package/lib/types/client/sessions/assistant-stream.js +182 -0
  35. package/lib/types/client/sessions/history-records.d.ts +22 -0
  36. package/lib/types/client/sessions/history-records.js +25 -0
  37. package/lib/types/client/sessions/lineage.d.ts +48 -0
  38. package/lib/types/client/sessions/lineage.js +55 -0
  39. package/lib/types/client/sessions/manager.d.ts +272 -0
  40. package/lib/types/client/sessions/manager.js +774 -0
  41. package/lib/types/client/sessions/notifier.d.ts +39 -0
  42. package/lib/types/client/sessions/notifier.js +97 -0
  43. package/lib/types/client/sessions/projection-store.d.ts +128 -0
  44. package/lib/types/client/sessions/projection-store.js +161 -0
  45. package/lib/types/client/sessions/remotes.d.ts +29 -0
  46. package/lib/types/client/sessions/remotes.js +7 -0
  47. package/lib/types/client/sessions/service.d.ts +263 -0
  48. package/lib/types/client/sessions/service.js +597 -0
  49. package/lib/types/client/sessions/session.d.ts +303 -0
  50. package/lib/types/client/sessions/session.js +991 -0
  51. package/lib/types/client/time-zone.d.ts +8 -0
  52. package/lib/types/client/time-zone.js +13 -0
  53. package/lib/types/client/transport.d.ts +77 -0
  54. package/lib/types/client/transport.js +130 -0
  55. package/lib/types/commands.d.ts +92 -0
  56. package/lib/types/commands.js +575 -0
  57. package/lib/types/continuation.d.ts +35 -0
  58. package/lib/types/continuation.js +47 -0
  59. package/lib/types/control.d.ts +20 -0
  60. package/lib/types/control.js +106 -0
  61. package/lib/types/file-references.d.ts +27 -0
  62. package/lib/types/file-references.js +68 -0
  63. package/lib/types/history/assistant-stream.d.ts +43 -0
  64. package/lib/types/history/assistant-stream.js +79 -0
  65. package/lib/types/history/controller.d.ts +104 -0
  66. package/lib/types/history/controller.js +293 -0
  67. package/lib/types/history/listener.d.ts +105 -0
  68. package/lib/types/history/listener.js +296 -0
  69. package/lib/types/history.d.ts +58 -0
  70. package/lib/types/history.js +152 -0
  71. package/lib/types/index.d.ts +262 -0
  72. package/lib/types/index.js +693 -0
  73. package/lib/types/list.d.ts +62 -0
  74. package/lib/types/list.js +343 -0
  75. package/lib/types/media-references.d.ts +18 -0
  76. package/lib/types/media-references.js +84 -0
  77. package/lib/types/remote-events.d.ts +8 -0
  78. package/lib/types/remote-events.js +1 -0
  79. package/lib/types/skill-catalog.d.ts +28 -0
  80. package/lib/types/skill-catalog.js +203 -0
  81. package/lib/types/state/controller.d.ts +45 -0
  82. package/lib/types/state/controller.js +288 -0
  83. package/lib/types/state/listener.d.ts +40 -0
  84. package/lib/types/state/listener.js +111 -0
  85. package/lib/types/types.d.ts +687 -0
  86. package/lib/types/types.js +5 -0
  87. package/lib/types/web/controller.d.ts +25 -0
  88. package/lib/types/web/controller.js +138 -0
  89. package/locale/de.json +6 -0
  90. package/locale/en.json +5 -0
  91. package/locale/es.json +6 -0
  92. package/locale/fr.json +6 -0
  93. package/locale/ja.json +6 -0
  94. package/locale/pt.json +6 -0
  95. package/locale/ru.json +6 -0
  96. package/locale/zh.json +6 -0
  97. package/package.json +119 -4
  98. package/src/agent.ts +474 -0
  99. package/src/archived-session-gate.ts +59 -0
  100. package/src/assistant-stream.ts +102 -0
  101. package/src/catalog.ts +117 -0
  102. package/src/client/contract/events.ts +205 -0
  103. package/src/client/contract/session.ts +174 -0
  104. package/src/client/contract/sessions.ts +169 -0
  105. package/src/client/contract/snapshot.ts +94 -0
  106. package/src/client/index.ts +149 -0
  107. package/src/client/ordered-baseline.ts +43 -0
  108. package/src/client/scope.ts +76 -0
  109. package/src/client/session-wire-event.ts +46 -0
  110. package/src/client/sessions/assistant-stream.ts +229 -0
  111. package/src/client/sessions/history-records.ts +35 -0
  112. package/src/client/sessions/lineage.ts +96 -0
  113. package/src/client/sessions/manager.ts +857 -0
  114. package/src/client/sessions/notifier.ts +97 -0
  115. package/src/client/sessions/projection-store.ts +244 -0
  116. package/src/client/sessions/remotes.ts +44 -0
  117. package/src/client/sessions/service.ts +741 -0
  118. package/src/client/sessions/session.ts +1055 -0
  119. package/src/client/time-zone.ts +14 -0
  120. package/src/client/transport.ts +247 -0
  121. package/src/commands.ts +602 -0
  122. package/src/continuation.ts +58 -0
  123. package/src/control.ts +121 -0
  124. package/src/file-references.ts +42 -0
  125. package/src/history/assistant-stream.ts +102 -0
  126. package/src/history/controller.ts +256 -0
  127. package/src/history/listener.ts +302 -0
  128. package/src/history.ts +189 -0
  129. package/src/index.ts +651 -0
  130. package/src/list.ts +382 -0
  131. package/src/media-references.ts +84 -0
  132. package/src/remote-events.ts +14 -0
  133. package/src/skill-catalog.ts +108 -0
  134. package/src/state/controller.ts +221 -0
  135. package/src/state/listener.ts +116 -0
  136. package/src/types.ts +720 -0
  137. package/src/web/controller.ts +78 -0
@@ -0,0 +1,25 @@
1
+ /** Web opening aggregation over one observation and a shared transforming buffer. */
2
+ import type { Context } from '@unieai/cordis';
3
+ import type { SessionObservation } from '@unieai/rabi-session-query';
4
+ import type { HistoryController } from '../history/controller.ts';
5
+ import type { SessionFollowFrame, SessionFollowRequest } from '../types.ts';
6
+ /** Combines opening data and consumes transformed listener output from one queue. */
7
+ export declare class WebController {
8
+ private readonly ctx;
9
+ private readonly historyController;
10
+ private readonly promote;
11
+ /**
12
+ * @param ctx - Host context carrying Session queries and identity projections.
13
+ * @param historyController - passive reading and listener construction.
14
+ * @param promote - background activation requested before an opening snapshot is delivered.
15
+ */
16
+ constructor(ctx: Context, historyController: HistoryController, promote: (observation: SessionObservation) => void);
17
+ /**
18
+ * Open a history snapshot and follow uncovered history and assistant notifications.
19
+ * @param request - Session identity, page budget, assistant output and optional activation (default false).
20
+ * @param signal - cancellation for opening and streaming.
21
+ * @returns an opening snapshot followed by uncovered queued increments.
22
+ */
23
+ follow(request: SessionFollowRequest, signal: AbortSignal): AsyncIterable<SessionFollowFrame>;
24
+ }
25
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1,138 @@
1
+ /** Web opening aggregation over one observation and a shared transforming buffer. */
2
+ var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
3
+ if (value !== null && value !== void 0) {
4
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
5
+ var dispose, inner;
6
+ if (async) {
7
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
8
+ dispose = value[Symbol.asyncDispose];
9
+ }
10
+ if (dispose === void 0) {
11
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
12
+ dispose = value[Symbol.dispose];
13
+ if (async) inner = dispose;
14
+ }
15
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
16
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
17
+ env.stack.push({ value: value, dispose: dispose, async: async });
18
+ }
19
+ else if (async) {
20
+ env.stack.push({ async: true });
21
+ }
22
+ return value;
23
+ };
24
+ var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
25
+ return function (env) {
26
+ function fail(e) {
27
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
28
+ env.hasError = true;
29
+ }
30
+ var r, s = 0;
31
+ function next() {
32
+ while (r = env.stack.pop()) {
33
+ try {
34
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
35
+ if (r.dispose) {
36
+ var result = r.dispose.call(r.value);
37
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
38
+ }
39
+ else s |= 1;
40
+ }
41
+ catch (e) {
42
+ fail(e);
43
+ }
44
+ }
45
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
46
+ if (env.hasError) throw env.error;
47
+ }
48
+ return next();
49
+ };
50
+ })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
51
+ var e = new Error(message);
52
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
53
+ });
54
+ import { remoteErrorOf } from '@unieai/rabi-typert-protocol';
55
+ import { addressId, rejectNotFound } from "../history.js";
56
+ import { EventListener, ListenerBuffer } from "../history/listener.js";
57
+ import { history, projections, resolveHistoryRequest, validateObservationAddress } from "../history/controller.js";
58
+ /** Combines opening data and consumes transformed listener output from one queue. */
59
+ export class WebController {
60
+ ctx;
61
+ historyController;
62
+ promote;
63
+ /**
64
+ * @param ctx - Host context carrying Session queries and identity projections.
65
+ * @param historyController - passive reading and listener construction.
66
+ * @param promote - background activation requested before an opening snapshot is delivered.
67
+ */
68
+ constructor(ctx, historyController, promote) {
69
+ this.ctx = ctx;
70
+ this.historyController = historyController;
71
+ this.promote = promote;
72
+ }
73
+ /**
74
+ * Open a history snapshot and follow uncovered history and assistant notifications.
75
+ * @param request - Session identity, page budget, assistant output and optional activation (default false).
76
+ * @param signal - cancellation for opening and streaming.
77
+ * @returns an opening snapshot followed by uncovered queued increments.
78
+ */
79
+ async *follow(request, signal) {
80
+ const env_1 = { stack: [], error: void 0, hasError: false };
81
+ try {
82
+ const sessionId = addressId(request.address);
83
+ const spec = resolveHistoryRequest(request);
84
+ const queue = __addDisposableResource(env_1, new ListenerBuffer(this.ctx, signal), false);
85
+ const listener = __addDisposableResource(env_1, new EventListener(this.ctx, sessionId, signal, queue), false);
86
+ const streams = this.historyController.streamsListener;
87
+ const assistantListener = __addDisposableResource(env_1, request.assistantStream === true
88
+ ? streams.bind(sessionId, signal, queue)
89
+ : undefined, false);
90
+ const observation = __addDisposableResource(env_1, await this.historyController.usingObservation({ sessionId, projection: true }, signal)
91
+ .catch((error) => {
92
+ if (remoteErrorOf(error)?.code === 'session/not-found')
93
+ rejectNotFound(request.address);
94
+ throw error;
95
+ }), false);
96
+ validateObservationAddress(request.address, observation);
97
+ let opening = {
98
+ type: 'snapshot',
99
+ header: { ...observation.header },
100
+ projections: projections(observation),
101
+ ...history(observation, spec),
102
+ };
103
+ listener.setCursor(opening.cursor);
104
+ if (assistantListener !== undefined) {
105
+ const { baseline: assistantStream, ordinal } = assistantListener.snapshot();
106
+ opening = { ...opening, assistantStream };
107
+ assistantListener.setOrdinalCut(ordinal);
108
+ }
109
+ // Increments come from the queue, so the opening ends this lease in every branch;
110
+ // activation continues on its own retained lease. Promotion starts before the opening is
111
+ // delivered, so a consumer that stops after the snapshot still gets the activation it asked for.
112
+ if (request.activate === true && !signal.aborted
113
+ && observation.header.origin !== 'subagent' && observation.source === 'prepared') {
114
+ const promotion = observation.retain();
115
+ observation[Symbol.dispose]();
116
+ try {
117
+ this.promote(promotion);
118
+ }
119
+ catch (error) {
120
+ promotion[Symbol.dispose]();
121
+ throw error;
122
+ }
123
+ }
124
+ else {
125
+ observation[Symbol.dispose]();
126
+ }
127
+ yield opening;
128
+ yield* queue.items();
129
+ }
130
+ catch (e_1) {
131
+ env_1.error = e_1;
132
+ env_1.hasError = true;
133
+ }
134
+ finally {
135
+ __disposeResources(env_1);
136
+ }
137
+ }
138
+ }
package/locale/de.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Sitzungssteuerungsschnittstelle",
4
+ "description": "Bietet Clients Funktionen zum Lesen von Sitzungen, zur Laufsteuerung und zur Statusaktualisierung."
5
+ }
6
+ }
package/locale/en.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "api-session-controller"
4
+ }
5
+ }
package/locale/es.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "interfaz de control de sesión",
4
+ "description": "Proporciona capacidades de lectura de sesiones, control de ejecución y actualización de estado a los clientes."
5
+ }
6
+ }
package/locale/fr.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "interface de contrôle de session",
4
+ "description": "Fournit des fonctionnalités de lecture de session, de contrôle d’exécution et de mise à jour de statut aux clients."
5
+ }
6
+ }
package/locale/ja.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "セッション制御 API",
4
+ "description": "セッションの読み取り、実行制御、状態更新をクライアントに提供します。"
5
+ }
6
+ }
package/locale/pt.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "interface de controle de sessão",
4
+ "description": "Fornece leitura de sessão, controle de execução e recursos de atualização de status aos clientes."
5
+ }
6
+ }
package/locale/ru.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "интерфейс управления сеансом",
4
+ "description": "Предоставляет клиентам возможности чтения сеанса, управления запуском и обновления статуса."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "会话控制接口",
4
+ "description": "向客户端提供会话读取、运行控制和状态更新能力。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,121 @@
1
1
  {
2
2
  "name": "@unieai/rabi-api-session-controller",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "Session Remote commands, cold reads, and live control transport",
4
+ "version": "0.2.2-rc.5",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "type": "module",
9
+ "main": "lib/index.js",
10
+ "types": "lib/types/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./lib/types/index.d.ts",
14
+ "default": "./lib/index.js"
15
+ },
16
+ "./types": {
17
+ "types": "./lib/types/types.d.ts",
18
+ "default": "./lib/types/types.js"
19
+ },
20
+ "./remote-events": {
21
+ "types": "./lib/types/remote-events.d.ts",
22
+ "default": "./lib/types/remote-events.js"
23
+ },
24
+ "./client": {
25
+ "types": "./lib/types/client/index.d.ts",
26
+ "default": "./lib/client.js"
27
+ },
28
+ "./typert": {
29
+ "types": "./lib/typert.host.d.ts",
30
+ "default": "./lib/typert.host.js"
31
+ },
32
+ "./remote": {
33
+ "types": "./lib/typert.remote-client.d.ts",
34
+ "default": "./lib/typert.remote-client.js"
35
+ },
36
+ "./src/*": "./src/*",
37
+ "./package.json": "./package.json",
38
+ "./locale/*.json": "./locale/*.json"
39
+ },
40
+ "rabi": {
41
+ "client": {
42
+ "external": [
43
+ "@unieai/rabi-api-gateway/client"
44
+ ],
45
+ "inject": [
46
+ "@unieai/rabi-api-gateway",
47
+ "@unieai/rabi-client-file-upload"
48
+ ],
49
+ "platform": "web"
50
+ }
51
+ },
52
+ "files": [
53
+ "locale/*.json",
54
+ "lib/index.js",
55
+ "lib/client.js",
56
+ "lib/types/**/*.js",
57
+ "lib/types/**/*.d.ts",
58
+ "lib/types/**/*.d.ts.map",
59
+ "lib/**/*.js.map",
60
+ "lib/typert.host.js",
61
+ "lib/typert.host.d.ts",
62
+ "lib/typert.remote-client.js",
63
+ "lib/typert.remote-client.d.ts",
64
+ "lib/typert.remote-client.d.ts.map",
65
+ "src",
66
+ "README.md"
67
+ ],
68
+ "license": "MIT",
69
+ "dependencies": {
70
+ "@unieai/rabi-brand": "0.2.2-rc.5",
71
+ "@unieai/rabi-deque": "0.2.2-rc.5",
72
+ "@unieai/rabi-timeout": "0.2.2-rc.5",
73
+ "@unieai/schemastery": "3.19.0",
74
+ "mime-types": "^3.0.2",
75
+ "zod": "4.6.6"
76
+ },
77
+ "peerDependencies": {
78
+ "@unieai/cordis": "4.1.0",
79
+ "@unieai/rabi-agent": "0.2.2-rc.5",
80
+ "@unieai/rabi-agent-default-model": "0.2.2-rc.5",
81
+ "@unieai/rabi-agent-preset-registry": "0.2.2-rc.5",
82
+ "@unieai/rabi-api-gateway": "0.2.2-rc.5",
83
+ "@unieai/rabi-attachment": "0.2.2-rc.5",
84
+ "@unieai/rabi-client-connection": "0.2.2-rc.5",
85
+ "@unieai/rabi-client-file-upload": "0.2.2-rc.5",
86
+ "@unieai/rabi-commands": "0.2.2-rc.5",
87
+ "@unieai/rabi-credentials": "0.2.2-rc.5",
88
+ "@unieai/rabi-file-reference": "0.2.2-rc.5",
89
+ "@unieai/rabi-fs": "0.2.2-rc.5",
90
+ "@unieai/rabi-llm": "0.2.2-rc.5",
91
+ "@unieai/rabi-native-command": "0.2.2-rc.5",
92
+ "@unieai/rabi-scope": "0.2.2-rc.5",
93
+ "@unieai/rabi-session": "0.2.2-rc.5",
94
+ "@unieai/rabi-session-persistence": "0.2.2-rc.5",
95
+ "@unieai/rabi-session-projection": "0.2.2-rc.5",
96
+ "@unieai/rabi-session-projection-cache": "0.2.2-rc.5",
97
+ "@unieai/rabi-session-query": "0.2.2-rc.5",
98
+ "@unieai/rabi-session-title": "0.2.2-rc.5",
99
+ "@unieai/rabi-settings": "0.2.2-rc.5",
100
+ "@unieai/rabi-skill": "0.2.2-rc.5",
101
+ "@unieai/rabi-subagent": "0.2.2-rc.5",
102
+ "@unieai/rabi-typert-protocol": "0.2.2-rc.5",
103
+ "@unieai/rabi-typert-registry": "0.2.2-rc.5",
104
+ "@unieai/rabi-util-time": "0.2.2-rc.5",
105
+ "@unieai/rabi-util-values": "0.2.2-rc.5",
106
+ "@unieai/rabi-util-workspace-path": "0.2.2-rc.5",
107
+ "@unieai/rabi-workspace": "0.2.2-rc.5",
108
+ "@unieai/rabi-working-directory": "0.2.2-rc.5"
109
+ },
110
+ "peerDependenciesMeta": {
111
+ "@unieai/rabi-session-persistence": {
112
+ "optional": true
113
+ },
114
+ "@unieai/rabi-session-projection-cache": {
115
+ "optional": true
116
+ },
117
+ "@unieai/rabi-settings": {
118
+ "optional": true
119
+ }
120
+ }
121
+ }