@labacacia/nps-sdk 1.0.0-alpha.2 → 1.0.0-alpha.3

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 (232) hide show
  1. package/CHANGELOG.cn.md +20 -2
  2. package/CHANGELOG.md +20 -2
  3. package/README.cn.md +1 -1
  4. package/README.md +1 -1
  5. package/dist/core/anchor-cache.d.ts +0 -0
  6. package/dist/core/anchor-cache.d.ts.map +0 -0
  7. package/dist/core/cache.d.ts +0 -0
  8. package/dist/core/cache.d.ts.map +0 -0
  9. package/dist/core/canonical-json.d.ts +0 -0
  10. package/dist/core/canonical-json.d.ts.map +0 -0
  11. package/dist/core/codec.d.ts +0 -0
  12. package/dist/core/codec.d.ts.map +0 -0
  13. package/dist/core/codecs/index.d.ts +0 -0
  14. package/dist/core/codecs/index.d.ts.map +0 -0
  15. package/dist/core/codecs/ncp-codec.d.ts +0 -0
  16. package/dist/core/codecs/ncp-codec.d.ts.map +0 -0
  17. package/dist/core/codecs/tier1-json-codec.d.ts +0 -0
  18. package/dist/core/codecs/tier1-json-codec.d.ts.map +0 -0
  19. package/dist/core/codecs/tier2-msgpack-codec.d.ts +0 -0
  20. package/dist/core/codecs/tier2-msgpack-codec.d.ts.map +0 -0
  21. package/dist/core/crypto-provider.d.ts +0 -0
  22. package/dist/core/crypto-provider.d.ts.map +0 -0
  23. package/dist/core/exceptions.d.ts +0 -0
  24. package/dist/core/exceptions.d.ts.map +0 -0
  25. package/dist/core/frame-header.d.ts +0 -0
  26. package/dist/core/frame-header.d.ts.map +0 -0
  27. package/dist/core/frame-registry.d.ts +0 -0
  28. package/dist/core/frame-registry.d.ts.map +0 -0
  29. package/dist/core/frames.d.ts +0 -0
  30. package/dist/core/frames.d.ts.map +0 -0
  31. package/dist/core/index.cjs +90 -9
  32. package/dist/core/index.cjs.map +1 -1
  33. package/dist/core/index.d.ts +0 -0
  34. package/dist/core/index.d.ts.map +0 -0
  35. package/dist/core/index.js +405 -21
  36. package/dist/core/index.js.map +1 -1
  37. package/dist/core/registry.d.ts +0 -0
  38. package/dist/core/registry.d.ts.map +0 -0
  39. package/dist/core/status-codes.d.ts +0 -0
  40. package/dist/core/status-codes.d.ts.map +0 -0
  41. package/dist/index.cjs +3 -1551
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.d.ts +1 -1
  44. package/dist/index.d.ts.map +0 -0
  45. package/dist/index.js +5 -9
  46. package/dist/index.js.map +1 -1
  47. package/dist/ncp/frames/anchor-frame.d.ts +0 -0
  48. package/dist/ncp/frames/anchor-frame.d.ts.map +0 -0
  49. package/dist/ncp/frames/caps-frame.d.ts +0 -0
  50. package/dist/ncp/frames/caps-frame.d.ts.map +0 -0
  51. package/dist/ncp/frames/diff-frame.d.ts +0 -0
  52. package/dist/ncp/frames/diff-frame.d.ts.map +0 -0
  53. package/dist/ncp/frames/error-frame.d.ts +0 -0
  54. package/dist/ncp/frames/error-frame.d.ts.map +0 -0
  55. package/dist/ncp/frames/hello-frame.d.ts +0 -0
  56. package/dist/ncp/frames/hello-frame.d.ts.map +0 -0
  57. package/dist/ncp/frames/stream-frame.d.ts +0 -0
  58. package/dist/ncp/frames/stream-frame.d.ts.map +0 -0
  59. package/dist/ncp/frames.d.ts +0 -0
  60. package/dist/ncp/frames.d.ts.map +0 -0
  61. package/dist/ncp/handshake.d.ts +0 -0
  62. package/dist/ncp/handshake.d.ts.map +0 -0
  63. package/dist/ncp/index.cjs +364 -164
  64. package/dist/ncp/index.cjs.map +1 -1
  65. package/dist/ncp/index.d.ts +0 -0
  66. package/dist/ncp/index.d.ts.map +0 -0
  67. package/dist/ncp/index.js +368 -12
  68. package/dist/ncp/index.js.map +1 -1
  69. package/dist/ncp/ncp-error-codes.d.ts +0 -0
  70. package/dist/ncp/ncp-error-codes.d.ts.map +0 -0
  71. package/dist/ncp/ncp-patch-format.d.ts +0 -0
  72. package/dist/ncp/ncp-patch-format.d.ts.map +0 -0
  73. package/dist/ncp/registry.d.ts +0 -0
  74. package/dist/ncp/registry.d.ts.map +0 -0
  75. package/dist/ncp/stream-manager.d.ts +0 -0
  76. package/dist/ncp/stream-manager.d.ts.map +0 -0
  77. package/dist/ndp/frames.d.ts +0 -0
  78. package/dist/ndp/frames.d.ts.map +0 -0
  79. package/dist/ndp/index.cjs +0 -0
  80. package/dist/ndp/index.cjs.map +0 -0
  81. package/dist/ndp/index.d.ts +0 -0
  82. package/dist/ndp/index.d.ts.map +0 -0
  83. package/dist/ndp/index.js +223 -6
  84. package/dist/ndp/index.js.map +1 -1
  85. package/dist/ndp/ndp-registry.d.ts +0 -0
  86. package/dist/ndp/ndp-registry.d.ts.map +0 -0
  87. package/dist/ndp/registry.d.ts +0 -0
  88. package/dist/ndp/registry.d.ts.map +0 -0
  89. package/dist/ndp/validator.d.ts +0 -0
  90. package/dist/ndp/validator.d.ts.map +0 -0
  91. package/dist/nip/frames.d.ts +0 -0
  92. package/dist/nip/frames.d.ts.map +0 -0
  93. package/dist/nip/identity.d.ts +0 -0
  94. package/dist/nip/identity.d.ts.map +0 -0
  95. package/dist/nip/index.cjs +0 -0
  96. package/dist/nip/index.cjs.map +0 -0
  97. package/dist/nip/index.d.ts +0 -0
  98. package/dist/nip/index.d.ts.map +0 -0
  99. package/dist/nip/index.js +187 -5
  100. package/dist/nip/index.js.map +1 -1
  101. package/dist/nip/registry.d.ts +0 -0
  102. package/dist/nip/registry.d.ts.map +0 -0
  103. package/dist/nop/client.d.ts +0 -0
  104. package/dist/nop/client.d.ts.map +0 -0
  105. package/dist/nop/frames.d.ts +0 -0
  106. package/dist/nop/frames.d.ts.map +0 -0
  107. package/dist/nop/index.cjs +62 -1
  108. package/dist/nop/index.cjs.map +1 -1
  109. package/dist/nop/index.d.ts +0 -0
  110. package/dist/nop/index.d.ts.map +0 -0
  111. package/dist/nop/index.js +789 -6
  112. package/dist/nop/index.js.map +1 -1
  113. package/dist/nop/models.d.ts +0 -0
  114. package/dist/nop/models.d.ts.map +0 -0
  115. package/dist/nop/nop-types.d.ts +0 -0
  116. package/dist/nop/nop-types.d.ts.map +0 -0
  117. package/dist/nop/registry.d.ts +0 -0
  118. package/dist/nop/registry.d.ts.map +0 -0
  119. package/dist/nwp/client.d.ts +0 -0
  120. package/dist/nwp/client.d.ts.map +0 -0
  121. package/dist/nwp/frames.d.ts +0 -0
  122. package/dist/nwp/frames.d.ts.map +0 -0
  123. package/dist/nwp/index.cjs +64 -2
  124. package/dist/nwp/index.cjs.map +1 -1
  125. package/dist/nwp/index.d.ts +0 -0
  126. package/dist/nwp/index.d.ts.map +0 -0
  127. package/dist/nwp/index.js +693 -5
  128. package/dist/nwp/index.js.map +1 -1
  129. package/dist/nwp/registry.d.ts +0 -0
  130. package/dist/nwp/registry.d.ts.map +0 -0
  131. package/dist/setup.d.ts +0 -0
  132. package/dist/setup.d.ts.map +0 -0
  133. package/package.json +1 -1
  134. package/src/index.ts +1 -1
  135. package/.npmrc.publish +0 -1
  136. package/dist/codec-CmHeovTV.d.cts +0 -120
  137. package/dist/codec-CmHeovTV.d.ts +0 -120
  138. package/dist/core/anchor-cache.js +0 -104
  139. package/dist/core/anchor-cache.js.map +0 -1
  140. package/dist/core/cache.js +0 -80
  141. package/dist/core/cache.js.map +0 -1
  142. package/dist/core/canonical-json.js +0 -44
  143. package/dist/core/canonical-json.js.map +0 -1
  144. package/dist/core/codec.js +0 -119
  145. package/dist/core/codec.js.map +0 -1
  146. package/dist/core/codecs/index.js +0 -6
  147. package/dist/core/codecs/index.js.map +0 -1
  148. package/dist/core/codecs/ncp-codec.js +0 -93
  149. package/dist/core/codecs/ncp-codec.js.map +0 -1
  150. package/dist/core/codecs/tier1-json-codec.js +0 -28
  151. package/dist/core/codecs/tier1-json-codec.js.map +0 -1
  152. package/dist/core/codecs/tier2-msgpack-codec.js +0 -26
  153. package/dist/core/codecs/tier2-msgpack-codec.js.map +0 -1
  154. package/dist/core/crypto-provider.js +0 -10
  155. package/dist/core/crypto-provider.js.map +0 -1
  156. package/dist/core/exceptions.js +0 -52
  157. package/dist/core/exceptions.js.map +0 -1
  158. package/dist/core/frame-header.js +0 -185
  159. package/dist/core/frame-header.js.map +0 -1
  160. package/dist/core/frame-registry.js +0 -63
  161. package/dist/core/frame-registry.js.map +0 -1
  162. package/dist/core/frames.js +0 -154
  163. package/dist/core/frames.js.map +0 -1
  164. package/dist/core/index.d.cts +0 -41
  165. package/dist/core/registry.js +0 -17
  166. package/dist/core/registry.js.map +0 -1
  167. package/dist/core/status-codes.js +0 -38
  168. package/dist/core/status-codes.js.map +0 -1
  169. package/dist/frames-B3qLdl_g.d.cts +0 -77
  170. package/dist/frames-Ff7-ZPUl.d.ts +0 -77
  171. package/dist/index.d.cts +0 -21
  172. package/dist/ncp/frames/anchor-frame.js +0 -54
  173. package/dist/ncp/frames/anchor-frame.js.map +0 -1
  174. package/dist/ncp/frames/caps-frame.js +0 -29
  175. package/dist/ncp/frames/caps-frame.js.map +0 -1
  176. package/dist/ncp/frames/diff-frame.js +0 -37
  177. package/dist/ncp/frames/diff-frame.js.map +0 -1
  178. package/dist/ncp/frames/error-frame.js +0 -13
  179. package/dist/ncp/frames/error-frame.js.map +0 -1
  180. package/dist/ncp/frames/hello-frame.js +0 -25
  181. package/dist/ncp/frames/hello-frame.js.map +0 -1
  182. package/dist/ncp/frames/stream-frame.js +0 -18
  183. package/dist/ncp/frames/stream-frame.js.map +0 -1
  184. package/dist/ncp/frames.js +0 -192
  185. package/dist/ncp/frames.js.map +0 -1
  186. package/dist/ncp/handshake.js +0 -80
  187. package/dist/ncp/handshake.js.map +0 -1
  188. package/dist/ncp/index.d.cts +0 -6
  189. package/dist/ncp/ncp-error-codes.js +0 -32
  190. package/dist/ncp/ncp-error-codes.js.map +0 -1
  191. package/dist/ncp/ncp-patch-format.js +0 -13
  192. package/dist/ncp/ncp-patch-format.js.map +0 -1
  193. package/dist/ncp/registry.js +0 -13
  194. package/dist/ncp/registry.js.map +0 -1
  195. package/dist/ncp/stream-manager.js +0 -163
  196. package/dist/ncp/stream-manager.js.map +0 -1
  197. package/dist/ndp/frames.js +0 -87
  198. package/dist/ndp/frames.js.map +0 -1
  199. package/dist/ndp/index.d.cts +0 -86
  200. package/dist/ndp/ndp-registry.js +0 -79
  201. package/dist/ndp/ndp-registry.js.map +0 -1
  202. package/dist/ndp/registry.js +0 -10
  203. package/dist/ndp/registry.js.map +0 -1
  204. package/dist/ndp/validator.js +0 -48
  205. package/dist/ndp/validator.js.map +0 -1
  206. package/dist/nip/frames.js +0 -81
  207. package/dist/nip/frames.js.map +0 -1
  208. package/dist/nip/identity.js +0 -94
  209. package/dist/nip/identity.js.map +0 -1
  210. package/dist/nip/index.d.cts +0 -65
  211. package/dist/nip/registry.js +0 -10
  212. package/dist/nip/registry.js.map +0 -1
  213. package/dist/nop/client.js +0 -90
  214. package/dist/nop/client.js.map +0 -1
  215. package/dist/nop/frames.js +0 -148
  216. package/dist/nop/frames.js.map +0 -1
  217. package/dist/nop/index.d.cts +0 -155
  218. package/dist/nop/models.js +0 -50
  219. package/dist/nop/models.js.map +0 -1
  220. package/dist/nop/nop-types.js +0 -44
  221. package/dist/nop/nop-types.js.map +0 -1
  222. package/dist/nop/registry.js +0 -11
  223. package/dist/nop/registry.js.map +0 -1
  224. package/dist/nwp/client.js +0 -101
  225. package/dist/nwp/client.js.map +0 -1
  226. package/dist/nwp/frames.js +0 -81
  227. package/dist/nwp/frames.js.map +0 -1
  228. package/dist/nwp/index.d.cts +0 -65
  229. package/dist/nwp/registry.js +0 -9
  230. package/dist/nwp/registry.js.map +0 -1
  231. package/dist/setup.js +0 -29
  232. package/dist/setup.js.map +0 -1
@@ -1,148 +0,0 @@
1
- // Copyright 2026 INNO LOTUS PTY LTD
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { EncodingTier, FrameType } from "../core/frames.js";
4
- // ── TaskFrame ─────────────────────────────────────────────────────────────────
5
- export class TaskFrame {
6
- taskId;
7
- dag;
8
- timeoutMs;
9
- callbackUrl;
10
- context;
11
- priority;
12
- depth;
13
- frameType = FrameType.TASK;
14
- preferredTier = EncodingTier.MSGPACK;
15
- constructor(taskId, dag, timeoutMs, callbackUrl, context, priority, depth) {
16
- this.taskId = taskId;
17
- this.dag = dag;
18
- this.timeoutMs = timeoutMs;
19
- this.callbackUrl = callbackUrl;
20
- this.context = context;
21
- this.priority = priority;
22
- this.depth = depth;
23
- }
24
- toDict() {
25
- return {
26
- task_id: this.taskId,
27
- dag: this.dag,
28
- timeout_ms: this.timeoutMs ?? null,
29
- callback_url: this.callbackUrl ?? null,
30
- context: this.context ?? null,
31
- priority: this.priority ?? null,
32
- depth: this.depth ?? null,
33
- };
34
- }
35
- static fromDict(data) {
36
- return new TaskFrame(data["task_id"], data["dag"], data["timeout_ms"] ?? undefined, data["callback_url"] ?? undefined, data["context"] ?? undefined, data["priority"] ?? undefined, data["depth"] ?? undefined);
37
- }
38
- }
39
- // ── DelegateFrame ─────────────────────────────────────────────────────────────
40
- export class DelegateFrame {
41
- taskId;
42
- subtaskId;
43
- action;
44
- agentNid;
45
- inputs;
46
- params;
47
- idempotencyKey;
48
- frameType = FrameType.DELEGATE;
49
- preferredTier = EncodingTier.MSGPACK;
50
- constructor(taskId, subtaskId, action, agentNid, inputs, params, idempotencyKey) {
51
- this.taskId = taskId;
52
- this.subtaskId = subtaskId;
53
- this.action = action;
54
- this.agentNid = agentNid;
55
- this.inputs = inputs;
56
- this.params = params;
57
- this.idempotencyKey = idempotencyKey;
58
- }
59
- toDict() {
60
- return {
61
- task_id: this.taskId,
62
- subtask_id: this.subtaskId,
63
- action: this.action,
64
- agent_nid: this.agentNid,
65
- inputs: this.inputs ?? null,
66
- params: this.params ?? null,
67
- idempotency_key: this.idempotencyKey ?? null,
68
- };
69
- }
70
- static fromDict(data) {
71
- return new DelegateFrame(data["task_id"], data["subtask_id"], data["action"], data["agent_nid"], data["inputs"] ?? undefined, data["params"] ?? undefined, data["idempotency_key"] ?? undefined);
72
- }
73
- }
74
- // ── SyncFrame ─────────────────────────────────────────────────────────────────
75
- export class SyncFrame {
76
- taskId;
77
- syncId;
78
- waitFor;
79
- minRequired;
80
- aggregate;
81
- timeoutMs;
82
- frameType = FrameType.SYNC;
83
- preferredTier = EncodingTier.MSGPACK;
84
- constructor(taskId, syncId, waitFor, minRequired = 0, aggregate = "merge", timeoutMs) {
85
- this.taskId = taskId;
86
- this.syncId = syncId;
87
- this.waitFor = waitFor;
88
- this.minRequired = minRequired;
89
- this.aggregate = aggregate;
90
- this.timeoutMs = timeoutMs;
91
- }
92
- toDict() {
93
- return {
94
- task_id: this.taskId,
95
- sync_id: this.syncId,
96
- wait_for: this.waitFor,
97
- min_required: this.minRequired,
98
- aggregate: this.aggregate,
99
- timeout_ms: this.timeoutMs ?? null,
100
- };
101
- }
102
- static fromDict(data) {
103
- return new SyncFrame(data["task_id"], data["sync_id"], data["wait_for"], data["min_required"] ?? 0, data["aggregate"] ?? "merge", data["timeout_ms"] ?? undefined);
104
- }
105
- }
106
- // ── AlignStreamFrame ──────────────────────────────────────────────────────────
107
- export class AlignStreamFrame {
108
- streamId;
109
- taskId;
110
- subtaskId;
111
- seq;
112
- isFinal;
113
- senderNid;
114
- data;
115
- error;
116
- windowSize;
117
- frameType = FrameType.ALIGN_STREAM;
118
- preferredTier = EncodingTier.MSGPACK;
119
- constructor(streamId, taskId, subtaskId, seq, isFinal, senderNid, data, error, windowSize) {
120
- this.streamId = streamId;
121
- this.taskId = taskId;
122
- this.subtaskId = subtaskId;
123
- this.seq = seq;
124
- this.isFinal = isFinal;
125
- this.senderNid = senderNid;
126
- this.data = data;
127
- this.error = error;
128
- this.windowSize = windowSize;
129
- }
130
- toDict() {
131
- return {
132
- stream_id: this.streamId,
133
- task_id: this.taskId,
134
- subtask_id: this.subtaskId,
135
- seq: this.seq,
136
- is_final: this.isFinal,
137
- sender_nid: this.senderNid,
138
- data: this.data ?? null,
139
- error: this.error ? { error_code: this.error.errorCode, message: this.error.message ?? null } : null,
140
- window_size: this.windowSize ?? null,
141
- };
142
- }
143
- static fromDict(data) {
144
- const rawError = data["error"];
145
- return new AlignStreamFrame(data["stream_id"], data["task_id"], data["subtask_id"], data["seq"], data["is_final"], data["sender_nid"], data["data"] ?? undefined, rawError ? { errorCode: rawError.error_code, ...(rawError.message != null ? { message: rawError.message } : {}) } : undefined, data["window_size"] ?? undefined);
146
- }
147
- }
148
- //# sourceMappingURL=frames.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"frames.js","sourceRoot":"","sources":["../../src/nop/frames.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAI5D,iFAAiF;AAEjF,MAAM,OAAO,SAAS;IAKF;IACA;IACA;IACA;IACA;IACA;IACA;IAVT,SAAS,GAAO,SAAS,CAAC,IAAI,CAAC;IAC/B,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC;IAE9C,YACkB,MAAoB,EACpB,GAAqB,EACrB,SAAoB,EACpB,WAAoB,EACpB,OAAyB,EACzB,QAA0B,EAC1B,KAAoB;QANpB,WAAM,GAAN,MAAM,CAAc;QACpB,QAAG,GAAH,GAAG,CAAkB;QACrB,cAAS,GAAT,SAAS,CAAW;QACpB,gBAAW,GAAX,WAAW,CAAS;QACpB,YAAO,GAAP,OAAO,CAAkB;QACzB,aAAQ,GAAR,QAAQ,CAAkB;QAC1B,UAAK,GAAL,KAAK,CAAe;IACnC,CAAC;IAEJ,MAAM;QACJ,OAAO;YACL,OAAO,EAAO,IAAI,CAAC,MAAM;YACzB,GAAG,EAAW,IAAI,CAAC,GAAG;YACtB,UAAU,EAAI,IAAI,CAAC,SAAS,IAAM,IAAI;YACtC,YAAY,EAAE,IAAI,CAAC,WAAW,IAAI,IAAI;YACtC,OAAO,EAAO,IAAI,CAAC,OAAO,IAAQ,IAAI;YACtC,QAAQ,EAAM,IAAI,CAAC,QAAQ,IAAO,IAAI;YACtC,KAAK,EAAS,IAAI,CAAC,KAAK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E,CAAC,CAAC,CAAC,IAAI;YAC1G,WAAW,EAAE,IAAI,CAAC,UAAU,IAAK,IAAI;SACtC,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,IAA6B;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAoD,CAAC;QAClF,OAAO,IAAI,gBAAgB,CACzB,IAAI,CAAC,WAAW,CAAY,EAC5B,IAAI,CAAC,SAAS,CAAc,EAC5B,IAAI,CAAC,YAAY,CAAW,EAC5B,IAAI,CAAC,KAAK,CAAkB,EAC5B,IAAI,CAAC,UAAU,CAAc,EAC7B,IAAI,CAAC,YAAY,CAAW,EAC3B,IAAI,CAAC,MAAM,CAA2C,IAAI,SAAS,EACpE,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,QAAQ,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAC5H,IAAI,CAAC,aAAa,CAAmB,IAAI,SAAS,CACpD,CAAC;IACJ,CAAC;CACF"}
@@ -1,155 +0,0 @@
1
- import { N as NpsFrame, g as FrameType, c as EncodingTier, F as FrameRegistry } from '../codec-CmHeovTV.cjs';
2
-
3
- declare enum TaskState {
4
- PENDING = "pending",
5
- PREFLIGHT = "preflight",
6
- RUNNING = "running",
7
- WAITING_SYNC = "waiting_sync",
8
- COMPLETED = "completed",
9
- FAILED = "failed",
10
- CANCELLED = "cancelled",
11
- SKIPPED = "skipped"
12
- }
13
- declare enum TaskPriority {
14
- LOW = "low",
15
- NORMAL = "normal",
16
- HIGH = "high"
17
- }
18
- declare enum BackoffStrategy {
19
- FIXED = "fixed",
20
- LINEAR = "linear",
21
- EXPONENTIAL = "exponential"
22
- }
23
- declare enum AggregateStrategy {
24
- MERGE = "merge",
25
- FIRST = "first",
26
- FASTEST_K = "fastest_k",
27
- ALL = "all"
28
- }
29
- interface RetryPolicy {
30
- maxRetries: number;
31
- backoff: BackoffStrategy;
32
- baseDelayMs?: number;
33
- maxDelayMs?: number;
34
- }
35
- declare function computeDelayMs(policy: RetryPolicy, attempt: number): number;
36
- interface TaskContext {
37
- sessionKey?: string;
38
- requesterNid?: string;
39
- traceId?: string;
40
- }
41
- interface DagNode {
42
- id: string;
43
- action: string;
44
- agent: string;
45
- inputFrom?: readonly string[];
46
- inputMapping?: Record<string, string>;
47
- timeoutMs?: number;
48
- retryPolicy?: RetryPolicy;
49
- condition?: string;
50
- minRequired?: number;
51
- }
52
- interface DagEdge {
53
- from: string;
54
- to: string;
55
- }
56
- interface TaskDag {
57
- nodes: readonly DagNode[];
58
- edges: readonly DagEdge[];
59
- }
60
-
61
- declare class TaskFrame implements NpsFrame {
62
- readonly taskId: string;
63
- readonly dag: TaskDag;
64
- readonly timeoutMs?: number | undefined;
65
- readonly callbackUrl?: string | undefined;
66
- readonly context?: TaskContext | undefined;
67
- readonly priority?: TaskPriority | undefined;
68
- readonly depth?: number | undefined;
69
- readonly frameType = FrameType.TASK;
70
- readonly preferredTier = EncodingTier.MSGPACK;
71
- constructor(taskId: string, dag: TaskDag, timeoutMs?: number | undefined, callbackUrl?: string | undefined, context?: TaskContext | undefined, priority?: TaskPriority | undefined, depth?: number | undefined);
72
- toDict(): Record<string, unknown>;
73
- static fromDict(data: Record<string, unknown>): TaskFrame;
74
- }
75
- declare class DelegateFrame implements NpsFrame {
76
- readonly taskId: string;
77
- readonly subtaskId: string;
78
- readonly action: string;
79
- readonly agentNid: string;
80
- readonly inputs?: Record<string, unknown> | undefined;
81
- readonly params?: Record<string, unknown> | undefined;
82
- readonly idempotencyKey?: string | undefined;
83
- readonly frameType = FrameType.DELEGATE;
84
- readonly preferredTier = EncodingTier.MSGPACK;
85
- constructor(taskId: string, subtaskId: string, action: string, agentNid: string, inputs?: Record<string, unknown> | undefined, params?: Record<string, unknown> | undefined, idempotencyKey?: string | undefined);
86
- toDict(): Record<string, unknown>;
87
- static fromDict(data: Record<string, unknown>): DelegateFrame;
88
- }
89
- declare class SyncFrame implements NpsFrame {
90
- readonly taskId: string;
91
- readonly syncId: string;
92
- readonly waitFor: readonly string[];
93
- readonly minRequired: number;
94
- readonly aggregate: AggregateStrategy | string;
95
- readonly timeoutMs?: number | undefined;
96
- readonly frameType = FrameType.SYNC;
97
- readonly preferredTier = EncodingTier.MSGPACK;
98
- constructor(taskId: string, syncId: string, waitFor: readonly string[], minRequired?: number, aggregate?: AggregateStrategy | string, timeoutMs?: number | undefined);
99
- toDict(): Record<string, unknown>;
100
- static fromDict(data: Record<string, unknown>): SyncFrame;
101
- }
102
- interface StreamError {
103
- errorCode: string;
104
- message?: string;
105
- }
106
- declare class AlignStreamFrame implements NpsFrame {
107
- readonly streamId: string;
108
- readonly taskId: string;
109
- readonly subtaskId: string;
110
- readonly seq: number;
111
- readonly isFinal: boolean;
112
- readonly senderNid: string;
113
- readonly data?: Record<string, unknown> | undefined;
114
- readonly error?: StreamError | undefined;
115
- readonly windowSize?: number | undefined;
116
- readonly frameType = FrameType.ALIGN_STREAM;
117
- readonly preferredTier = EncodingTier.MSGPACK;
118
- constructor(streamId: string, taskId: string, subtaskId: string, seq: number, isFinal: boolean, senderNid: string, data?: Record<string, unknown> | undefined, error?: StreamError | undefined, windowSize?: number | undefined);
119
- toDict(): Record<string, unknown>;
120
- static fromDict(data: Record<string, unknown>): AlignStreamFrame;
121
- }
122
-
123
- declare function registerNopFrames(registry: FrameRegistry): void;
124
-
125
- declare class NopTaskStatus {
126
- private readonly _raw;
127
- constructor(_raw: Record<string, unknown>);
128
- get taskId(): string;
129
- get state(): TaskState;
130
- get isTerminal(): boolean;
131
- get aggregatedResult(): unknown;
132
- get errorCode(): string | undefined;
133
- get errorMessage(): string | undefined;
134
- get nodeResults(): Record<string, unknown>;
135
- get raw(): Record<string, unknown>;
136
- toString(): string;
137
- }
138
- declare class NopClient {
139
- private readonly _baseUrl;
140
- private readonly _codec;
141
- private readonly _tier;
142
- constructor(baseUrl: string, options?: {
143
- defaultTier?: EncodingTier;
144
- registry?: FrameRegistry;
145
- });
146
- submit(frame: TaskFrame): Promise<string>;
147
- getStatus(taskId: string): Promise<NopTaskStatus>;
148
- cancel(taskId: string): Promise<void>;
149
- wait(taskId: string, options?: {
150
- pollIntervalMs?: number;
151
- timeoutMs?: number;
152
- }): Promise<NopTaskStatus>;
153
- }
154
-
155
- export { AggregateStrategy, AlignStreamFrame, BackoffStrategy, type DagEdge, type DagNode, DelegateFrame, NopClient, NopTaskStatus, type RetryPolicy, type StreamError, SyncFrame, type TaskContext, type TaskDag, TaskFrame, TaskPriority, TaskState, computeDelayMs, registerNopFrames };
@@ -1,50 +0,0 @@
1
- // Copyright 2026 INNO LOTUS PTY LTD
2
- // SPDX-License-Identifier: Apache-2.0
3
- export var TaskState;
4
- (function (TaskState) {
5
- TaskState["PENDING"] = "pending";
6
- TaskState["PREFLIGHT"] = "preflight";
7
- TaskState["RUNNING"] = "running";
8
- TaskState["WAITING_SYNC"] = "waiting_sync";
9
- TaskState["COMPLETED"] = "completed";
10
- TaskState["FAILED"] = "failed";
11
- TaskState["CANCELLED"] = "cancelled";
12
- TaskState["SKIPPED"] = "skipped";
13
- })(TaskState || (TaskState = {}));
14
- export var TaskPriority;
15
- (function (TaskPriority) {
16
- TaskPriority["LOW"] = "low";
17
- TaskPriority["NORMAL"] = "normal";
18
- TaskPriority["HIGH"] = "high";
19
- })(TaskPriority || (TaskPriority = {}));
20
- export var BackoffStrategy;
21
- (function (BackoffStrategy) {
22
- BackoffStrategy["FIXED"] = "fixed";
23
- BackoffStrategy["LINEAR"] = "linear";
24
- BackoffStrategy["EXPONENTIAL"] = "exponential";
25
- })(BackoffStrategy || (BackoffStrategy = {}));
26
- export var AggregateStrategy;
27
- (function (AggregateStrategy) {
28
- AggregateStrategy["MERGE"] = "merge";
29
- AggregateStrategy["FIRST"] = "first";
30
- AggregateStrategy["FASTEST_K"] = "fastest_k";
31
- AggregateStrategy["ALL"] = "all";
32
- })(AggregateStrategy || (AggregateStrategy = {}));
33
- export function computeDelayMs(policy, attempt) {
34
- const base = policy.baseDelayMs ?? 1000;
35
- const cap = policy.maxDelayMs ?? 30_000;
36
- let delay;
37
- switch (policy.backoff) {
38
- case BackoffStrategy.FIXED:
39
- delay = base;
40
- break;
41
- case BackoffStrategy.LINEAR:
42
- delay = base * (attempt + 1);
43
- break;
44
- case BackoffStrategy.EXPONENTIAL:
45
- delay = base * Math.pow(2, attempt);
46
- break;
47
- }
48
- return Math.min(delay, cap);
49
- }
50
- //# sourceMappingURL=models.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/nop/models.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sCAAsC;AAEtC,MAAM,CAAN,IAAY,SASX;AATD,WAAY,SAAS;IACnB,gCAAyB,CAAA;IACzB,oCAA2B,CAAA;IAC3B,gCAAyB,CAAA;IACzB,0CAA8B,CAAA;IAC9B,oCAA2B,CAAA;IAC3B,8BAAwB,CAAA;IACxB,oCAA2B,CAAA;IAC3B,gCAAyB,CAAA;AAC3B,CAAC,EATW,SAAS,KAAT,SAAS,QASpB;AAED,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,2BAAc,CAAA;IACd,iCAAiB,CAAA;IACjB,6BAAe,CAAA;AACjB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,kCAAqB,CAAA;IACrB,oCAAsB,CAAA;IACtB,8CAA2B,CAAA;AAC7B,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B;AAED,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,oCAAoB,CAAA;IACpB,oCAAoB,CAAA;IACpB,4CAAwB,CAAA;IACxB,gCAAkB,CAAA;AACpB,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B;AASD,MAAM,UAAU,cAAc,CAAC,MAAmB,EAAE,OAAe;IACjE,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC;IACxC,MAAM,GAAG,GAAI,MAAM,CAAC,UAAU,IAAK,MAAM,CAAC;IAC1C,IAAI,KAAa,CAAC;IAClB,QAAQ,MAAM,CAAC,OAAO,EAAE,CAAC;QACvB,KAAK,eAAe,CAAC,KAAK;YAAQ,KAAK,GAAG,IAAI,CAAC;YAAC,MAAM;QACtD,KAAK,eAAe,CAAC,MAAM;YAAO,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;YAAC,MAAM;QACtE,KAAK,eAAe,CAAC,WAAW;YAAE,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YAAC,MAAM;IAC/E,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC9B,CAAC"}
@@ -1,44 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- // Copyright (c) 2026 LabAcacia / INNO LOTUS PTY LTD
3
- //
4
- // NOP Task Protocol — TypeScript Type Definitions
5
- // NPS-5 Neural Orchestration Protocol, MVP subset
6
- //
7
- // NCP carries the envelope. NOP fills the payload.
8
- // IntentFrame dispatches. ResultFrame reports back.
9
- /** Valid state transitions */
10
- export const VALID_TRANSITIONS = {
11
- pending: ["active", "cancelled"],
12
- active: ["completed", "failed", "timeout", "blocked"],
13
- blocked: ["active", "cancelled"],
14
- completed: [],
15
- failed: [],
16
- timeout: [],
17
- cancelled: [],
18
- };
19
- // -----------------------------------------------------------------------------
20
- // File Naming Conventions
21
- // -----------------------------------------------------------------------------
22
- /** Directory where a task file lives based on its state */
23
- export const STATE_DIRECTORY = {
24
- pending: "inbox",
25
- active: "active",
26
- completed: "done",
27
- failed: "done",
28
- timeout: "done",
29
- blocked: "blocked",
30
- cancelled: "done",
31
- };
32
- /** File extensions by message type */
33
- export const FILE_EXTENSIONS = {
34
- intent: ".intent.json",
35
- result: ".result.json",
36
- };
37
- /** Default mailbox directory names */
38
- export const MAILBOX_DEFAULTS = {
39
- active: "active",
40
- done: "done",
41
- inbox: "inbox",
42
- blocked: "blocked",
43
- };
44
- //# sourceMappingURL=nop-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nop-types.js","sourceRoot":"","sources":["../../src/nop/nop-types.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,oDAAoD;AACpD,EAAE;AACF,kDAAkD;AAClD,kDAAkD;AAClD,EAAE;AACF,mDAAmD;AACnD,oDAAoD;AAkKpD,8BAA8B;AAC9B,MAAM,CAAC,MAAM,iBAAiB,GAAgC;IAC5D,OAAO,EAAI,CAAC,QAAQ,EAAE,WAAW,CAAC;IAClC,MAAM,EAAK,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;IACxD,OAAO,EAAI,CAAC,QAAQ,EAAE,WAAW,CAAC;IAClC,SAAS,EAAE,EAAE;IACb,MAAM,EAAK,EAAE;IACb,OAAO,EAAI,EAAE;IACb,SAAS,EAAE,EAAE;CACd,CAAC;AAEF,gFAAgF;AAChF,0BAA0B;AAC1B,gFAAgF;AAEhF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,eAAe,GAA8B;IACxD,OAAO,EAAI,OAAO;IAClB,MAAM,EAAK,QAAQ;IACnB,SAAS,EAAE,MAAM;IACjB,MAAM,EAAK,MAAM;IACjB,OAAO,EAAI,MAAM;IACjB,OAAO,EAAI,SAAS;IACpB,SAAS,EAAE,MAAM;CAClB,CAAC;AAEF,sCAAsC;AACtC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,MAAM,EAAE,cAAc;IACtB,MAAM,EAAE,cAAc;CACd,CAAC;AAEX,sCAAsC;AACtC,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACV,CAAC"}
@@ -1,11 +0,0 @@
1
- // Copyright 2026 INNO LOTUS PTY LTD
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { FrameType } from "../core/frames.js";
4
- import { AlignStreamFrame, DelegateFrame, SyncFrame, TaskFrame } from "./frames.js";
5
- export function registerNopFrames(registry) {
6
- registry.register(FrameType.TASK, TaskFrame);
7
- registry.register(FrameType.DELEGATE, DelegateFrame);
8
- registry.register(FrameType.SYNC, SyncFrame);
9
- registry.register(FrameType.ALIGN_STREAM, AlignStreamFrame);
10
- }
11
- //# sourceMappingURL=registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/nop/registry.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sCAAsC;AAGtC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEpF,MAAM,UAAU,iBAAiB,CAAC,QAAuB;IACvD,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAU,SAAS,CAAC,CAAC;IACrD,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAM,aAAa,CAAC,CAAC;IACzD,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAU,SAAS,CAAC,CAAC;IACrD,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;AAC9D,CAAC"}
@@ -1,101 +0,0 @@
1
- // Copyright 2026 INNO LOTUS PTY LTD
2
- // SPDX-License-Identifier: Apache-2.0
3
- /**
4
- * NwpClient — async HTTP-mode client for NPS Neural Web Protocol nodes (NPS-2).
5
- */
6
- import { NpsFrameCodec } from "../core/codec.js";
7
- import { EncodingTier } from "../core/frames.js";
8
- import { FrameRegistry } from "../core/registry.js";
9
- import { registerNcpFrames } from "../ncp/registry.js";
10
- import { CapsFrame } from "../ncp/frames.js";
11
- import { registerNwpFrames } from "./registry.js";
12
- import { asyncActionResponseFromDict } from "./frames.js";
13
- const CONTENT_TYPE = "application/x-nps-frame";
14
- export class NwpClient {
15
- _baseUrl;
16
- _codec;
17
- _tier;
18
- constructor(baseUrl, options = {}) {
19
- this._baseUrl = baseUrl.replace(/\/$/, "");
20
- this._tier = options.defaultTier ?? EncodingTier.MSGPACK;
21
- const registry = options.registry ?? (() => {
22
- const r = new FrameRegistry();
23
- registerNcpFrames(r);
24
- registerNwpFrames(r);
25
- return r;
26
- })();
27
- const codecOpts = options.maxPayload !== undefined ? { maxPayload: options.maxPayload } : {};
28
- this._codec = new NpsFrameCodec(registry, codecOpts);
29
- }
30
- async sendAnchor(frame) {
31
- const wire = this._codec.encode(frame, { overrideTier: this._tier });
32
- const res = await fetch(`${this._baseUrl}/anchor`, {
33
- method: "POST",
34
- body: wire,
35
- headers: { "Content-Type": CONTENT_TYPE, "Accept": CONTENT_TYPE },
36
- });
37
- if (!res.ok)
38
- throw new Error(`NWP /anchor failed: HTTP ${res.status}`);
39
- }
40
- async query(frame) {
41
- const wire = this._codec.encode(frame, { overrideTier: this._tier });
42
- const res = await fetch(`${this._baseUrl}/query`, {
43
- method: "POST",
44
- body: wire,
45
- headers: { "Content-Type": CONTENT_TYPE, "Accept": CONTENT_TYPE },
46
- });
47
- if (!res.ok)
48
- throw new Error(`NWP /query failed: HTTP ${res.status}`);
49
- const buf = new Uint8Array(await res.arrayBuffer());
50
- const result = this._codec.decode(buf);
51
- if (!(result instanceof CapsFrame)) {
52
- throw new TypeError(`Expected CapsFrame from /query, got ${result.constructor.name}.`);
53
- }
54
- return result;
55
- }
56
- async *stream(frame) {
57
- const wire = this._codec.encode(frame, { overrideTier: this._tier });
58
- const res = await fetch(`${this._baseUrl}/stream`, {
59
- method: "POST",
60
- body: wire,
61
- headers: { "Content-Type": CONTENT_TYPE, "Accept": CONTENT_TYPE },
62
- });
63
- if (!res.ok)
64
- throw new Error(`NWP /stream failed: HTTP ${res.status}`);
65
- if (res.body === null)
66
- return;
67
- const { StreamFrame: SF } = await import("../ncp/frames.js");
68
- for await (const chunk of res.body) {
69
- const bytes = chunk instanceof Uint8Array ? chunk : new Uint8Array(chunk);
70
- if (bytes.length === 0)
71
- continue;
72
- const result = this._codec.decode(bytes);
73
- if (!(result instanceof SF)) {
74
- throw new TypeError(`Expected StreamFrame from /stream, got ${result.constructor.name}.`);
75
- }
76
- yield result;
77
- if (result.isLast)
78
- break;
79
- }
80
- }
81
- async invoke(frame) {
82
- const wire = this._codec.encode(frame, { overrideTier: this._tier });
83
- const res = await fetch(`${this._baseUrl}/invoke`, {
84
- method: "POST",
85
- body: wire,
86
- headers: { "Content-Type": CONTENT_TYPE, "Accept": CONTENT_TYPE },
87
- });
88
- if (!res.ok)
89
- throw new Error(`NWP /invoke failed: HTTP ${res.status}`);
90
- if (frame.async_) {
91
- return asyncActionResponseFromDict(await res.json());
92
- }
93
- const contentType = res.headers.get("content-type") ?? "";
94
- if (contentType.includes(CONTENT_TYPE)) {
95
- const buf = new Uint8Array(await res.arrayBuffer());
96
- return this._codec.decode(buf);
97
- }
98
- return res.json();
99
- }
100
- }
101
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/nwp/client.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sCAAsC;AAEtC;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE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,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,QAAQ,SAAS,EAAE;YAClD,MAAM,EAAG,MAAM;YACf,IAAI,EAAK,IAAI;YACb,OAAO,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE;SAClE,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QAEvE,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACjB,OAAO,2BAA2B,CAAC,MAAM,GAAG,CAAC,IAAI,EAA6B,CAAwB,CAAC;QACzG,CAAC;QAED,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;QAC1D,IAAI,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YACvC,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;YACpD,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;CACF"}
@@ -1,81 +0,0 @@
1
- // Copyright 2026 INNO LOTUS PTY LTD
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { EncodingTier, FrameType } from "../core/frames.js";
4
- // ── QueryFrame ────────────────────────────────────────────────────────────────
5
- export class QueryFrame {
6
- anchorRef;
7
- filter;
8
- limit;
9
- offset;
10
- orderBy;
11
- fields;
12
- vectorSearch;
13
- depth;
14
- frameType = FrameType.QUERY;
15
- preferredTier = EncodingTier.MSGPACK;
16
- constructor(anchorRef, filter, limit, offset, orderBy, fields, vectorSearch, depth) {
17
- this.anchorRef = anchorRef;
18
- this.filter = filter;
19
- this.limit = limit;
20
- this.offset = offset;
21
- this.orderBy = orderBy;
22
- this.fields = fields;
23
- this.vectorSearch = vectorSearch;
24
- this.depth = depth;
25
- }
26
- toDict() {
27
- return {
28
- anchor_ref: this.anchorRef ?? null,
29
- filter: this.filter ?? null,
30
- limit: this.limit ?? null,
31
- offset: this.offset ?? null,
32
- order_by: this.orderBy ?? null,
33
- fields: this.fields ?? null,
34
- vector_search: this.vectorSearch ?? null,
35
- depth: this.depth ?? null,
36
- };
37
- }
38
- static fromDict(data) {
39
- return new QueryFrame(data["anchor_ref"] ?? undefined, data["filter"] ?? undefined, data["limit"] ?? undefined, data["offset"] ?? undefined, data["order_by"] ?? undefined, data["fields"] ?? undefined, data["vector_search"] ?? undefined, data["depth"] ?? undefined);
40
- }
41
- }
42
- // ── ActionFrame ───────────────────────────────────────────────────────────────
43
- export class ActionFrame {
44
- actionId;
45
- params;
46
- async_;
47
- idempotencyKey;
48
- timeoutMs;
49
- frameType = FrameType.ACTION;
50
- preferredTier = EncodingTier.MSGPACK;
51
- constructor(actionId, params, async_, idempotencyKey, timeoutMs) {
52
- this.actionId = actionId;
53
- this.params = params;
54
- this.async_ = async_;
55
- this.idempotencyKey = idempotencyKey;
56
- this.timeoutMs = timeoutMs;
57
- }
58
- toDict() {
59
- return {
60
- action_id: this.actionId,
61
- params: this.params ?? null,
62
- async: this.async_ ?? false,
63
- idempotency_key: this.idempotencyKey ?? null,
64
- timeout_ms: this.timeoutMs ?? null,
65
- };
66
- }
67
- static fromDict(data) {
68
- return new ActionFrame(data["action_id"], data["params"] ?? undefined, data["async"] ?? undefined, data["idempotency_key"] ?? undefined, data["timeout_ms"] ?? undefined);
69
- }
70
- }
71
- export function asyncActionResponseFromDict(data) {
72
- const r = {
73
- taskId: data["task_id"],
74
- status: data["status"],
75
- };
76
- const pollUrl = data["poll_url"];
77
- if (pollUrl != null)
78
- r.pollUrl = pollUrl;
79
- return r;
80
- }
81
- //# sourceMappingURL=frames.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"frames.js","sourceRoot":"","sources":["../../src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