@tangle-network/agent-app 0.43.41 → 0.43.42
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/assistant/index.d.ts +2 -1
- package/dist/assistant/index.js +3 -2
- package/dist/assistant/index.js.map +1 -1
- package/dist/chat-routes/index.d.ts +17 -3
- package/dist/chat-routes/index.js +91 -6
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/chat-store/index.d.ts +4 -3
- package/dist/chat-store/index.js +5 -1
- package/dist/chat-store/index.js.map +1 -1
- package/dist/{chunk-Y4QHNQ75.js → chunk-6KVH5SP5.js} +110 -6
- package/dist/chunk-6KVH5SP5.js.map +1 -0
- package/dist/{chunk-XYWCGFII.js → chunk-B5JD3DXD.js} +48 -2
- package/dist/chunk-B5JD3DXD.js.map +1 -0
- package/dist/{chunk-I2R2XT4M.js → chunk-I2ATYB7R.js} +18 -2
- package/dist/chunk-I2ATYB7R.js.map +1 -0
- package/dist/chunk-SIXYZ2FB.js +101 -0
- package/dist/chunk-SIXYZ2FB.js.map +1 -0
- package/dist/{chunk-4TXDD6P2.js → chunk-XAWFPMAR.js} +38 -3
- package/dist/chunk-XAWFPMAR.js.map +1 -0
- package/dist/{chunk-KM766NN3.js → chunk-ZLHK25C3.js} +1766 -1223
- package/dist/chunk-ZLHK25C3.js.map +1 -0
- package/dist/chunk-ZU5GNSOJ.js +920 -0
- package/dist/chunk-ZU5GNSOJ.js.map +1 -0
- package/dist/{contract-DYbTzEDf.d.ts → contract-KfqJh_au.d.ts} +23 -2
- package/dist/design-canvas-react/index.js +4 -4
- package/dist/durable-chat/index.d.ts +419 -0
- package/dist/durable-chat/index.js +59 -0
- package/dist/durable-chat/index.js.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +123 -45
- package/dist/interactions/index.d.ts +58 -3
- package/dist/interactions/index.js +7 -3
- package/dist/{parts-BcbitSNp.d.ts → parts-DjX0RRTS.d.ts} +9 -3
- package/dist/plans/index.d.ts +69 -0
- package/dist/plans/index.js +21 -0
- package/dist/plans/index.js.map +1 -0
- package/dist/stream/index.js +3 -1
- package/dist/teams/index.js +9 -9
- package/dist/teams/invitations-api.js +3 -3
- package/dist/web-react/index.d.ts +252 -93
- package/dist/web-react/index.js +32 -3
- package/package.json +11 -1
- package/dist/chunk-4TXDD6P2.js.map +0 -1
- package/dist/chunk-I2R2XT4M.js.map +0 -1
- package/dist/chunk-KM766NN3.js.map +0 -1
- package/dist/chunk-XYWCGFII.js.map +0 -1
- package/dist/chunk-Y4QHNQ75.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,34 @@
|
|
|
1
|
+
import "./chunk-UAKFCMWK.js";
|
|
1
2
|
import {
|
|
2
3
|
checkThemeContract
|
|
3
4
|
} from "./chunk-NYATNLRK.js";
|
|
4
|
-
import
|
|
5
|
+
import {
|
|
6
|
+
darkTheme,
|
|
7
|
+
lightTheme,
|
|
8
|
+
themeColor,
|
|
9
|
+
themeToCssVars
|
|
10
|
+
} from "./chunk-47C6PJCW.js";
|
|
11
|
+
import {
|
|
12
|
+
buildFlowTrace,
|
|
13
|
+
childSpanContext,
|
|
14
|
+
createMissionTraceContext,
|
|
15
|
+
renderHistogram,
|
|
16
|
+
renderWaterfall,
|
|
17
|
+
summarize,
|
|
18
|
+
timedEventsFromLines,
|
|
19
|
+
traceEnv
|
|
20
|
+
} from "./chunk-GQRL6VNU.js";
|
|
21
|
+
import {
|
|
22
|
+
ApprovalEventSchema,
|
|
23
|
+
BrandTokensSchema,
|
|
24
|
+
ConversionMetricsSchema,
|
|
25
|
+
CopyContentSchema,
|
|
26
|
+
EmailContentSchema,
|
|
27
|
+
ImageContentSchema,
|
|
28
|
+
VideoContentSchema,
|
|
29
|
+
parseAssetSpec,
|
|
30
|
+
safeParseAssetSpec
|
|
31
|
+
} from "./chunk-5PTGEJZL.js";
|
|
5
32
|
import {
|
|
6
33
|
DEFAULT_SEQUENCES_MCP_DESCRIPTION,
|
|
7
34
|
MAX_CAPTION_BATCH,
|
|
@@ -72,12 +99,6 @@ import {
|
|
|
72
99
|
listTemplateSlots,
|
|
73
100
|
validateBindings
|
|
74
101
|
} from "./chunk-WFMUDX5J.js";
|
|
75
|
-
import {
|
|
76
|
-
darkTheme,
|
|
77
|
-
lightTheme,
|
|
78
|
-
themeColor,
|
|
79
|
-
themeToCssVars
|
|
80
|
-
} from "./chunk-47C6PJCW.js";
|
|
81
102
|
import {
|
|
82
103
|
CHANNEL_PRESETS,
|
|
83
104
|
EXPORT_PRESETS,
|
|
@@ -112,6 +133,12 @@ import {
|
|
|
112
133
|
validateSceneOperations,
|
|
113
134
|
validateSlotValue
|
|
114
135
|
} from "./chunk-M2EBUDZ7.js";
|
|
136
|
+
import {
|
|
137
|
+
composeMissionFlowTrace,
|
|
138
|
+
delegationActivityToFlowSpans,
|
|
139
|
+
loopTraceEventsToFlowSpans,
|
|
140
|
+
stepActivityFlowTrace
|
|
141
|
+
} from "./chunk-2QI7XV2T.js";
|
|
115
142
|
import {
|
|
116
143
|
DEFAULT_REDACTION_PATTERNS,
|
|
117
144
|
buildRedactedDocument,
|
|
@@ -120,33 +147,40 @@ import {
|
|
|
120
147
|
redactForIngestion,
|
|
121
148
|
revealSpan
|
|
122
149
|
} from "./chunk-5RMIUJDI.js";
|
|
123
|
-
import {
|
|
124
|
-
buildFlowTrace,
|
|
125
|
-
childSpanContext,
|
|
126
|
-
createMissionTraceContext,
|
|
127
|
-
renderHistogram,
|
|
128
|
-
renderWaterfall,
|
|
129
|
-
summarize,
|
|
130
|
-
timedEventsFromLines,
|
|
131
|
-
traceEnv
|
|
132
|
-
} from "./chunk-GQRL6VNU.js";
|
|
133
|
-
import {
|
|
134
|
-
ApprovalEventSchema,
|
|
135
|
-
BrandTokensSchema,
|
|
136
|
-
ConversionMetricsSchema,
|
|
137
|
-
CopyContentSchema,
|
|
138
|
-
EmailContentSchema,
|
|
139
|
-
ImageContentSchema,
|
|
140
|
-
VideoContentSchema,
|
|
141
|
-
parseAssetSpec,
|
|
142
|
-
safeParseAssetSpec
|
|
143
|
-
} from "./chunk-5PTGEJZL.js";
|
|
144
150
|
import {
|
|
145
151
|
HubExecClient,
|
|
146
152
|
invokeIntegrationHub,
|
|
147
153
|
resolveIntegrationAction
|
|
148
154
|
} from "./chunk-L2TG5DBW.js";
|
|
149
155
|
import "./chunk-7LNGJDNA.js";
|
|
156
|
+
import {
|
|
157
|
+
DurableChatConflictError,
|
|
158
|
+
DurableChatError,
|
|
159
|
+
DurableChatGoneError,
|
|
160
|
+
DurableChatUnavailableError,
|
|
161
|
+
InMemoryDurableChatStateStore,
|
|
162
|
+
InMemoryDurableChatStore,
|
|
163
|
+
applyDurableInteractionAnswer,
|
|
164
|
+
applyDurableInteractionAsk,
|
|
165
|
+
applyDurableInteractionCancel,
|
|
166
|
+
createDurableChatEventProjection,
|
|
167
|
+
createDurableChatScope,
|
|
168
|
+
createDurableInteractionProjectionAdapter,
|
|
169
|
+
createDurableInteractionRoutePersistence,
|
|
170
|
+
createDurableInteractionSettlement,
|
|
171
|
+
createDurablePlanRoutes,
|
|
172
|
+
createInMemoryDurableChatStateStore,
|
|
173
|
+
durableChatScopeKey,
|
|
174
|
+
durableInteractionIntentKey,
|
|
175
|
+
normalizePlanDecision,
|
|
176
|
+
planAuthorityIdempotencyKey,
|
|
177
|
+
planCommandKey,
|
|
178
|
+
planEffectKey,
|
|
179
|
+
recordDurableInteractionAnswer,
|
|
180
|
+
recordDurableInteractionCancel,
|
|
181
|
+
stablePlanReceipt,
|
|
182
|
+
upsertDurableInteractionAsk
|
|
183
|
+
} from "./chunk-ZU5GNSOJ.js";
|
|
150
184
|
import {
|
|
151
185
|
DEFAULT_MISSION_STEP_KINDS,
|
|
152
186
|
MISSION_CONTROL_CHANNEL_ID,
|
|
@@ -170,12 +204,6 @@ import {
|
|
|
170
204
|
stepGateProposalId,
|
|
171
205
|
volumeGateProposalId
|
|
172
206
|
} from "./chunk-YNALYIQ3.js";
|
|
173
|
-
import {
|
|
174
|
-
composeMissionFlowTrace,
|
|
175
|
-
delegationActivityToFlowSpans,
|
|
176
|
-
loopTraceEventsToFlowSpans,
|
|
177
|
-
stepActivityFlowTrace
|
|
178
|
-
} from "./chunk-2QI7XV2T.js";
|
|
179
207
|
import {
|
|
180
208
|
agentAppConfigJsonSchema,
|
|
181
209
|
defineAgentApp
|
|
@@ -240,14 +268,14 @@ import {
|
|
|
240
268
|
resolveChatTurn,
|
|
241
269
|
resolveToolId,
|
|
242
270
|
resolveToolName
|
|
243
|
-
} from "./chunk-
|
|
271
|
+
} from "./chunk-B5JD3DXD.js";
|
|
244
272
|
import {
|
|
245
273
|
createInteractionAnswerRoute,
|
|
246
274
|
listSessionInteractions,
|
|
247
275
|
mapInteractionRespondFailure,
|
|
248
276
|
respondToSessionInteraction,
|
|
249
277
|
validateInteractionAnswerBody
|
|
250
|
-
} from "./chunk-
|
|
278
|
+
} from "./chunk-6KVH5SP5.js";
|
|
251
279
|
import {
|
|
252
280
|
addSecurityHeaders,
|
|
253
281
|
assertMediaUrl,
|
|
@@ -259,6 +287,14 @@ import {
|
|
|
259
287
|
requireString,
|
|
260
288
|
serializeCookie
|
|
261
289
|
} from "./chunk-HFC4BTWJ.js";
|
|
290
|
+
import {
|
|
291
|
+
isChatInteractionPart,
|
|
292
|
+
isChatPlanPart,
|
|
293
|
+
isChatStepFinishPart,
|
|
294
|
+
isChatTextPart,
|
|
295
|
+
isChatToolPart,
|
|
296
|
+
toChatMessageParts
|
|
297
|
+
} from "./chunk-I2ATYB7R.js";
|
|
262
298
|
import {
|
|
263
299
|
INTERACTION_CANCEL_EVENT,
|
|
264
300
|
INTERACTION_EVENT,
|
|
@@ -277,18 +313,23 @@ import {
|
|
|
277
313
|
isTerminalInteractionStatus,
|
|
278
314
|
noticePart,
|
|
279
315
|
noticePartKey,
|
|
316
|
+
parseInteractionAnswers,
|
|
280
317
|
parseInteractionCancel,
|
|
281
318
|
parseInteractionRequest,
|
|
282
319
|
persistedPartToInteraction,
|
|
283
|
-
questionInteractionContentSignature
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
320
|
+
questionInteractionContentSignature,
|
|
321
|
+
stampInteractionAnswers
|
|
322
|
+
} from "./chunk-XAWFPMAR.js";
|
|
323
|
+
import {
|
|
324
|
+
PLAN_SUBMITTED_EVENT,
|
|
325
|
+
canTransitionPlanStatus,
|
|
326
|
+
parsePlanSubmittedEvent,
|
|
327
|
+
persistedPartToPlan,
|
|
328
|
+
planFollowUpTurnId,
|
|
329
|
+
planPartKey,
|
|
330
|
+
planRevisionKey,
|
|
331
|
+
planToPersistedPart
|
|
332
|
+
} from "./chunk-SIXYZ2FB.js";
|
|
292
333
|
import {
|
|
293
334
|
createFieldCrypto,
|
|
294
335
|
decodeHexKey,
|
|
@@ -477,6 +518,10 @@ export {
|
|
|
477
518
|
DEFAULT_SEQUENCES_MCP_DESCRIPTION,
|
|
478
519
|
DEFAULT_TANGLE_BILLING_ENFORCEMENT_ENV_VAR,
|
|
479
520
|
DEFAULT_TANGLE_ROUTER_BASE_URL,
|
|
521
|
+
DurableChatConflictError,
|
|
522
|
+
DurableChatError,
|
|
523
|
+
DurableChatGoneError,
|
|
524
|
+
DurableChatUnavailableError,
|
|
480
525
|
ENV_TOTAL_MAX_BYTES,
|
|
481
526
|
ENV_VALUE_MAX_BYTES,
|
|
482
527
|
EXPORT_PRESETS,
|
|
@@ -486,12 +531,15 @@ export {
|
|
|
486
531
|
INTERACTION_EVENT,
|
|
487
532
|
INTERACTION_RESOLVED_EVENT,
|
|
488
533
|
ImageContentSchema,
|
|
534
|
+
InMemoryDurableChatStateStore,
|
|
535
|
+
InMemoryDurableChatStore,
|
|
489
536
|
KNOWN_HARNESSES,
|
|
490
537
|
MAX_CAPTION_BATCH,
|
|
491
538
|
MCP_PROTOCOL_VERSIONS,
|
|
492
539
|
MIN_SEQUENCE_CLIP_FRAMES,
|
|
493
540
|
MISSION_CONTROL_CHANNEL_ID,
|
|
494
541
|
MissionConcurrencyError,
|
|
542
|
+
PLAN_SUBMITTED_EVENT,
|
|
495
543
|
PRESET_MIGRATION_SQL,
|
|
496
544
|
PRESET_TABLES,
|
|
497
545
|
PROVISION_PAYLOAD_MAX_BYTES,
|
|
@@ -516,6 +564,9 @@ export {
|
|
|
516
564
|
addSecurityHeaders,
|
|
517
565
|
agentAppConfigJsonSchema,
|
|
518
566
|
applyBindingsToDocument,
|
|
567
|
+
applyDurableInteractionAnswer,
|
|
568
|
+
applyDurableInteractionAsk,
|
|
569
|
+
applyDurableInteractionCancel,
|
|
519
570
|
applyMissionEvent,
|
|
520
571
|
applySceneOperation,
|
|
521
572
|
applySceneOperations,
|
|
@@ -567,6 +618,7 @@ export {
|
|
|
567
618
|
buildUserTextParts,
|
|
568
619
|
buildVtt,
|
|
569
620
|
canTransitionInteractionStatus,
|
|
621
|
+
canTransitionPlanStatus,
|
|
570
622
|
cancelStatusFor,
|
|
571
623
|
captionCoverage,
|
|
572
624
|
captionTrackNameForLanguage,
|
|
@@ -594,9 +646,16 @@ export {
|
|
|
594
646
|
createD1KnowledgeStateAccessor,
|
|
595
647
|
createD1TurnEventStore,
|
|
596
648
|
createDesignCanvasMcpHandler,
|
|
649
|
+
createDurableChatEventProjection,
|
|
650
|
+
createDurableChatScope,
|
|
651
|
+
createDurableInteractionProjectionAdapter,
|
|
652
|
+
createDurableInteractionRoutePersistence,
|
|
653
|
+
createDurableInteractionSettlement,
|
|
654
|
+
createDurablePlanRoutes,
|
|
597
655
|
createEmptyDocument,
|
|
598
656
|
createExpiringCapabilityToken,
|
|
599
657
|
createFieldCrypto,
|
|
658
|
+
createInMemoryDurableChatStateStore,
|
|
600
659
|
createInMemoryMissionStore,
|
|
601
660
|
createInteractionAnswerRoute,
|
|
602
661
|
createKnowledgeLoop,
|
|
@@ -647,6 +706,8 @@ export {
|
|
|
647
706
|
detectSpans,
|
|
648
707
|
dispatchAppTool,
|
|
649
708
|
driveSandboxTurn,
|
|
709
|
+
durableChatScopeKey,
|
|
710
|
+
durableInteractionIntentKey,
|
|
650
711
|
elementAabb,
|
|
651
712
|
elementExtent,
|
|
652
713
|
encodeEvent,
|
|
@@ -682,6 +743,7 @@ export {
|
|
|
682
743
|
invokeIntegrationHub,
|
|
683
744
|
isAppToolName,
|
|
684
745
|
isChatInteractionPart,
|
|
746
|
+
isChatPlanPart,
|
|
685
747
|
isChatStepFinishPart,
|
|
686
748
|
isChatTextPart,
|
|
687
749
|
isChatToolPart,
|
|
@@ -719,6 +781,7 @@ export {
|
|
|
719
781
|
normalizeLanguageTag,
|
|
720
782
|
normalizeModelId,
|
|
721
783
|
normalizePersistedPart,
|
|
784
|
+
normalizePlanDecision,
|
|
722
785
|
normalizeTime,
|
|
723
786
|
normalizeToolEvent,
|
|
724
787
|
noticePart,
|
|
@@ -726,20 +789,32 @@ export {
|
|
|
726
789
|
objectKey,
|
|
727
790
|
outcomeStatus,
|
|
728
791
|
parseAssetSpec,
|
|
792
|
+
parseInteractionAnswers,
|
|
729
793
|
parseInteractionCancel,
|
|
730
794
|
parseInteractionRequest,
|
|
731
795
|
parseJsonObjectBody,
|
|
732
796
|
parseMissionBlocks,
|
|
797
|
+
parsePlanSubmittedEvent,
|
|
733
798
|
parseSequenceOperations,
|
|
734
799
|
parseSessionStreamEnvelope,
|
|
735
800
|
persistedPartToInteraction,
|
|
801
|
+
persistedPartToPlan,
|
|
802
|
+
planAuthorityIdempotencyKey,
|
|
803
|
+
planCommandKey,
|
|
804
|
+
planEffectKey,
|
|
805
|
+
planFollowUpTurnId,
|
|
736
806
|
planLanguageFanout,
|
|
807
|
+
planPartKey,
|
|
808
|
+
planRevisionKey,
|
|
809
|
+
planToPersistedPart,
|
|
737
810
|
producedFromToolEvents,
|
|
738
811
|
pumpBufferedTurn,
|
|
739
812
|
questionInteractionContentSignature,
|
|
740
813
|
readCookieValue,
|
|
741
814
|
readSecret,
|
|
742
815
|
readToolArgs,
|
|
816
|
+
recordDurableInteractionAnswer,
|
|
817
|
+
recordDurableInteractionCancel,
|
|
743
818
|
redactForIngestion,
|
|
744
819
|
reduceMissionEvents,
|
|
745
820
|
renderHistogram,
|
|
@@ -790,6 +865,8 @@ export {
|
|
|
790
865
|
snapModelToHarness,
|
|
791
866
|
snapshotFrame,
|
|
792
867
|
splitDeferredProfileFiles,
|
|
868
|
+
stablePlanReceipt,
|
|
869
|
+
stampInteractionAnswers,
|
|
793
870
|
stepActivityFlowTrace,
|
|
794
871
|
stepAgentActivity,
|
|
795
872
|
stepGateProposalId,
|
|
@@ -812,6 +889,7 @@ export {
|
|
|
812
889
|
traceEnv,
|
|
813
890
|
trackIntervals,
|
|
814
891
|
trimOrNull,
|
|
892
|
+
upsertDurableInteractionAsk,
|
|
815
893
|
validateAddCaption,
|
|
816
894
|
validateBindings,
|
|
817
895
|
validateCreateTrack,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
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
|
|
1
|
+
import { k as InteractionRequestWire } from '../contract-KfqJh_au.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 InteractionAnswerValue, h as InteractionAnswers, i as InteractionCancelData, j as InteractionPersistedPart, N as NoticeKind, l as NoticePersistedPart, P as ParseInteractionAnswersResult, m as ParseInteractionResult, n as canTransitionInteractionStatus, o as cancelStatusFor, p as composerAnswerData, q as composerAnswerDeliveries, r as dedupeQuestionInteractionsByContent, s as fieldAcceptsFreeText, t as interactionFromWireRequest, u as interactionPartKey, v as interactionToPersistedPart, w as isRenderableInteractionKind, x as isSafeInteractionFieldKey, y as isTerminalInteractionStatus, z as noticePart, A as noticePartKey, B as parseInteractionAnswers, D as parseInteractionCancel, E as parseInteractionRequest, F as persistedPartToInteraction, G as questionInteractionContentSignature, H as stampInteractionAnswers } from '../contract-KfqJh_au.js';
|
|
3
3
|
import { InteractionOutcome, InteractionData } from '@tangle-network/agent-interface';
|
|
4
4
|
export { InteractionData, InteractionOutcome, InteractionRequest } from '@tangle-network/agent-interface';
|
|
5
5
|
|
|
@@ -118,11 +118,66 @@ interface ResolveInteractionConnectionArgs {
|
|
|
118
118
|
* read product routing fields (workspaceId/threadId) without re-parsing. */
|
|
119
119
|
body?: Record<string, unknown>;
|
|
120
120
|
}
|
|
121
|
+
interface BeforeInteractionAnswerArgs {
|
|
122
|
+
request: Request;
|
|
123
|
+
/** Original parsed body, including product routing fields. */
|
|
124
|
+
body: Record<string, unknown>;
|
|
125
|
+
/** Shared validation result; products never need to parse the answer again. */
|
|
126
|
+
answer: Extract<InteractionAnswerBodyValidation, {
|
|
127
|
+
ok: true;
|
|
128
|
+
}>;
|
|
129
|
+
connection: SidecarInteractionsConnection;
|
|
130
|
+
/** The route's single authoritative pre-answer sidecar snapshot. */
|
|
131
|
+
outstanding: InteractionRequestWire[];
|
|
132
|
+
answeredRequest?: InteractionRequestWire;
|
|
133
|
+
/** Content-identical questions that the shared route will also answer. */
|
|
134
|
+
duplicateRequests: InteractionRequestWire[];
|
|
135
|
+
}
|
|
136
|
+
interface DurableInteractionRouteArgs extends BeforeInteractionAnswerArgs {
|
|
137
|
+
/** Caller-created opaque identifier, stable across an ambiguous retry. */
|
|
138
|
+
attemptKey: string;
|
|
139
|
+
}
|
|
140
|
+
/** Crash-recoverable persistence lifecycle for the answer route. The product
|
|
141
|
+
* binds this structural port to `/durable-chat` (or an equivalent durable
|
|
142
|
+
* store). Existing `beforeAnswer` behavior remains independent and unchanged. */
|
|
143
|
+
interface DurableInteractionRoutePersistence<TPrepared = unknown> {
|
|
144
|
+
guarantee: 'reconciled' | 'best-effort';
|
|
145
|
+
prepare(args: DurableInteractionRouteArgs): TPrepared | Promise<TPrepared>;
|
|
146
|
+
/** Resolve an ambiguous retry (for example, the sidecar says the ask is
|
|
147
|
+
* already gone). Only `settled:true` permits the route to report success. */
|
|
148
|
+
reconcile(args: DurableInteractionRouteArgs & {
|
|
149
|
+
prepared: TPrepared;
|
|
150
|
+
}): {
|
|
151
|
+
settled: boolean;
|
|
152
|
+
} | Promise<{
|
|
153
|
+
settled: boolean;
|
|
154
|
+
}>;
|
|
155
|
+
/** Record the authority acknowledgement before terminal projection. */
|
|
156
|
+
acknowledge(args: DurableInteractionRouteArgs & {
|
|
157
|
+
prepared: TPrepared;
|
|
158
|
+
duplicateIds: string[];
|
|
159
|
+
}): void | Promise<void>;
|
|
160
|
+
/** Idempotently materialize terminal status and accepted values. */
|
|
161
|
+
finalize(args: DurableInteractionRouteArgs & {
|
|
162
|
+
prepared: TPrepared;
|
|
163
|
+
duplicateIds: string[];
|
|
164
|
+
}): void | Promise<void>;
|
|
165
|
+
fail?(args: DurableInteractionRouteArgs & {
|
|
166
|
+
prepared: TPrepared;
|
|
167
|
+
error: unknown;
|
|
168
|
+
}): void | Promise<void>;
|
|
169
|
+
}
|
|
121
170
|
interface InteractionAnswerRouteOptions {
|
|
122
171
|
/** Authenticate + authorize the caller and resolve the sidecar connection.
|
|
123
172
|
* This is the only product-supplied step: session auth, workspace/thread
|
|
124
173
|
* access, rate limiting, and box resolution all live here. */
|
|
125
174
|
resolveConnection: (args: ResolveInteractionConnectionArgs) => Promise<InteractionConnectionResolution>;
|
|
175
|
+
/** Product persistence seam that runs before the answer can unblock and
|
|
176
|
+
* finalize the agent turn. A throw aborts the request before any answer POST. */
|
|
177
|
+
beforeAnswer?: (args: BeforeInteractionAnswerArgs) => void | Promise<void>;
|
|
178
|
+
/** Additive crash-recoverable settlement. When configured, POST requires an
|
|
179
|
+
* `attemptKey`; accepted values are finalized only after sidecar ack. */
|
|
180
|
+
durable?: DurableInteractionRoutePersistence;
|
|
126
181
|
logger?: InteractionRouteLogger;
|
|
127
182
|
}
|
|
128
183
|
interface InteractionAnswerRoute {
|
|
@@ -138,4 +193,4 @@ interface InteractionAnswerRoute {
|
|
|
138
193
|
}
|
|
139
194
|
declare function createInteractionAnswerRoute(options: InteractionAnswerRouteOptions): InteractionAnswerRoute;
|
|
140
195
|
|
|
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 };
|
|
196
|
+
export { type BeforeInteractionAnswerArgs, type DurableInteractionRouteArgs, type DurableInteractionRoutePersistence, 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 };
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
mapInteractionRespondFailure,
|
|
6
6
|
respondToSessionInteraction,
|
|
7
7
|
validateInteractionAnswerBody
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-6KVH5SP5.js";
|
|
9
9
|
import {
|
|
10
10
|
INTERACTION_CANCEL_EVENT,
|
|
11
11
|
INTERACTION_EVENT,
|
|
@@ -24,11 +24,13 @@ import {
|
|
|
24
24
|
isTerminalInteractionStatus,
|
|
25
25
|
noticePart,
|
|
26
26
|
noticePartKey,
|
|
27
|
+
parseInteractionAnswers,
|
|
27
28
|
parseInteractionCancel,
|
|
28
29
|
parseInteractionRequest,
|
|
29
30
|
persistedPartToInteraction,
|
|
30
|
-
questionInteractionContentSignature
|
|
31
|
-
|
|
31
|
+
questionInteractionContentSignature,
|
|
32
|
+
stampInteractionAnswers
|
|
33
|
+
} from "../chunk-XAWFPMAR.js";
|
|
32
34
|
export {
|
|
33
35
|
INTERACTION_CANCEL_EVENT,
|
|
34
36
|
INTERACTION_EVENT,
|
|
@@ -50,11 +52,13 @@ export {
|
|
|
50
52
|
mapInteractionRespondFailure,
|
|
51
53
|
noticePart,
|
|
52
54
|
noticePartKey,
|
|
55
|
+
parseInteractionAnswers,
|
|
53
56
|
parseInteractionCancel,
|
|
54
57
|
parseInteractionRequest,
|
|
55
58
|
persistedPartToInteraction,
|
|
56
59
|
questionInteractionContentSignature,
|
|
57
60
|
respondToSessionInteraction,
|
|
61
|
+
stampInteractionAnswers,
|
|
58
62
|
validateInteractionAnswerBody
|
|
59
63
|
};
|
|
60
64
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Part } from '@tangle-network/agent-interface';
|
|
2
|
-
import { a as ChatInteractionField, b as ChatInteractionStatus, N as NoticeKind } from './contract-
|
|
2
|
+
import { a as ChatInteractionField, b as ChatInteractionStatus, h as InteractionAnswers, N as NoticeKind } from './contract-KfqJh_au.js';
|
|
3
|
+
import { ChatPlanPersistedPart } from './plans/index.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* The stored shape of `message.parts` — one typed vocabulary for every part a
|
|
@@ -25,6 +26,8 @@ import { a as ChatInteractionField, b as ChatInteractionStatus, N as NoticeKind
|
|
|
25
26
|
* `/web-react`'s chat-interactions contract (`interactionToPersistedPart`,
|
|
26
27
|
* `noticePart`) — type-only imports, one source of truth for their statuses
|
|
27
28
|
* and field shapes.
|
|
29
|
+
* - `plan`: the durable-plan projection in `/plans`, derived from the sandbox
|
|
30
|
+
* SDK's authoritative plan lifecycle.
|
|
28
31
|
*
|
|
29
32
|
* `@tangle-network/agent-interface` exports the canonical wire `Part` union,
|
|
30
33
|
* but its `PartBase` requires the `sessionID`/`messageID` stream envelope that
|
|
@@ -142,8 +145,10 @@ interface ChatInteractionPart {
|
|
|
142
145
|
fields: ChatInteractionField[];
|
|
143
146
|
};
|
|
144
147
|
status: ChatInteractionStatus;
|
|
148
|
+
answers?: InteractionAnswers;
|
|
145
149
|
cancelReason?: string;
|
|
146
150
|
}
|
|
151
|
+
type ChatPlanPart = ChatPlanPersistedPart;
|
|
147
152
|
/** Persisted one-line transcript notice — byte-matches `noticePart` in
|
|
148
153
|
* `/web-react`'s chat-interactions contract. */
|
|
149
154
|
interface ChatNoticePart {
|
|
@@ -152,7 +157,7 @@ interface ChatNoticePart {
|
|
|
152
157
|
noticeKind: NoticeKind;
|
|
153
158
|
text: string;
|
|
154
159
|
}
|
|
155
|
-
type ChatMessagePart = ChatTextPart | ChatReasoningPart | ChatToolPart | ChatFilePart | ChatImagePart | ChatSubtaskPart | ChatStepStartPart | ChatStepFinishPart | ChatInteractionPart | ChatNoticePart;
|
|
160
|
+
type ChatMessagePart = ChatTextPart | ChatReasoningPart | ChatToolPart | ChatFilePart | ChatImagePart | ChatSubtaskPart | ChatStepStartPart | ChatStepFinishPart | ChatInteractionPart | ChatNoticePart | ChatPlanPart;
|
|
156
161
|
/** Every canonical harness wire-part kind must be storable — compile-time
|
|
157
162
|
* guarantee that a new agent-interface part kind cannot silently fall out of
|
|
158
163
|
* the persisted vocabulary. */
|
|
@@ -171,6 +176,7 @@ declare function toChatMessageParts(parts: Array<Record<string, unknown>>): Chat
|
|
|
171
176
|
declare function isChatToolPart(part: ChatMessagePart): part is ChatToolPart;
|
|
172
177
|
declare function isChatTextPart(part: ChatMessagePart): part is ChatTextPart;
|
|
173
178
|
declare function isChatInteractionPart(part: ChatMessagePart): part is ChatInteractionPart;
|
|
179
|
+
declare function isChatPlanPart(part: ChatMessagePart): part is ChatPlanPart;
|
|
174
180
|
declare function isChatStepFinishPart(part: ChatMessagePart): part is ChatStepFinishPart;
|
|
175
181
|
|
|
176
|
-
export { type ChatFilePart as C, type StorableHarnessPartKind as S, type ChatImagePart as a, type ChatInteractionPart as b, type ChatMessagePart as c, type ChatNoticePart as d, type ChatPartTime as e, type
|
|
182
|
+
export { type ChatFilePart as C, type StorableHarnessPartKind as S, type ChatImagePart as a, type ChatInteractionPart as b, type ChatMessagePart as c, type ChatNoticePart as d, type ChatPartTime as e, type ChatPlanPart as f, type ChatReasoningPart as g, type ChatStepFinishPart as h, type ChatStepStartPart as i, type ChatSubtaskPart as j, type ChatTextPart as k, type ChatToolPart as l, type ChatToolState as m, type ChatToolStatus as n, type ChatUsageTokens as o, isChatInteractionPart as p, isChatPlanPart as q, isChatStepFinishPart as r, isChatTextPart as s, isChatToolPart as t, toChatMessageParts as u };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable-plan application-shell contract.
|
|
3
|
+
*
|
|
4
|
+
* The sandbox SDK owns the authoritative plan lifecycle and decision APIs.
|
|
5
|
+
* This module only projects that substrate state into chat events and
|
|
6
|
+
* persisted message parts that products can render and restore.
|
|
7
|
+
*/
|
|
8
|
+
declare const PLAN_SUBMITTED_EVENT: "plan.submitted";
|
|
9
|
+
/** Sandbox plan lifecycle. `preparing` is the transient submission state and
|
|
10
|
+
* is retained in the projection even though the chat card normally starts at
|
|
11
|
+
* `pending`. */
|
|
12
|
+
type ChatPlanStatus = 'preparing' | 'pending' | 'approved' | 'rejected' | 'superseded' | 'withdrawn';
|
|
13
|
+
type ChatPlanBase = {
|
|
14
|
+
/** The sandbox SDK calls this field `id`; the transcript projection names
|
|
15
|
+
* it explicitly so it cannot collide with a message-part id. */
|
|
16
|
+
planId: string;
|
|
17
|
+
revision: number;
|
|
18
|
+
title?: string;
|
|
19
|
+
body: string;
|
|
20
|
+
submittedAt: string;
|
|
21
|
+
/** Provider/Sandbox metadata is deliberately opaque to this package. */
|
|
22
|
+
metadata?: Record<string, unknown>;
|
|
23
|
+
decidedBy?: string;
|
|
24
|
+
};
|
|
25
|
+
/** Browser/persisted projection of the sandbox SDK's durable-plan union. */
|
|
26
|
+
type ChatPlan = ChatPlanBase & ({
|
|
27
|
+
status: 'preparing';
|
|
28
|
+
} | {
|
|
29
|
+
status: 'pending';
|
|
30
|
+
} | {
|
|
31
|
+
status: 'approved';
|
|
32
|
+
decidedAt: string;
|
|
33
|
+
} | {
|
|
34
|
+
status: 'rejected';
|
|
35
|
+
decidedAt: string;
|
|
36
|
+
feedback: string;
|
|
37
|
+
} | {
|
|
38
|
+
status: 'superseded';
|
|
39
|
+
supersededAt: string;
|
|
40
|
+
supersededByPlanId: string;
|
|
41
|
+
} | {
|
|
42
|
+
status: 'withdrawn';
|
|
43
|
+
withdrawnAt: string;
|
|
44
|
+
withdrawnReason: string;
|
|
45
|
+
});
|
|
46
|
+
/** Canonical transcript part for one durable plan. */
|
|
47
|
+
type ChatPlanPersistedPart = ChatPlan & {
|
|
48
|
+
type: 'plan';
|
|
49
|
+
};
|
|
50
|
+
type ParsePlanSubmittedResult = {
|
|
51
|
+
succeeded: true;
|
|
52
|
+
value: ChatPlan;
|
|
53
|
+
} | {
|
|
54
|
+
succeeded: false;
|
|
55
|
+
error: string;
|
|
56
|
+
};
|
|
57
|
+
declare function planPartKey(planId: string): string;
|
|
58
|
+
declare function planRevisionKey(planId: string, revision: number): string;
|
|
59
|
+
declare function planFollowUpTurnId(planId: string, outcome: 'approved' | 'rejected'): string;
|
|
60
|
+
/** Plan status is monotonic: only a pending plan can settle. */
|
|
61
|
+
declare function canTransitionPlanStatus(from: ChatPlanStatus, to: ChatPlanStatus): boolean;
|
|
62
|
+
declare function planToPersistedPart(plan: ChatPlan): ChatPlanPersistedPart;
|
|
63
|
+
declare function persistedPartToPlan(part: Record<string, unknown>): ChatPlan | null;
|
|
64
|
+
/** Parses both direct sandbox events (`data.plan`) and session envelopes
|
|
65
|
+
* (`properties.plan`). Session identity is carried by the surrounding stream
|
|
66
|
+
* and is deliberately not required in the payload. */
|
|
67
|
+
declare function parsePlanSubmittedEvent(event: unknown): ParsePlanSubmittedResult;
|
|
68
|
+
|
|
69
|
+
export { type ChatPlan, type ChatPlanPersistedPart, type ChatPlanStatus, PLAN_SUBMITTED_EVENT, type ParsePlanSubmittedResult, canTransitionPlanStatus, parsePlanSubmittedEvent, persistedPartToPlan, planFollowUpTurnId, planPartKey, planRevisionKey, planToPersistedPart };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PLAN_SUBMITTED_EVENT,
|
|
3
|
+
canTransitionPlanStatus,
|
|
4
|
+
parsePlanSubmittedEvent,
|
|
5
|
+
persistedPartToPlan,
|
|
6
|
+
planFollowUpTurnId,
|
|
7
|
+
planPartKey,
|
|
8
|
+
planRevisionKey,
|
|
9
|
+
planToPersistedPart
|
|
10
|
+
} from "../chunk-SIXYZ2FB.js";
|
|
11
|
+
export {
|
|
12
|
+
PLAN_SUBMITTED_EVENT,
|
|
13
|
+
canTransitionPlanStatus,
|
|
14
|
+
parsePlanSubmittedEvent,
|
|
15
|
+
persistedPartToPlan,
|
|
16
|
+
planFollowUpTurnId,
|
|
17
|
+
planPartKey,
|
|
18
|
+
planRevisionKey,
|
|
19
|
+
planToPersistedPart
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/stream/index.js
CHANGED
|
@@ -23,7 +23,9 @@ import {
|
|
|
23
23
|
resolveChatTurn,
|
|
24
24
|
resolveToolId,
|
|
25
25
|
resolveToolName
|
|
26
|
-
} from "../chunk-
|
|
26
|
+
} from "../chunk-B5JD3DXD.js";
|
|
27
|
+
import "../chunk-XAWFPMAR.js";
|
|
28
|
+
import "../chunk-SIXYZ2FB.js";
|
|
27
29
|
export {
|
|
28
30
|
TURN_EVENTS_MIGRATION_SQL,
|
|
29
31
|
TURN_STATUS_SCOPE_MIGRATION_SQL,
|
package/dist/teams/index.js
CHANGED
|
@@ -3,15 +3,6 @@ import {
|
|
|
3
3
|
isInviteTokenShape,
|
|
4
4
|
validateInviteToken
|
|
5
5
|
} from "../chunk-3SVAA3MA.js";
|
|
6
|
-
import {
|
|
7
|
-
INVITATION_EXPIRY_DAYS,
|
|
8
|
-
generateInvitationToken,
|
|
9
|
-
getInvitationExpiresAt,
|
|
10
|
-
inviteUrlForToken,
|
|
11
|
-
normalizeInvitationEmail,
|
|
12
|
-
parseInvitationPermission,
|
|
13
|
-
renderInvitationEmail
|
|
14
|
-
} from "../chunk-WEBBJBDH.js";
|
|
15
6
|
import {
|
|
16
7
|
ASSIGNABLE_WORKSPACE_ROLES,
|
|
17
8
|
ORGANIZATION_ROLES,
|
|
@@ -27,6 +18,15 @@ import {
|
|
|
27
18
|
workspaceRoleToCollaborationAccess,
|
|
28
19
|
workspaceRoleToSandboxRole
|
|
29
20
|
} from "../chunk-63CE7FEZ.js";
|
|
21
|
+
import {
|
|
22
|
+
INVITATION_EXPIRY_DAYS,
|
|
23
|
+
generateInvitationToken,
|
|
24
|
+
getInvitationExpiresAt,
|
|
25
|
+
inviteUrlForToken,
|
|
26
|
+
normalizeInvitationEmail,
|
|
27
|
+
parseInvitationPermission,
|
|
28
|
+
renderInvitationEmail
|
|
29
|
+
} from "../chunk-WEBBJBDH.js";
|
|
30
30
|
export {
|
|
31
31
|
ASSIGNABLE_WORKSPACE_ROLES,
|
|
32
32
|
INVITATION_EXPIRY_DAYS,
|
|
@@ -2,6 +2,9 @@ import {
|
|
|
2
2
|
SeatLimitError
|
|
3
3
|
} from "../chunk-SWUVTGMR.js";
|
|
4
4
|
import "../chunk-3SVAA3MA.js";
|
|
5
|
+
import {
|
|
6
|
+
hasWorkspaceRole
|
|
7
|
+
} from "../chunk-63CE7FEZ.js";
|
|
5
8
|
import {
|
|
6
9
|
generateInvitationToken,
|
|
7
10
|
getInvitationExpiresAt,
|
|
@@ -9,9 +12,6 @@ import {
|
|
|
9
12
|
normalizeInvitationEmail,
|
|
10
13
|
parseInvitationPermission
|
|
11
14
|
} from "../chunk-WEBBJBDH.js";
|
|
12
|
-
import {
|
|
13
|
-
hasWorkspaceRole
|
|
14
|
-
} from "../chunk-63CE7FEZ.js";
|
|
15
15
|
|
|
16
16
|
// src/teams/invitations-api.ts
|
|
17
17
|
import { and, eq, lte, sql } from "drizzle-orm";
|