@tangle-network/agent-app 0.43.23 → 0.43.25
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/dist/app-auth/index.d.ts +163 -0
- package/dist/app-auth/index.js +166 -0
- package/dist/app-auth/index.js.map +1 -0
- package/dist/assets/index.d.ts +2 -2
- package/dist/assistant/index.d.ts +1 -0
- package/dist/assistant/index.js +2 -1
- package/dist/assistant/index.js.map +1 -1
- package/dist/chat-store/index.d.ts +193 -0
- package/dist/chat-store/index.js +194 -0
- package/dist/chat-store/index.js.map +1 -0
- package/dist/chunk-4H77LX3V.js +38 -0
- package/dist/chunk-4H77LX3V.js.map +1 -0
- package/dist/chunk-4TXDD6P2.js +163 -0
- package/dist/chunk-4TXDD6P2.js.map +1 -0
- package/dist/chunk-AVBANQ67.js +295 -0
- package/dist/chunk-AVBANQ67.js.map +1 -0
- package/dist/{chunk-UKYZ4O2O.js → chunk-JJGZ54EB.js} +64 -5
- package/dist/chunk-JJGZ54EB.js.map +1 -0
- package/dist/{chunk-VMY4TKMN.js → chunk-PEPXQTJ3.js} +921 -432
- package/dist/chunk-PEPXQTJ3.js.map +1 -0
- package/dist/chunk-U7DLCPJ6.js +203 -0
- package/dist/chunk-U7DLCPJ6.js.map +1 -0
- package/dist/{chunk-SAOAAA3S.js → chunk-UHXQ3KNX.js} +1 -22
- package/dist/chunk-UHXQ3KNX.js.map +1 -0
- package/dist/contract-DYbTzEDf.d.ts +122 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +172 -88
- package/dist/interactions/index.d.ts +141 -0
- package/dist/interactions/index.js +59 -0
- package/dist/interactions/index.js.map +1 -0
- package/dist/parts-BeRnK54I.d.ts +185 -0
- package/dist/platform/index.d.ts +2 -270
- package/dist/platform/index.js +12 -278
- package/dist/platform/index.js.map +1 -1
- package/dist/preset-cloudflare/index.d.ts +0 -10
- package/dist/preset-cloudflare/index.js +1 -1
- package/dist/profile/index.d.ts +33 -2
- package/dist/profile/index.js +37 -1
- package/dist/profile/index.js.map +1 -1
- package/dist/sandbox/index.d.ts +61 -5
- package/dist/sandbox/index.js +13 -1
- package/dist/sso-Df4wtL8D.d.ts +270 -0
- package/dist/teams/index.js +9 -9
- package/dist/teams/invitations-api.js +3 -3
- package/dist/web-react/index.d.ts +206 -96
- package/dist/web-react/index.js +68 -22
- package/package.json +21 -2
- package/dist/chunk-SAOAAA3S.js.map +0 -1
- package/dist/chunk-UKYZ4O2O.js.map +0 -1
- package/dist/chunk-VMY4TKMN.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,66 @@
|
|
|
1
1
|
import "./chunk-UAKFCMWK.js";
|
|
2
|
+
import {
|
|
3
|
+
CANVAS_ELEMENT_KINDS,
|
|
4
|
+
CANVAS_MCP_TOOLS,
|
|
5
|
+
CANVAS_MCP_TOOL_NAMES,
|
|
6
|
+
DEFAULT_DESIGN_CANVAS_MCP_DESCRIPTION,
|
|
7
|
+
SCENE_OPERATION_TYPES,
|
|
8
|
+
applyBindingsToDocument,
|
|
9
|
+
buildDesignCanvasMcpServerEntry,
|
|
10
|
+
createDesignCanvasMcpHandler,
|
|
11
|
+
findCanvasMcpTool,
|
|
12
|
+
instantiateTemplate,
|
|
13
|
+
listTemplateSlots,
|
|
14
|
+
validateBindings
|
|
15
|
+
} from "./chunk-WFMUDX5J.js";
|
|
2
16
|
import {
|
|
3
17
|
darkTheme,
|
|
4
18
|
lightTheme,
|
|
5
19
|
themeColor,
|
|
6
20
|
themeToCssVars
|
|
7
21
|
} from "./chunk-47C6PJCW.js";
|
|
22
|
+
import {
|
|
23
|
+
CHANNEL_PRESETS,
|
|
24
|
+
EXPORT_PRESETS,
|
|
25
|
+
SCENE_ELEMENT_KINDS,
|
|
26
|
+
SCENE_SCHEMA_VERSION,
|
|
27
|
+
SIZE_PRESETS,
|
|
28
|
+
applySceneOperation,
|
|
29
|
+
applySceneOperations,
|
|
30
|
+
assertColor,
|
|
31
|
+
assertFinite,
|
|
32
|
+
assertPositiveFinite,
|
|
33
|
+
assertSceneMediaSrc,
|
|
34
|
+
bleedAwareExportBounds,
|
|
35
|
+
bleedAwareExportRect,
|
|
36
|
+
boundsIntersect,
|
|
37
|
+
collectSlots,
|
|
38
|
+
createEmptyDocument,
|
|
39
|
+
createPage,
|
|
40
|
+
elementAabb,
|
|
41
|
+
elementExtent,
|
|
42
|
+
estimateTextHeight,
|
|
43
|
+
findElement,
|
|
44
|
+
findPreset,
|
|
45
|
+
matchPreset,
|
|
46
|
+
requireChannelPreset,
|
|
47
|
+
requireElement,
|
|
48
|
+
requirePage,
|
|
49
|
+
scaleForPreset,
|
|
50
|
+
scalePageForChannelPreset,
|
|
51
|
+
storeApplyScenePlan,
|
|
52
|
+
validateSceneOperation,
|
|
53
|
+
validateSceneOperations,
|
|
54
|
+
validateSlotValue
|
|
55
|
+
} from "./chunk-M2EBUDZ7.js";
|
|
56
|
+
import {
|
|
57
|
+
DEFAULT_REDACTION_PATTERNS,
|
|
58
|
+
buildRedactedDocument,
|
|
59
|
+
detectSpans,
|
|
60
|
+
maskSpans,
|
|
61
|
+
redactForIngestion,
|
|
62
|
+
revealSpan
|
|
63
|
+
} from "./chunk-5RMIUJDI.js";
|
|
8
64
|
import {
|
|
9
65
|
buildFlowTrace,
|
|
10
66
|
childSpanContext,
|
|
@@ -83,67 +139,45 @@ import {
|
|
|
83
139
|
trackIntervals
|
|
84
140
|
} from "./chunk-ZYBWGSAZ.js";
|
|
85
141
|
import {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
142
|
+
DEFAULT_MISSION_STEP_KINDS,
|
|
143
|
+
MISSION_CONTROL_CHANNEL_ID,
|
|
144
|
+
MissionConcurrencyError,
|
|
145
|
+
RetryableStepError,
|
|
146
|
+
applyMissionEvent,
|
|
147
|
+
asMissionStreamEvent,
|
|
148
|
+
budgetGateProposalId,
|
|
149
|
+
buildAgentMissionPlan,
|
|
150
|
+
createInMemoryMissionStore,
|
|
151
|
+
createMissionEngine,
|
|
152
|
+
createMissionService,
|
|
153
|
+
isMissionStopRequested,
|
|
154
|
+
isMissionTerminal,
|
|
155
|
+
mergeMissionState,
|
|
156
|
+
noopEventSink,
|
|
157
|
+
parseMissionBlocks,
|
|
158
|
+
parseSessionStreamEnvelope,
|
|
159
|
+
reduceMissionEvents,
|
|
160
|
+
stepAgentActivity,
|
|
161
|
+
stepGateProposalId,
|
|
162
|
+
volumeGateProposalId
|
|
163
|
+
} from "./chunk-YNALYIQ3.js";
|
|
99
164
|
import {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
assertSceneMediaSrc,
|
|
111
|
-
bleedAwareExportBounds,
|
|
112
|
-
bleedAwareExportRect,
|
|
113
|
-
boundsIntersect,
|
|
114
|
-
collectSlots,
|
|
115
|
-
createEmptyDocument,
|
|
116
|
-
createPage,
|
|
117
|
-
elementAabb,
|
|
118
|
-
elementExtent,
|
|
119
|
-
estimateTextHeight,
|
|
120
|
-
findElement,
|
|
121
|
-
findPreset,
|
|
122
|
-
matchPreset,
|
|
123
|
-
requireChannelPreset,
|
|
124
|
-
requireElement,
|
|
125
|
-
requirePage,
|
|
126
|
-
scaleForPreset,
|
|
127
|
-
scalePageForChannelPreset,
|
|
128
|
-
storeApplyScenePlan,
|
|
129
|
-
validateSceneOperation,
|
|
130
|
-
validateSceneOperations,
|
|
131
|
-
validateSlotValue
|
|
132
|
-
} from "./chunk-M2EBUDZ7.js";
|
|
165
|
+
addSecurityHeaders,
|
|
166
|
+
assertMediaUrl,
|
|
167
|
+
checkRateLimit,
|
|
168
|
+
clearCookieHeader,
|
|
169
|
+
extractRequestContext,
|
|
170
|
+
parseJsonObjectBody,
|
|
171
|
+
readCookieValue,
|
|
172
|
+
requireString,
|
|
173
|
+
serializeCookie
|
|
174
|
+
} from "./chunk-HFC4BTWJ.js";
|
|
133
175
|
import {
|
|
134
176
|
composeMissionFlowTrace,
|
|
135
177
|
delegationActivityToFlowSpans,
|
|
136
178
|
loopTraceEventsToFlowSpans,
|
|
137
179
|
stepActivityFlowTrace
|
|
138
180
|
} from "./chunk-2QI7XV2T.js";
|
|
139
|
-
import {
|
|
140
|
-
DEFAULT_REDACTION_PATTERNS,
|
|
141
|
-
buildRedactedDocument,
|
|
142
|
-
detectSpans,
|
|
143
|
-
maskSpans,
|
|
144
|
-
redactForIngestion,
|
|
145
|
-
revealSpan
|
|
146
|
-
} from "./chunk-5RMIUJDI.js";
|
|
147
181
|
import {
|
|
148
182
|
agentAppConfigJsonSchema,
|
|
149
183
|
defineAgentApp
|
|
@@ -157,12 +191,21 @@ import {
|
|
|
157
191
|
createPresetToolHandlers,
|
|
158
192
|
createPresetWorkspaceKeyManager,
|
|
159
193
|
createPresetWorkspaceKeyStore
|
|
160
|
-
} from "./chunk-
|
|
194
|
+
} from "./chunk-UHXQ3KNX.js";
|
|
161
195
|
import {
|
|
162
196
|
createPlatformBalanceManager,
|
|
163
197
|
createTcloudKeyProvisioner,
|
|
164
198
|
createWorkspaceKeyManager
|
|
165
199
|
} from "./chunk-G3HCU7TA.js";
|
|
200
|
+
import {
|
|
201
|
+
BULK_DELETE_MAX_THREADS,
|
|
202
|
+
ChatStoreInputError,
|
|
203
|
+
isChatInteractionPart,
|
|
204
|
+
isChatStepFinishPart,
|
|
205
|
+
isChatTextPart,
|
|
206
|
+
isChatToolPart,
|
|
207
|
+
threadTitleFromMessage
|
|
208
|
+
} from "./chunk-4H77LX3V.js";
|
|
166
209
|
import {
|
|
167
210
|
createFieldCrypto,
|
|
168
211
|
decodeHexKey,
|
|
@@ -206,39 +249,35 @@ import {
|
|
|
206
249
|
resolveIntegrationAction
|
|
207
250
|
} from "./chunk-L2TG5DBW.js";
|
|
208
251
|
import {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
budgetGateProposalId,
|
|
216
|
-
buildAgentMissionPlan,
|
|
217
|
-
createInMemoryMissionStore,
|
|
218
|
-
createMissionEngine,
|
|
219
|
-
createMissionService,
|
|
220
|
-
isMissionStopRequested,
|
|
221
|
-
isMissionTerminal,
|
|
222
|
-
mergeMissionState,
|
|
223
|
-
noopEventSink,
|
|
224
|
-
parseMissionBlocks,
|
|
225
|
-
parseSessionStreamEnvelope,
|
|
226
|
-
reduceMissionEvents,
|
|
227
|
-
stepAgentActivity,
|
|
228
|
-
stepGateProposalId,
|
|
229
|
-
volumeGateProposalId
|
|
230
|
-
} from "./chunk-YNALYIQ3.js";
|
|
252
|
+
createInteractionAnswerRoute,
|
|
253
|
+
listSessionInteractions,
|
|
254
|
+
mapInteractionRespondFailure,
|
|
255
|
+
respondToSessionInteraction,
|
|
256
|
+
validateInteractionAnswerBody
|
|
257
|
+
} from "./chunk-U7DLCPJ6.js";
|
|
231
258
|
import {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
259
|
+
INTERACTION_CANCEL_EVENT,
|
|
260
|
+
INTERACTION_EVENT,
|
|
261
|
+
INTERACTION_RESOLVED_EVENT,
|
|
262
|
+
canTransitionInteractionStatus,
|
|
263
|
+
cancelStatusFor,
|
|
264
|
+
composerAnswerData,
|
|
265
|
+
composerAnswerDeliveries,
|
|
266
|
+
dedupeQuestionInteractionsByContent,
|
|
267
|
+
fieldAcceptsFreeText,
|
|
268
|
+
interactionFromWireRequest,
|
|
269
|
+
interactionPartKey,
|
|
270
|
+
interactionToPersistedPart,
|
|
271
|
+
isRenderableInteractionKind,
|
|
272
|
+
isSafeInteractionFieldKey,
|
|
273
|
+
isTerminalInteractionStatus,
|
|
274
|
+
noticePart,
|
|
275
|
+
noticePartKey,
|
|
276
|
+
parseInteractionCancel,
|
|
277
|
+
parseInteractionRequest,
|
|
278
|
+
persistedPartToInteraction,
|
|
279
|
+
questionInteractionContentSignature
|
|
280
|
+
} from "./chunk-4TXDD6P2.js";
|
|
242
281
|
import {
|
|
243
282
|
createKnowledgeLoop,
|
|
244
283
|
createReviewerDecider,
|
|
@@ -246,7 +285,12 @@ import {
|
|
|
246
285
|
} from "./chunk-EEPJGZJW.js";
|
|
247
286
|
import {
|
|
248
287
|
DEFAULT_SANDBOX_RESOURCES,
|
|
288
|
+
ENV_TOTAL_MAX_BYTES,
|
|
289
|
+
ENV_VALUE_MAX_BYTES,
|
|
290
|
+
PROVISION_PAYLOAD_MAX_BYTES,
|
|
249
291
|
SandboxRuntimeAuthRefreshError,
|
|
292
|
+
assertEnvWithinLimits,
|
|
293
|
+
assertProvisionPayloadWithinCap,
|
|
250
294
|
attachReasoningEffort,
|
|
251
295
|
bearerSubprotocolToken,
|
|
252
296
|
bearerToken,
|
|
@@ -271,6 +315,7 @@ import {
|
|
|
271
315
|
isTerminalPromptEvent,
|
|
272
316
|
matchSandboxTerminalWsPath,
|
|
273
317
|
mergeExtraMcp,
|
|
318
|
+
mergeHistoryIntoParts,
|
|
274
319
|
mintSandboxScopedToken,
|
|
275
320
|
mintTerminalProxyToken,
|
|
276
321
|
readSecret,
|
|
@@ -293,7 +338,7 @@ import {
|
|
|
293
338
|
verifySandboxTerminalToken,
|
|
294
339
|
verifyTerminalProxyToken,
|
|
295
340
|
writeProfileFilesToBox
|
|
296
|
-
} from "./chunk-
|
|
341
|
+
} from "./chunk-JJGZ54EB.js";
|
|
297
342
|
import {
|
|
298
343
|
DEFAULT_HARNESS,
|
|
299
344
|
KNOWN_HARNESSES,
|
|
@@ -389,11 +434,13 @@ import {
|
|
|
389
434
|
export {
|
|
390
435
|
APP_TOOL_NAMES,
|
|
391
436
|
ApprovalEventSchema,
|
|
437
|
+
BULK_DELETE_MAX_THREADS,
|
|
392
438
|
BrandTokensSchema,
|
|
393
439
|
CANVAS_ELEMENT_KINDS,
|
|
394
440
|
CANVAS_MCP_TOOLS,
|
|
395
441
|
CANVAS_MCP_TOOL_NAMES,
|
|
396
442
|
CHANNEL_PRESETS,
|
|
443
|
+
ChatStoreInputError,
|
|
397
444
|
ConversionMetricsSchema,
|
|
398
445
|
CopyContentSchema,
|
|
399
446
|
DEFAULT_APP_TOOL_PATHS,
|
|
@@ -406,9 +453,14 @@ export {
|
|
|
406
453
|
DEFAULT_SEQUENCES_MCP_DESCRIPTION,
|
|
407
454
|
DEFAULT_TANGLE_BILLING_ENFORCEMENT_ENV_VAR,
|
|
408
455
|
DEFAULT_TANGLE_ROUTER_BASE_URL,
|
|
456
|
+
ENV_TOTAL_MAX_BYTES,
|
|
457
|
+
ENV_VALUE_MAX_BYTES,
|
|
409
458
|
EXPORT_PRESETS,
|
|
410
459
|
EmailContentSchema,
|
|
411
460
|
HubExecClient,
|
|
461
|
+
INTERACTION_CANCEL_EVENT,
|
|
462
|
+
INTERACTION_EVENT,
|
|
463
|
+
INTERACTION_RESOLVED_EVENT,
|
|
412
464
|
ImageContentSchema,
|
|
413
465
|
KNOWN_HARNESSES,
|
|
414
466
|
MAX_CAPTION_BATCH,
|
|
@@ -418,6 +470,7 @@ export {
|
|
|
418
470
|
MissionConcurrencyError,
|
|
419
471
|
PRESET_MIGRATION_SQL,
|
|
420
472
|
PRESET_TABLES,
|
|
473
|
+
PROVISION_PAYLOAD_MAX_BYTES,
|
|
421
474
|
RetryableStepError,
|
|
422
475
|
SCENE_ELEMENT_KINDS,
|
|
423
476
|
SCENE_OPERATION_TYPES,
|
|
@@ -449,10 +502,12 @@ export {
|
|
|
449
502
|
asString,
|
|
450
503
|
assertClipFitsSequence,
|
|
451
504
|
assertColor,
|
|
505
|
+
assertEnvWithinLimits,
|
|
452
506
|
assertFinite,
|
|
453
507
|
assertHarnessModelCompatible,
|
|
454
508
|
assertMediaUrl,
|
|
455
509
|
assertPositiveFinite,
|
|
510
|
+
assertProvisionPayloadWithinCap,
|
|
456
511
|
assertSceneMediaSrc,
|
|
457
512
|
assertSequenceMediaUrl,
|
|
458
513
|
attachReasoningEffort,
|
|
@@ -486,6 +541,8 @@ export {
|
|
|
486
541
|
buildSrt,
|
|
487
542
|
buildUserTextParts,
|
|
488
543
|
buildVtt,
|
|
544
|
+
canTransitionInteractionStatus,
|
|
545
|
+
cancelStatusFor,
|
|
489
546
|
captionCoverage,
|
|
490
547
|
captionTrackNameForLanguage,
|
|
491
548
|
checkRateLimit,
|
|
@@ -500,6 +557,8 @@ export {
|
|
|
500
557
|
coerceHarness,
|
|
501
558
|
collectSlots,
|
|
502
559
|
composeMissionFlowTrace,
|
|
560
|
+
composerAnswerData,
|
|
561
|
+
composerAnswerDeliveries,
|
|
503
562
|
createAgentRuntime,
|
|
504
563
|
createAppToolRuntimeExecutor,
|
|
505
564
|
createBrokerTokenProvider,
|
|
@@ -513,6 +572,7 @@ export {
|
|
|
513
572
|
createExpiringCapabilityToken,
|
|
514
573
|
createFieldCrypto,
|
|
515
574
|
createInMemoryMissionStore,
|
|
575
|
+
createInteractionAnswerRoute,
|
|
516
576
|
createKnowledgeLoop,
|
|
517
577
|
createLlmCorrectnessChecker,
|
|
518
578
|
createMcpToolHandler,
|
|
@@ -546,6 +606,7 @@ export {
|
|
|
546
606
|
decryptAesGcm,
|
|
547
607
|
decryptBytes,
|
|
548
608
|
decryptWithKey,
|
|
609
|
+
dedupeQuestionInteractionsByContent,
|
|
549
610
|
defineAgentApp,
|
|
550
611
|
defineAppTool,
|
|
551
612
|
defineSurfaceKind,
|
|
@@ -569,6 +630,7 @@ export {
|
|
|
569
630
|
extractProducedState,
|
|
570
631
|
extractRequestContext,
|
|
571
632
|
fetchModelCatalog,
|
|
633
|
+
fieldAcceptsFreeText,
|
|
572
634
|
finalizeAssistantParts,
|
|
573
635
|
findCanvasMcpTool,
|
|
574
636
|
findCustomTool,
|
|
@@ -583,24 +645,37 @@ export {
|
|
|
583
645
|
getPartKey,
|
|
584
646
|
handleAppToolRequest,
|
|
585
647
|
instantiateTemplate,
|
|
648
|
+
interactionFromWireRequest,
|
|
649
|
+
interactionPartKey,
|
|
650
|
+
interactionToPersistedPart,
|
|
586
651
|
invokeIntegrationHub,
|
|
587
652
|
isAppToolName,
|
|
653
|
+
isChatInteractionPart,
|
|
654
|
+
isChatStepFinishPart,
|
|
655
|
+
isChatTextPart,
|
|
656
|
+
isChatToolPart,
|
|
588
657
|
isHarness,
|
|
589
658
|
isMissionStopRequested,
|
|
590
659
|
isMissionTerminal,
|
|
591
660
|
isModelCompatibleWithHarness,
|
|
661
|
+
isRenderableInteractionKind,
|
|
662
|
+
isSafeInteractionFieldKey,
|
|
592
663
|
isSandboxTerminalWsUpgrade,
|
|
593
664
|
isTangleBillingEnforcementDisabled,
|
|
594
665
|
isTangleExecutionKeyError,
|
|
666
|
+
isTerminalInteractionStatus,
|
|
595
667
|
isTerminalPromptEvent,
|
|
596
668
|
lastClipEndFrame,
|
|
597
669
|
lightTheme,
|
|
670
|
+
listSessionInteractions,
|
|
598
671
|
listTemplateSlots,
|
|
599
672
|
loopTraceEventsToFlowSpans,
|
|
673
|
+
mapInteractionRespondFailure,
|
|
600
674
|
maskSpans,
|
|
601
675
|
matchPreset,
|
|
602
676
|
matchSandboxTerminalWsPath,
|
|
603
677
|
mergeExtraMcp,
|
|
678
|
+
mergeHistoryIntoParts,
|
|
604
679
|
mergeMissionState,
|
|
605
680
|
mergePersistedPart,
|
|
606
681
|
mergeSurfaceOverlay,
|
|
@@ -615,15 +690,21 @@ export {
|
|
|
615
690
|
normalizePersistedPart,
|
|
616
691
|
normalizeTime,
|
|
617
692
|
normalizeToolEvent,
|
|
693
|
+
noticePart,
|
|
694
|
+
noticePartKey,
|
|
618
695
|
outcomeStatus,
|
|
619
696
|
parseAssetSpec,
|
|
697
|
+
parseInteractionCancel,
|
|
698
|
+
parseInteractionRequest,
|
|
620
699
|
parseJsonObjectBody,
|
|
621
700
|
parseMissionBlocks,
|
|
622
701
|
parseSequenceOperations,
|
|
623
702
|
parseSessionStreamEnvelope,
|
|
703
|
+
persistedPartToInteraction,
|
|
624
704
|
planLanguageFanout,
|
|
625
705
|
producedFromToolEvents,
|
|
626
706
|
pumpBufferedTurn,
|
|
707
|
+
questionInteractionContentSignature,
|
|
627
708
|
readCookieValue,
|
|
628
709
|
readSecret,
|
|
629
710
|
readToolArgs,
|
|
@@ -653,6 +734,7 @@ export {
|
|
|
653
734
|
resolveToolName,
|
|
654
735
|
resolveUserTangleExecutionKey,
|
|
655
736
|
resolveUserTangleExecutionKeyForUser,
|
|
737
|
+
respondToSessionInteraction,
|
|
656
738
|
restrictTaxonomy,
|
|
657
739
|
revealSpan,
|
|
658
740
|
reviewCandidate,
|
|
@@ -687,6 +769,7 @@ export {
|
|
|
687
769
|
terminalTokenFromRequest,
|
|
688
770
|
themeColor,
|
|
689
771
|
themeToCssVars,
|
|
772
|
+
threadTitleFromMessage,
|
|
690
773
|
timedEventsFromLines,
|
|
691
774
|
toLoopEvents,
|
|
692
775
|
traceEnv,
|
|
@@ -697,6 +780,7 @@ export {
|
|
|
697
780
|
validateCreateTrack,
|
|
698
781
|
validateDeleteClip,
|
|
699
782
|
validateExtendSequence,
|
|
783
|
+
validateInteractionAnswerBody,
|
|
700
784
|
validateMoveClip,
|
|
701
785
|
validatePlaceClip,
|
|
702
786
|
validateQueueExport,
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { i as InteractionRequestWire } from '../contract-DYbTzEDf.js';
|
|
2
|
+
export { C as ChatInteraction, a as ChatInteractionField, b as ChatInteractionStatus, c as ChatSelectField, d as ComposerAnswerDelivery, I as INTERACTION_CANCEL_EVENT, e as INTERACTION_EVENT, f as INTERACTION_RESOLVED_EVENT, g as InteractionCancelData, h as InteractionPersistedPart, N as NoticeKind, j as NoticePersistedPart, P as ParseInteractionResult, k as canTransitionInteractionStatus, l as cancelStatusFor, m as composerAnswerData, n as composerAnswerDeliveries, o as dedupeQuestionInteractionsByContent, p as fieldAcceptsFreeText, q as interactionFromWireRequest, r as interactionPartKey, s as interactionToPersistedPart, t as isRenderableInteractionKind, u as isSafeInteractionFieldKey, v as isTerminalInteractionStatus, w as noticePart, x as noticePartKey, y as parseInteractionCancel, z as parseInteractionRequest, A as persistedPartToInteraction, B as questionInteractionContentSignature } from '../contract-DYbTzEDf.js';
|
|
3
|
+
import { InteractionOutcome, InteractionData } from '@tangle-network/agent-interface';
|
|
4
|
+
export { InteractionData, InteractionOutcome, InteractionRequest } from '@tangle-network/agent-interface';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Server-side client for the sandbox sidecar's generic interaction routes
|
|
8
|
+
* (`GET/POST {runtimeUrl}/agents/sessions/{sessionId}/interactions`). The
|
|
9
|
+
* pinned sandbox SDK exposes only the question-specific `session().answer()`
|
|
10
|
+
* convenience; these raw calls are backend-agnostic (question/permission/plan,
|
|
11
|
+
* any harness) and carry explicit outcomes (accepted/declined).
|
|
12
|
+
*
|
|
13
|
+
* Server-only: the sidecar bearer must never reach browser code. The caller
|
|
14
|
+
* supplies the connection as a structural value (runtime URL + bearer +
|
|
15
|
+
* session id) — no sandbox-SDK import, so any box-resolution strategy works.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
interface SidecarInteractionsError {
|
|
19
|
+
code: string;
|
|
20
|
+
message: string;
|
|
21
|
+
/** Upstream HTTP status; 0 when the sidecar was unreachable. */
|
|
22
|
+
status: number;
|
|
23
|
+
}
|
|
24
|
+
type SidecarInteractionsResult<T> = {
|
|
25
|
+
succeeded: true;
|
|
26
|
+
value: T;
|
|
27
|
+
} | {
|
|
28
|
+
succeeded: false;
|
|
29
|
+
error: SidecarInteractionsError;
|
|
30
|
+
};
|
|
31
|
+
/** Where and how to reach one session's interaction registry. */
|
|
32
|
+
interface SidecarInteractionsConnection {
|
|
33
|
+
runtimeUrl: string;
|
|
34
|
+
authToken?: string;
|
|
35
|
+
/** The sidecar agent-session id (the chat thread's session). */
|
|
36
|
+
sessionId: string;
|
|
37
|
+
/** Request deadline. A pending interaction means the box is up and the
|
|
38
|
+
* sidecar responsive; a short default keeps a wedged runtime from stalling
|
|
39
|
+
* the answering request. */
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
/** Injection seam for tests; defaults to global fetch. */
|
|
42
|
+
fetchImpl?: typeof fetch;
|
|
43
|
+
}
|
|
44
|
+
/** Outstanding (unanswered) interactions for the session — the sidecar's
|
|
45
|
+
* registry is authoritative, so this is the reconnect/reload source of truth. */
|
|
46
|
+
declare function listSessionInteractions(connection: SidecarInteractionsConnection): Promise<SidecarInteractionsResult<InteractionRequestWire[]>>;
|
|
47
|
+
/** Resolves one interaction. `data` is required by the sidecar only for
|
|
48
|
+
* `accepted` outcomes and is validated fail-closed against the answerSpec
|
|
49
|
+
* (400 INVALID_INTERACTION_ANSWER on mismatch). */
|
|
50
|
+
declare function respondToSessionInteraction(connection: SidecarInteractionsConnection, response: {
|
|
51
|
+
id: string;
|
|
52
|
+
outcome: InteractionOutcome;
|
|
53
|
+
data?: InteractionData;
|
|
54
|
+
}): Promise<SidecarInteractionsResult<void>>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Framework-neutral interaction-answer endpoints, lifted out of the per-app
|
|
58
|
+
* route files (gtm `api.chat.interactions`, legal `api.chat.interactions`,
|
|
59
|
+
* tax `api.sessions.$id.interactions` — three byte-similar forks):
|
|
60
|
+
*
|
|
61
|
+
* list(request) — GET: outstanding asks for a live turn (reload restore)
|
|
62
|
+
* answer(request) — POST `{ id, outcome, data? }`: resolve one ask
|
|
63
|
+
*
|
|
64
|
+
* The product supplies ONE seam, `resolveConnection`: authenticate the caller,
|
|
65
|
+
* authorize the thread/session, and resolve the sidecar connection. Everything
|
|
66
|
+
* behind the seam is mechanism the forks kept re-fixing:
|
|
67
|
+
*
|
|
68
|
+
* - body validation (safe field keys, typed values),
|
|
69
|
+
* - sidecar error → client contract mapping (every "the ask is gone" shape
|
|
70
|
+
* becomes 410 so the card flips to its expired state),
|
|
71
|
+
* - duplicate resolution: after answering, every other outstanding ask with
|
|
72
|
+
* the same content signature (a re-emitted duplicate) gets the same answer,
|
|
73
|
+
* - unblock verification: re-list and fail loud (503 INTERACTION_STILL_PENDING)
|
|
74
|
+
* when the sidecar accepted the POST but the ask is still open,
|
|
75
|
+
* - best-effort list: sidecar failures return `{ interactions: [],
|
|
76
|
+
* unavailable }` so a reload restore never breaks the live stream.
|
|
77
|
+
*
|
|
78
|
+
* Handlers return web-standard `Response`s (Workers, Node 18+, Deno) — no
|
|
79
|
+
* router import anywhere.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
type InteractionClientOutcome = 'accepted' | 'declined';
|
|
83
|
+
type InteractionAnswerBodyValidation = {
|
|
84
|
+
ok: true;
|
|
85
|
+
id: string;
|
|
86
|
+
outcome: InteractionClientOutcome;
|
|
87
|
+
data?: InteractionData;
|
|
88
|
+
} | {
|
|
89
|
+
ok: false;
|
|
90
|
+
error: string;
|
|
91
|
+
};
|
|
92
|
+
/** Validates the client POST body: `{ id, outcome, data? }` with
|
|
93
|
+
* identifier-safe field keys and primitive/string-array values only. */
|
|
94
|
+
declare function validateInteractionAnswerBody(body: Record<string, unknown>): InteractionAnswerBodyValidation;
|
|
95
|
+
type InteractionRouteLogger = Pick<Console, 'warn' | 'error'>;
|
|
96
|
+
/** Sidecar error → the client-actionable contract. Every "the ask is gone"
|
|
97
|
+
* shape maps to 410 so the card flips to its expired state — a raw 404/409
|
|
98
|
+
* must never surface. */
|
|
99
|
+
declare function mapInteractionRespondFailure(error: SidecarInteractionsError, logger?: InteractionRouteLogger): Response;
|
|
100
|
+
/** The product seam's verdict for one request. `response` short-circuits with
|
|
101
|
+
* a product-authored Response (401/404/429…); `unavailable` means the caller
|
|
102
|
+
* is fine but the sandbox runtime is not reachable — the factory shapes that
|
|
103
|
+
* per intent (empty list for `list`, 503 for `answer`). */
|
|
104
|
+
type InteractionConnectionResolution = {
|
|
105
|
+
ok: true;
|
|
106
|
+
connection: SidecarInteractionsConnection;
|
|
107
|
+
} | {
|
|
108
|
+
ok: false;
|
|
109
|
+
response: Response;
|
|
110
|
+
} | {
|
|
111
|
+
ok: false;
|
|
112
|
+
unavailable: string;
|
|
113
|
+
};
|
|
114
|
+
interface ResolveInteractionConnectionArgs {
|
|
115
|
+
request: Request;
|
|
116
|
+
intent: 'list' | 'answer';
|
|
117
|
+
/** The parsed, validated POST body (answer intent only) so the resolver can
|
|
118
|
+
* read product routing fields (workspaceId/threadId) without re-parsing. */
|
|
119
|
+
body?: Record<string, unknown>;
|
|
120
|
+
}
|
|
121
|
+
interface InteractionAnswerRouteOptions {
|
|
122
|
+
/** Authenticate + authorize the caller and resolve the sidecar connection.
|
|
123
|
+
* This is the only product-supplied step: session auth, workspace/thread
|
|
124
|
+
* access, rate limiting, and box resolution all live here. */
|
|
125
|
+
resolveConnection: (args: ResolveInteractionConnectionArgs) => Promise<InteractionConnectionResolution>;
|
|
126
|
+
logger?: InteractionRouteLogger;
|
|
127
|
+
}
|
|
128
|
+
interface InteractionAnswerRoute {
|
|
129
|
+
/** GET — outstanding interactions for a live turn. Failures return an empty
|
|
130
|
+
* list with an explicit `unavailable` code: the caller is a best-effort
|
|
131
|
+
* reload restore, and the live/replayed stream must stay untouched when the
|
|
132
|
+
* sidecar cannot answer. */
|
|
133
|
+
list: (request: Request) => Promise<Response>;
|
|
134
|
+
/** POST `{ id, outcome, data?, ...productFields }` — resolve one ask, answer
|
|
135
|
+
* content-identical duplicates the same way, then re-list to prove the run
|
|
136
|
+
* actually unblocked. */
|
|
137
|
+
answer: (request: Request) => Promise<Response>;
|
|
138
|
+
}
|
|
139
|
+
declare function createInteractionAnswerRoute(options: InteractionAnswerRouteOptions): InteractionAnswerRoute;
|
|
140
|
+
|
|
141
|
+
export { type InteractionAnswerBodyValidation, type InteractionAnswerRoute, type InteractionAnswerRouteOptions, type InteractionClientOutcome, type InteractionConnectionResolution, InteractionRequestWire, type InteractionRouteLogger, type ResolveInteractionConnectionArgs, type SidecarInteractionsConnection, type SidecarInteractionsError, type SidecarInteractionsResult, createInteractionAnswerRoute, listSessionInteractions, mapInteractionRespondFailure, respondToSessionInteraction, validateInteractionAnswerBody };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createInteractionAnswerRoute,
|
|
3
|
+
listSessionInteractions,
|
|
4
|
+
mapInteractionRespondFailure,
|
|
5
|
+
respondToSessionInteraction,
|
|
6
|
+
validateInteractionAnswerBody
|
|
7
|
+
} from "../chunk-U7DLCPJ6.js";
|
|
8
|
+
import {
|
|
9
|
+
INTERACTION_CANCEL_EVENT,
|
|
10
|
+
INTERACTION_EVENT,
|
|
11
|
+
INTERACTION_RESOLVED_EVENT,
|
|
12
|
+
canTransitionInteractionStatus,
|
|
13
|
+
cancelStatusFor,
|
|
14
|
+
composerAnswerData,
|
|
15
|
+
composerAnswerDeliveries,
|
|
16
|
+
dedupeQuestionInteractionsByContent,
|
|
17
|
+
fieldAcceptsFreeText,
|
|
18
|
+
interactionFromWireRequest,
|
|
19
|
+
interactionPartKey,
|
|
20
|
+
interactionToPersistedPart,
|
|
21
|
+
isRenderableInteractionKind,
|
|
22
|
+
isSafeInteractionFieldKey,
|
|
23
|
+
isTerminalInteractionStatus,
|
|
24
|
+
noticePart,
|
|
25
|
+
noticePartKey,
|
|
26
|
+
parseInteractionCancel,
|
|
27
|
+
parseInteractionRequest,
|
|
28
|
+
persistedPartToInteraction,
|
|
29
|
+
questionInteractionContentSignature
|
|
30
|
+
} from "../chunk-4TXDD6P2.js";
|
|
31
|
+
export {
|
|
32
|
+
INTERACTION_CANCEL_EVENT,
|
|
33
|
+
INTERACTION_EVENT,
|
|
34
|
+
INTERACTION_RESOLVED_EVENT,
|
|
35
|
+
canTransitionInteractionStatus,
|
|
36
|
+
cancelStatusFor,
|
|
37
|
+
composerAnswerData,
|
|
38
|
+
composerAnswerDeliveries,
|
|
39
|
+
createInteractionAnswerRoute,
|
|
40
|
+
dedupeQuestionInteractionsByContent,
|
|
41
|
+
fieldAcceptsFreeText,
|
|
42
|
+
interactionFromWireRequest,
|
|
43
|
+
interactionPartKey,
|
|
44
|
+
interactionToPersistedPart,
|
|
45
|
+
isRenderableInteractionKind,
|
|
46
|
+
isSafeInteractionFieldKey,
|
|
47
|
+
isTerminalInteractionStatus,
|
|
48
|
+
listSessionInteractions,
|
|
49
|
+
mapInteractionRespondFailure,
|
|
50
|
+
noticePart,
|
|
51
|
+
noticePartKey,
|
|
52
|
+
parseInteractionCancel,
|
|
53
|
+
parseInteractionRequest,
|
|
54
|
+
persistedPartToInteraction,
|
|
55
|
+
questionInteractionContentSignature,
|
|
56
|
+
respondToSessionInteraction,
|
|
57
|
+
validateInteractionAnswerBody
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|