@gestaltrun/dsh-im-runtime 0.1.0 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +35 -20
- package/README.md +142 -10
- package/README.zh.md +141 -9
- package/lib/index.js +140 -2
- package/lib/inline-image-DuX6vSEI.js +20 -0
- package/lib/read-receipts.js +413 -0
- package/lib/read-state-CnUZKCuY.js +1868 -0
- package/lib/runtime-Bm6iSEpv.js +10939 -0
- package/lib/tools.js +1 -1
- package/lib/types/account-placement.d.ts +22 -0
- package/lib/types/admission-annotations.d.ts +40 -0
- package/lib/types/agent-coordinator.d.ts +47 -2
- package/lib/types/agent-media.d.ts +46 -0
- package/lib/types/agent-prompt.d.ts +8 -2
- package/lib/types/checkpoint-recovery.d.ts +32 -0
- package/lib/types/checkpoint.d.ts +127 -0
- package/lib/types/consumer-chat-links.d.ts +59 -0
- package/lib/types/delivery-schema.d.ts +126 -2
- package/lib/types/delivery-sqlite.d.ts +206 -6
- package/lib/types/delivery-types.d.ts +97 -1
- package/lib/types/delivery.d.ts +29 -6
- package/lib/types/errors.d.ts +1 -1
- package/lib/types/evaluation-accounts.d.ts +86 -0
- package/lib/types/index.d.ts +34 -2
- package/lib/types/inline-image.d.ts +7 -0
- package/lib/types/input-drain.d.ts +73 -0
- package/lib/types/knowledge-image.d.ts +64 -0
- package/lib/types/media-lifetime.d.ts +22 -0
- package/lib/types/media.d.ts +32 -0
- package/lib/types/message-preview.d.ts +4 -0
- package/lib/types/message-upload.d.ts +55 -0
- package/lib/types/nas-host-lease.d.ts +33 -0
- package/lib/types/placement-slice.d.ts +30 -0
- package/lib/types/policies.d.ts +10 -0
- package/lib/types/preset-model.d.ts +50 -0
- package/lib/types/read-context.d.ts +27 -0
- package/lib/types/read-receipts.d.ts +10 -0
- package/lib/types/read-records.d.ts +30 -0
- package/lib/types/read-state.d.ts +18 -0
- package/lib/types/read-types.d.ts +28 -0
- package/lib/types/restart-recovery.d.ts +38 -0
- package/lib/types/runtime.d.ts +318 -10
- package/lib/types/schema.d.ts +13 -2
- package/lib/types/script-clock.d.ts +14 -0
- package/lib/types/sdk.d.ts +108 -0
- package/lib/types/service-types.d.ts +161 -4
- package/lib/types/session-events.d.ts +9 -9
- package/lib/types/simulation-batch.d.ts +40 -0
- package/lib/types/simulation-controller.d.ts +16 -3
- package/lib/types/simulation-operator.d.ts +19 -0
- package/lib/types/sqlite-connection.d.ts +27 -0
- package/lib/types/time.d.ts +13 -0
- package/lib/types/transport.d.ts +44 -4
- package/lib/types/transports.d.ts +7 -0
- package/lib/types/types.d.ts +22 -5
- package/lib/types/typing.d.ts +33 -0
- package/lib/types/upload-types.d.ts +121 -0
- package/lib/types.js +2 -1
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +67 -41
- package/lib/runtime-C0-S-_CC.js +0 -6758
package/lib/types/transport.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** Provider-facing IM transport capability registered with the runtime. */
|
|
2
2
|
import type { CredentialRecord } from '@deepseek-ai/dsh-credentials';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ImSdkProvider } from './sdk.ts';
|
|
4
|
+
import type { ImDeliveryOperationId, ImConversationPresentation, ImInboundPageResult, ImInboundSenderEvidence, ImMessageContent, ImProviderCursorCommitResult, ImProviderCursorOwner, ImProviderCursorView, ImRealDeliveryScope } from './delivery-types.ts';
|
|
4
5
|
import type { ImAccountCandidate, ImAccountIdentity, ImAccountSetupRequest, ImAccountView, ImAssignedActorCandidate, ImConversationCandidate, ImConversationCandidatePage, ImConversationKind, ImDirectRecipient, ImPlatform, ImPlatformLoginAttemptId, ImPlatformLoginStatus, ImRevision, ImRouteId, ImRouteTarget } from './types.ts';
|
|
5
6
|
export type { ImAccountSetupRequest, ImConversationCandidate, ImConversationCandidatePage, ImDingTalkAccountSetupRequest, ImWangwangAccountSetupRequest } from './types.ts';
|
|
6
7
|
/** Safe provider result plus an optional opaque credential record for durable storage. */
|
|
@@ -16,6 +17,8 @@ export interface ImTransportAccountInspection {
|
|
|
16
17
|
}
|
|
17
18
|
/** Provider message before the runtime classifies sender evidence. */
|
|
18
19
|
export interface ImTransportInboundMessage {
|
|
20
|
+
/** Provider facts for this message; absent fields stay unknown after persistence. */
|
|
21
|
+
readonly uploadIdentity?: import('./upload-types.ts').ImUploadIdentity;
|
|
19
22
|
readonly externalMessageId: string;
|
|
20
23
|
readonly senderEvidence: ImInboundSenderEvidence;
|
|
21
24
|
/** Provider-normalized safe presentation; raw credentials, headers, and connection settings are excluded. */
|
|
@@ -31,6 +34,8 @@ export interface ImTransportConversationPage {
|
|
|
31
34
|
readonly conversationKind: ImConversationKind;
|
|
32
35
|
/** Provider-known group or peer labels; absent facts stay absent. */
|
|
33
36
|
readonly presentation?: ImConversationPresentation;
|
|
37
|
+
/** Platform-provided peer identity for direct sends; never the conversation id. */
|
|
38
|
+
readonly directRecipient?: ImDirectRecipient;
|
|
34
39
|
readonly messages: readonly ImTransportInboundMessage[];
|
|
35
40
|
}
|
|
36
41
|
/** One provider page that may span multiple conversations. */
|
|
@@ -68,11 +73,38 @@ export interface ImTransportListenPlan {
|
|
|
68
73
|
}
|
|
69
74
|
/** Provider listener lifetime returned only after the listener is ready. */
|
|
70
75
|
export interface ImTransportListener {
|
|
71
|
-
/** Settles after the listener ends; rejects when
|
|
76
|
+
/** Settles after the listener ends; rejects with ImTransportListenerError when the provider can classify a failure. The runtime owns bounded retry scheduling. */
|
|
72
77
|
readonly done: Promise<void>;
|
|
73
78
|
/** Request an orderly stop. The `done` promise must settle after this request. @returns when provider stop has been requested. */
|
|
74
79
|
dispose(): Promise<void>;
|
|
75
80
|
}
|
|
81
|
+
/** One SDK message; the runtime resolves its buyer into an existing SaaS conversation. */
|
|
82
|
+
export interface ImRealtimeInboundRequest {
|
|
83
|
+
readonly account: ImAccountView;
|
|
84
|
+
readonly sdkGeneration: number;
|
|
85
|
+
readonly buyerUid: string;
|
|
86
|
+
readonly externalMessageId: string;
|
|
87
|
+
readonly content: ImMessageContent;
|
|
88
|
+
readonly occurredAt: string;
|
|
89
|
+
}
|
|
90
|
+
/** No deferred message is persisted; storage failures reject rather than returning duplicate. */
|
|
91
|
+
export type ImRealtimeInboundResult = {
|
|
92
|
+
readonly state: 'admitted' | 'duplicate';
|
|
93
|
+
readonly scope: ImRealDeliveryScope;
|
|
94
|
+
} | {
|
|
95
|
+
readonly state: 'deferred';
|
|
96
|
+
readonly reason: 'account-changed' | 'sdk-offline' | 'sdk-generation' | 'buyer-unknown' | 'buyer-ambiguous' | 'assignment-route' | 'route-unavailable' | 'native-sender';
|
|
97
|
+
};
|
|
98
|
+
/** Exact platform message lookup, optionally confined to one complete conversation identity. */
|
|
99
|
+
export type ImInboundContentQuery = {
|
|
100
|
+
readonly externalMessageId: string;
|
|
101
|
+
} & ({
|
|
102
|
+
readonly conversationId: string;
|
|
103
|
+
readonly conversationKind: ImConversationKind;
|
|
104
|
+
} | {
|
|
105
|
+
readonly conversationId?: never;
|
|
106
|
+
readonly conversationKind?: never;
|
|
107
|
+
});
|
|
76
108
|
/** Sink owned by the runtime while a provider listener is active. */
|
|
77
109
|
export interface ImTransportSink {
|
|
78
110
|
/**
|
|
@@ -82,10 +114,16 @@ export interface ImTransportSink {
|
|
|
82
114
|
* @returns every durable group receipt and the final cursor result.
|
|
83
115
|
*/
|
|
84
116
|
receivePage(page: ImTransportInboundPage): Promise<ImTransportInboundPageReceipt>;
|
|
117
|
+
/** @param request - SDK account generation, peer and normalized message. @param signal - optional caller cancellation while waiting for reception; absence uses the listener lifetime. @returns admission into an existing scope, a duplicate, or a deferred reason; never advances SaaS cursors. */
|
|
118
|
+
receiveRealtime(request: ImRealtimeInboundRequest, signal?: AbortSignal): Promise<ImRealtimeInboundResult>;
|
|
119
|
+
/** @param request - exact platform message id, optionally restricted to one conversation in this listener account. @returns stored content or absence; storage failures throw. */
|
|
120
|
+
findInboundContent(request: ImInboundContentQuery): ImMessageContent | undefined;
|
|
121
|
+
/** @param uid - SDK sender UID. @returns whether it names the configured merchant, main account or an observed native service account; storage failures throw. */
|
|
122
|
+
isNativeSender(uid: string): boolean;
|
|
85
123
|
/** @param owner - provider feed identity. @returns the durable merchant cursor, or a null cursor before the first listen. */
|
|
86
124
|
getProviderCursor(owner: ImProviderCursorOwner): ImProviderCursorView;
|
|
87
125
|
}
|
|
88
|
-
/**
|
|
126
|
+
/** Send authority survives preparation only within the caller's customer handling epoch. */
|
|
89
127
|
export interface ImAutomaticSendAuthorization {
|
|
90
128
|
/** Cancellation during preparation; customer revocation stops affecting it after submission. */
|
|
91
129
|
readonly signal: AbortSignal;
|
|
@@ -105,7 +143,7 @@ export interface ImTransportSendRequest {
|
|
|
105
143
|
readonly requestId: string;
|
|
106
144
|
readonly text: string;
|
|
107
145
|
readonly aiTag?: boolean;
|
|
108
|
-
/** Required for automatic sends
|
|
146
|
+
/** Required for automatic sends and handling-constrained manual sends. Providers authorize immediately before external submission. */
|
|
109
147
|
readonly submission?: ImAutomaticSendAuthorization;
|
|
110
148
|
}
|
|
111
149
|
/** Provider send outcome before or after receipt confirmation. */
|
|
@@ -133,6 +171,8 @@ export interface ImTransportConfirmRequest {
|
|
|
133
171
|
/** Complete provider capability registered under one platform. */
|
|
134
172
|
export interface ImTransport {
|
|
135
173
|
readonly platform: ImPlatform;
|
|
174
|
+
/** Optional secondary SDK connection. Wangwang text and media both require an online generation of this connection. */
|
|
175
|
+
readonly sdk?: ImSdkProvider | undefined;
|
|
136
176
|
/** Start or rejoin an interactive provider login. Implementations return only safe authorization instructions. */
|
|
137
177
|
startLogin?(signal: AbortSignal): Promise<ImPlatformLoginStatus>;
|
|
138
178
|
/** @param attemptId - provider-minted login identity. @returns its current safe state. */
|
|
@@ -10,6 +10,13 @@ export declare class ImTransportError extends Error {
|
|
|
10
10
|
/** @param code - stable failure code. @param message - diagnostic detail. */
|
|
11
11
|
constructor(code: ImTransportErrorCode, message: string);
|
|
12
12
|
}
|
|
13
|
+
/** Provider listener failure with a safe code and an explicit authorization disposition. */
|
|
14
|
+
export declare class ImTransportListenerError extends Error {
|
|
15
|
+
readonly code: string;
|
|
16
|
+
readonly authorization: boolean;
|
|
17
|
+
/** @param code - stable platform error code. @param authorization - whether credentials require operator action. @param cause - underlying provider failure, excluded from public state. */
|
|
18
|
+
constructor(code: string, authorization?: boolean, cause?: unknown);
|
|
19
|
+
}
|
|
13
20
|
declare module '@deepseek-ai/cordis' {
|
|
14
21
|
interface Context {
|
|
15
22
|
imTransports: ImTransports;
|
package/lib/types/types.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ import type { CredentialKey } from '@deepseek-ai/dsh-credentials/types';
|
|
|
4
4
|
import type { SessionId } from '@deepseek-ai/dsh-session/types';
|
|
5
5
|
import type { WorkspaceId } from '@deepseek-ai/dsh-workspace/types';
|
|
6
6
|
import type { ImDeliveryOperationId, ImSimulationDeliveryScope, ImSimulationInstanceId } from './delivery-types.ts';
|
|
7
|
+
export { inlineImImage, imMessageText } from './inline-image.ts';
|
|
7
8
|
export type * from './delivery-types.ts';
|
|
9
|
+
export type { ImSdkStatus, ImSdkState, ImSdkFailureCode } from './sdk.ts';
|
|
8
10
|
/** Identifier minted by the Host for one configured account. */
|
|
9
11
|
export type ImAccountId = Branded<'ImAccountId'>;
|
|
10
12
|
/** Identifier minted by the Host for one route lifecycle. */
|
|
@@ -19,6 +21,8 @@ export type ImRevision = Branded<'ImRevision'>;
|
|
|
19
21
|
export type ImAccountSetupId = Branded<'ImAccountSetupId'>;
|
|
20
22
|
/** Host-provider identifier for one interactive platform login process. */
|
|
21
23
|
export type ImPlatformLoginAttemptId = Branded<'ImPlatformLoginAttemptId'>;
|
|
24
|
+
/** Verified OAuth subject used by the product account authorization service. */
|
|
25
|
+
export type ImTaobaoUserId = Branded<'MerchantUserId'>;
|
|
22
26
|
/** Supported product IM platforms. */
|
|
23
27
|
export type ImPlatform = 'dingtalk' | 'wangwang';
|
|
24
28
|
/** Supported conversation categories. */
|
|
@@ -120,6 +124,8 @@ export interface ImAccountSetupPreview {
|
|
|
120
124
|
export interface ImConfirmAccountSetupRequest {
|
|
121
125
|
readonly setupId: ImAccountSetupId;
|
|
122
126
|
readonly operationId: ImOperationId;
|
|
127
|
+
/** Initial automatic-handling pause, atomically persisted before publication; omission creates an unpaused account. */
|
|
128
|
+
readonly initialPaused?: boolean;
|
|
123
129
|
}
|
|
124
130
|
/** Result of releasing one unconfirmed setup attempt. */
|
|
125
131
|
export type ImCancelAccountSetupResult = {
|
|
@@ -198,6 +204,10 @@ export interface ImAccountView {
|
|
|
198
204
|
readonly authorization: ImAccountAuthorization;
|
|
199
205
|
readonly listener: ImAccountListener;
|
|
200
206
|
readonly connectionIntent: ImAccountConnectionIntent;
|
|
207
|
+
/** Explicit SDK restoration intent; absence forbids automatic login, and kicked requires operator login. */
|
|
208
|
+
readonly sdkConnectionIntent?: 'online' | 'kicked';
|
|
209
|
+
/** Changes on each explicit SDK command or persisted kickout; unrelated account refreshes preserve it. */
|
|
210
|
+
readonly sdkConnectionIntentRevision?: ImRevision;
|
|
201
211
|
readonly paused: boolean;
|
|
202
212
|
readonly revision: ImRevision;
|
|
203
213
|
readonly createdAt: string;
|
|
@@ -367,12 +377,12 @@ export interface ImSimulationFrozenTarget {
|
|
|
367
377
|
readonly groupTrigger?: ImGroupTrigger;
|
|
368
378
|
readonly directRecipient?: ImDirectRecipient;
|
|
369
379
|
}
|
|
370
|
-
/** Durable two-Session simulation instance. `stopped` and `failed` are terminal. */
|
|
380
|
+
/** Durable manual or two-Session simulation instance. `stopped` and `failed` are terminal. */
|
|
371
381
|
export interface ImSimulationInstanceView {
|
|
372
382
|
readonly instanceId: ImSimulationInstanceId;
|
|
373
383
|
readonly status: 'creating' | 'running' | 'stopping' | 'stopped' | 'failed';
|
|
374
|
-
readonly simUserSessionId
|
|
375
|
-
readonly simUserWorkspaceId
|
|
384
|
+
readonly simUserSessionId?: SessionId;
|
|
385
|
+
readonly simUserWorkspaceId?: WorkspaceId;
|
|
376
386
|
readonly testedSessionId: SessionId;
|
|
377
387
|
readonly target: ImSimulationFrozenTarget;
|
|
378
388
|
readonly speakingMembers: readonly ImSimulationParticipant[];
|
|
@@ -412,14 +422,18 @@ export interface ImCreateSimulationInstanceRequest {
|
|
|
412
422
|
readonly conversationId?: string;
|
|
413
423
|
readonly speakingMembers?: readonly ImSimulationParticipant[];
|
|
414
424
|
}
|
|
425
|
+
/** Create an operator-driven simulation against an enabled all-direct route. */
|
|
426
|
+
export interface ImCreateManualSimulationInstanceRequest {
|
|
427
|
+
readonly routeId: ImRouteId;
|
|
428
|
+
}
|
|
415
429
|
/** Trusted navigation and delivery facts for either Session in one instance. */
|
|
416
430
|
export interface ImSimulationSessionScope {
|
|
417
431
|
readonly instanceId: ImSimulationInstanceId;
|
|
418
432
|
readonly role: 'sim-user' | 'tested';
|
|
419
433
|
readonly sessionId: SessionId;
|
|
420
|
-
readonly peerSessionId
|
|
434
|
+
readonly peerSessionId?: SessionId;
|
|
421
435
|
readonly workspaceId: WorkspaceId;
|
|
422
|
-
readonly peerWorkspaceId
|
|
436
|
+
readonly peerWorkspaceId?: WorkspaceId;
|
|
423
437
|
readonly deliveryScope: ImSimulationDeliveryScope;
|
|
424
438
|
readonly status: ImSimulationInstanceView['status'];
|
|
425
439
|
}
|
|
@@ -481,6 +495,8 @@ export interface ImRuntimeSnapshot {
|
|
|
481
495
|
}
|
|
482
496
|
/** Post-commit configuration change notification. */
|
|
483
497
|
export interface ImRuntimeChange {
|
|
498
|
+
/** A successful placement import or checkpoint recovery has released reception; ordinary account edits never request SDK recovery. */
|
|
499
|
+
readonly sdkRecoveryRequested?: true;
|
|
484
500
|
readonly revision: number;
|
|
485
501
|
readonly kind: 'account' | 'account-listener' | 'route' | 'simulation-target' | 'simulation-instance' | 'transport';
|
|
486
502
|
readonly platform?: ImPlatform;
|
|
@@ -502,3 +518,4 @@ export type ImRouteResolution = {
|
|
|
502
518
|
} | {
|
|
503
519
|
readonly state: 'unmatched';
|
|
504
520
|
};
|
|
521
|
+
export type * from './read-types.ts';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Process-local typing for observed single chats; no Session or storage writes. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import type { ImDeliveryScope, ImRealDeliveryScope } from './delivery-types.ts';
|
|
4
|
+
import type { ImDirectRecipient } from './types.ts';
|
|
5
|
+
interface Identity {
|
|
6
|
+
readonly buyer: ImDirectRecipient | undefined;
|
|
7
|
+
readonly selfUid: string;
|
|
8
|
+
}
|
|
9
|
+
/** Runtime-owned transient observation; only watched, verified Wangwang single chats are admitted. */
|
|
10
|
+
export declare class ImTyping {
|
|
11
|
+
private readonly ctx;
|
|
12
|
+
private readonly identity;
|
|
13
|
+
private readonly timeoutMs;
|
|
14
|
+
private readonly observations;
|
|
15
|
+
private sdk;
|
|
16
|
+
private readonly binding;
|
|
17
|
+
/** @param ctx - runtime lifecycle owner. @param identity - authoritative account and buyer lookup. @param timeoutMs - resolved positive auto-hide interval. */
|
|
18
|
+
constructor(ctx: Context, identity: (scope: ImRealDeliveryScope) => Identity | undefined, timeoutMs: number);
|
|
19
|
+
/** @param scope - complete delivery identity. @returns the verified online generation while typing is unexpired; otherwise absence. */
|
|
20
|
+
snapshot(scope: ImDeliveryScope): {
|
|
21
|
+
readonly generation: number;
|
|
22
|
+
} | undefined;
|
|
23
|
+
/** @param scope - immutable sidebar conversation. @param listener - transient state invalidation. @returns disposer; the last observer releases that conversation and its timer. */
|
|
24
|
+
subscribe(scope: ImDeliveryScope, listener: () => void): () => void;
|
|
25
|
+
/** Stop SDK admission and join accepted callbacks before runtime storage closes. */
|
|
26
|
+
dispose(): Promise<void>;
|
|
27
|
+
private identityOf;
|
|
28
|
+
private current;
|
|
29
|
+
private accept;
|
|
30
|
+
private clear;
|
|
31
|
+
private publish;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/** Host-only durable observations for the customer-message upload queue. */
|
|
2
|
+
import type { Branded } from '@deepseek-ai/dsh-brand';
|
|
3
|
+
import type { ImDeliveryScope, ImInboundMessageView, ImOutboundView } from './delivery-types.ts';
|
|
4
|
+
/** Destination captured without credentials; retries cannot follow a different shop or server. */
|
|
5
|
+
export interface ImUploadTarget {
|
|
6
|
+
readonly serverOrigin: string;
|
|
7
|
+
readonly tenantId: Branded<'MerchantTenantId'>;
|
|
8
|
+
readonly shopAccountId: string;
|
|
9
|
+
readonly traffic: 'formal' | 'test' | 'simulation';
|
|
10
|
+
readonly testRunId: string | null;
|
|
11
|
+
}
|
|
12
|
+
/** Host-minted identity of an immutable upload observation. */
|
|
13
|
+
export type ImUploadObservationId = Branded<'ImUploadObservationId'>;
|
|
14
|
+
/** Platform facts captured with a message; missing fields remain unknown on replay. */
|
|
15
|
+
export interface ImUploadIdentity {
|
|
16
|
+
readonly senderAccountId: string | null;
|
|
17
|
+
readonly senderDisplayName: string | null;
|
|
18
|
+
readonly senderDomain: string | null;
|
|
19
|
+
readonly assignedAccountId: string | null;
|
|
20
|
+
}
|
|
21
|
+
/** Persisted control result sent through the message queue; replay never invokes control. */
|
|
22
|
+
export interface ImUploadConversationEvent {
|
|
23
|
+
readonly eventId: string;
|
|
24
|
+
readonly conversationKey: string;
|
|
25
|
+
readonly accountId: string;
|
|
26
|
+
readonly kind: 'ai_to_human' | 'hosting_disabled' | 'hosting_resumed';
|
|
27
|
+
readonly occurredAt: string;
|
|
28
|
+
readonly controlRevision: string;
|
|
29
|
+
readonly relatedMessageIds: readonly string[];
|
|
30
|
+
readonly sourceOperationId: string;
|
|
31
|
+
readonly sourceKind: 'dsh-control-result';
|
|
32
|
+
readonly payloadHash: string;
|
|
33
|
+
}
|
|
34
|
+
/** Authorized successful operation; SQLite supplies revision and commit time. */
|
|
35
|
+
export interface ImUploadControlResult {
|
|
36
|
+
readonly target: ImUploadTarget;
|
|
37
|
+
readonly accountId: string;
|
|
38
|
+
readonly kind: ImUploadConversationEvent['kind'];
|
|
39
|
+
readonly sourceOperationId: string;
|
|
40
|
+
readonly relatedMessageIds: readonly string[];
|
|
41
|
+
}
|
|
42
|
+
/** One immutable message revision committed with its runtime mutation. */
|
|
43
|
+
export interface ImUploadObservation {
|
|
44
|
+
readonly id: ImUploadObservationId;
|
|
45
|
+
readonly target: ImUploadTarget;
|
|
46
|
+
readonly scope: ImDeliveryScope;
|
|
47
|
+
readonly observedAt: string;
|
|
48
|
+
readonly identity?: ImUploadIdentity | undefined;
|
|
49
|
+
readonly message: {
|
|
50
|
+
readonly kind: 'inbound';
|
|
51
|
+
readonly value: ImInboundMessageView;
|
|
52
|
+
} | {
|
|
53
|
+
readonly kind: 'outbound';
|
|
54
|
+
readonly value: ImOutboundView;
|
|
55
|
+
} | {
|
|
56
|
+
readonly kind: 'conversation-event';
|
|
57
|
+
readonly value: ImUploadConversationEvent;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/** T2 realtime request row; upstream message identity is mandatory. */
|
|
61
|
+
export interface ImUploadMessage {
|
|
62
|
+
readonly senderAccountId: string | null;
|
|
63
|
+
readonly senderDisplayName: string | null;
|
|
64
|
+
readonly senderDomain: string | null;
|
|
65
|
+
readonly assignedAccountId: string | null;
|
|
66
|
+
readonly shopAccountId: string;
|
|
67
|
+
readonly messageId: string;
|
|
68
|
+
readonly conversationId: string;
|
|
69
|
+
readonly version: string;
|
|
70
|
+
readonly sourceUpdatedAt: string;
|
|
71
|
+
readonly sourceOrder: {
|
|
72
|
+
readonly kind: 'time';
|
|
73
|
+
readonly at: string;
|
|
74
|
+
};
|
|
75
|
+
readonly occurredAt: string;
|
|
76
|
+
readonly senderKind: 'buyer' | 'ai' | 'dsh_human' | 'native_human';
|
|
77
|
+
readonly senderAttribution: 'buyer' | 'our_ai' | 'human' | 'unknown';
|
|
78
|
+
readonly attribution: {
|
|
79
|
+
readonly method: string;
|
|
80
|
+
readonly status: string;
|
|
81
|
+
readonly version: string;
|
|
82
|
+
readonly evidence: string | null;
|
|
83
|
+
};
|
|
84
|
+
readonly senderRole: string | null;
|
|
85
|
+
readonly content: string | null;
|
|
86
|
+
readonly contentJson: unknown;
|
|
87
|
+
readonly mediaJson: unknown;
|
|
88
|
+
readonly recordStatus: string | null;
|
|
89
|
+
readonly buyerAccountId: string | null;
|
|
90
|
+
readonly traffic: 'formal' | 'test' | 'simulation';
|
|
91
|
+
readonly testRunId: string | null;
|
|
92
|
+
}
|
|
93
|
+
/** Transient failures retry; rejected observations remain durable for manual review. */
|
|
94
|
+
export type ImUploadResult = {
|
|
95
|
+
readonly kind: 'accepted';
|
|
96
|
+
} | {
|
|
97
|
+
readonly kind: 'retry';
|
|
98
|
+
readonly reason: string;
|
|
99
|
+
} | {
|
|
100
|
+
readonly kind: 'deferred';
|
|
101
|
+
readonly reason: string;
|
|
102
|
+
} | {
|
|
103
|
+
readonly kind: 'rejected';
|
|
104
|
+
readonly reason: string;
|
|
105
|
+
};
|
|
106
|
+
/** Host-owned authenticated request. It must reject redirects and honor cancellation. */
|
|
107
|
+
export type ImUploadTransport = (target: ImUploadTarget, messages: readonly ImUploadMessage[], signal: AbortSignal, events?: readonly ImUploadConversationEvent[]) => Promise<ImUploadResult>;
|
|
108
|
+
/** Capture eligibility at mutation time; absence leaves unrelated IM traffic local. */
|
|
109
|
+
export interface ImUploadBinding {
|
|
110
|
+
/** @param scope - observed conversation. @param purpose - control-result capture, or message capture when absent. @returns original authorized shop, or absence when capture is ineligible. */
|
|
111
|
+
target(scope: ImDeliveryScope, purpose?: 'control'): ImUploadTarget | undefined;
|
|
112
|
+
/** @param scope - conversation captured by the upload. @returns verified sending account, or absence to keep identity unknown. */
|
|
113
|
+
identity?(scope: ImDeliveryScope): {
|
|
114
|
+
readonly accountId: string;
|
|
115
|
+
readonly displayName?: string;
|
|
116
|
+
readonly domain: string;
|
|
117
|
+
} | undefined;
|
|
118
|
+
/** @param scope - control whose capture failed. @returns a safe reason code without credentials or account names. */
|
|
119
|
+
captureFailure?(scope: ImDeliveryScope): string;
|
|
120
|
+
readonly send: ImUploadTransport;
|
|
121
|
+
}
|
package/lib/types.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { n as inlineImImage, t as imMessageText } from "./inline-image-DuX6vSEI.js";
|
|
2
|
+
export { imMessageText, inlineImImage };
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "IM runtime",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "Manages chat accounts, takeover rules, and message status, and passes new messages to AI for replies"
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gestaltrun/dsh-im-runtime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Durable IM account and routing runtime for Gestaltrun Desktop",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -19,7 +19,11 @@
|
|
|
19
19
|
"default": "./lib/tools.js"
|
|
20
20
|
},
|
|
21
21
|
"./package.json": "./package.json",
|
|
22
|
-
"./locale/*.json": "./locale/*.json"
|
|
22
|
+
"./locale/*.json": "./locale/*.json",
|
|
23
|
+
"./read-receipts": {
|
|
24
|
+
"types": "./lib/types/read-receipts.d.ts",
|
|
25
|
+
"default": "./lib/read-receipts.js"
|
|
26
|
+
}
|
|
23
27
|
},
|
|
24
28
|
"files": [
|
|
25
29
|
"lib",
|
|
@@ -49,54 +53,76 @@
|
|
|
49
53
|
"zod": "4.4.3"
|
|
50
54
|
},
|
|
51
55
|
"peerDependencies": {
|
|
52
|
-
"@deepseek-ai/cordis": "4.0.
|
|
53
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
54
|
-
"@deepseek-ai/dsh-agent-default-model": "0.2.
|
|
55
|
-
"@deepseek-ai/dsh-agent-preset-registry": "0.2.
|
|
56
|
-
"@deepseek-ai/dsh-brand": "0.2.
|
|
57
|
-
"@deepseek-ai/dsh-credentials": "0.2.
|
|
58
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
59
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
60
|
-
"@deepseek-ai/dsh-session-persistence": "0.2.
|
|
61
|
-
"@deepseek-ai/dsh-storage-domain": "0.2.
|
|
62
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.
|
|
63
|
-
"@deepseek-ai/dsh-tools": "0.2.
|
|
64
|
-
"@deepseek-ai/dsh-workspace": "0.2.
|
|
56
|
+
"@deepseek-ai/cordis": "4.0.6-alpha.1",
|
|
57
|
+
"@deepseek-ai/dsh-agent": "0.2.2-alpha.2",
|
|
58
|
+
"@deepseek-ai/dsh-agent-default-model": "0.2.2-alpha.2",
|
|
59
|
+
"@deepseek-ai/dsh-agent-preset-registry": "0.2.2-alpha.2",
|
|
60
|
+
"@deepseek-ai/dsh-brand": "0.2.2-alpha.2",
|
|
61
|
+
"@deepseek-ai/dsh-credentials": "0.2.2-alpha.2",
|
|
62
|
+
"@deepseek-ai/dsh-llm": "0.2.2-alpha.2",
|
|
63
|
+
"@deepseek-ai/dsh-session": "0.2.2-alpha.2",
|
|
64
|
+
"@deepseek-ai/dsh-session-persistence": "0.2.2-alpha.2",
|
|
65
|
+
"@deepseek-ai/dsh-storage-domain": "0.2.2-alpha.2",
|
|
66
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.2-alpha.2",
|
|
67
|
+
"@deepseek-ai/dsh-tools": "0.2.2-alpha.2",
|
|
68
|
+
"@deepseek-ai/dsh-workspace": "0.2.2-alpha.2",
|
|
69
|
+
"@deepseek-ai/dsh-attachment": "0.2.2-alpha.2",
|
|
70
|
+
"@deepseek-ai/dsh-fs": "0.2.2-alpha.2",
|
|
71
|
+
"@deepseek-ai/dsh-working-directory": "0.2.2-alpha.2",
|
|
72
|
+
"@deepseek-ai/dsh-storage": "0.2.2-alpha.2",
|
|
73
|
+
"@deepseek-ai/dsh-storage-json": "0.2.2-alpha.2"
|
|
65
74
|
},
|
|
66
75
|
"devDependencies": {
|
|
67
|
-
"@deepseek-ai/cordis": "4.0.
|
|
68
|
-
"@deepseek-ai/cordis-plugin-include": "1.0.
|
|
69
|
-
"@deepseek-ai/cordis-plugin-loader": "1.0.
|
|
70
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
71
|
-
"@deepseek-ai/dsh-agent-default-model": "0.2.
|
|
72
|
-
"@deepseek-ai/dsh-agent-loop": "0.2.
|
|
73
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.
|
|
74
|
-
"@deepseek-ai/dsh-agent-preset-registry": "0.2.
|
|
75
|
-
"@deepseek-ai/dsh-brand": "0.2.
|
|
76
|
-
"@deepseek-ai/dsh-credentials": "0.2.
|
|
77
|
-
"@deepseek-ai/dsh-credentials-local": "0.2.
|
|
78
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
79
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
80
|
-
"@deepseek-ai/dsh-session-persistence": "0.2.
|
|
81
|
-
"@deepseek-ai/dsh-session-persistence-jsonl": "0.2.
|
|
82
|
-
"@deepseek-ai/dsh-session-projection": "0.2.
|
|
83
|
-
"@deepseek-ai/dsh-storage": "0.2.
|
|
84
|
-
"@deepseek-ai/dsh-storage-domain": "0.2.
|
|
85
|
-
"@deepseek-ai/dsh-storage-json": "0.2.
|
|
86
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.
|
|
87
|
-
"@deepseek-ai/dsh-tools": "0.2.
|
|
88
|
-
"@deepseek-ai/dsh-workspace": "0.2.
|
|
76
|
+
"@deepseek-ai/cordis": "4.0.6-alpha.1",
|
|
77
|
+
"@deepseek-ai/cordis-plugin-include": "1.0.11-alpha.1",
|
|
78
|
+
"@deepseek-ai/cordis-plugin-loader": "1.0.7-alpha.1",
|
|
79
|
+
"@deepseek-ai/dsh-agent": "0.2.2-alpha.2",
|
|
80
|
+
"@deepseek-ai/dsh-agent-default-model": "0.2.2-alpha.2",
|
|
81
|
+
"@deepseek-ai/dsh-agent-loop": "0.2.2-alpha.2",
|
|
82
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.2-alpha.2",
|
|
83
|
+
"@deepseek-ai/dsh-agent-preset-registry": "0.2.2-alpha.2",
|
|
84
|
+
"@deepseek-ai/dsh-brand": "0.2.2-alpha.2",
|
|
85
|
+
"@deepseek-ai/dsh-credentials": "0.2.2-alpha.2",
|
|
86
|
+
"@deepseek-ai/dsh-credentials-local": "0.2.2-alpha.2",
|
|
87
|
+
"@deepseek-ai/dsh-llm": "0.2.2-alpha.2",
|
|
88
|
+
"@deepseek-ai/dsh-session": "0.2.2-alpha.2",
|
|
89
|
+
"@deepseek-ai/dsh-session-persistence": "0.2.2-alpha.2",
|
|
90
|
+
"@deepseek-ai/dsh-session-persistence-jsonl": "0.2.2-alpha.2",
|
|
91
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-alpha.2",
|
|
92
|
+
"@deepseek-ai/dsh-storage": "0.2.2-alpha.2",
|
|
93
|
+
"@deepseek-ai/dsh-storage-domain": "0.2.2-alpha.2",
|
|
94
|
+
"@deepseek-ai/dsh-storage-json": "0.2.2-alpha.2",
|
|
95
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.2-alpha.2",
|
|
96
|
+
"@deepseek-ai/dsh-tools": "0.2.2-alpha.2",
|
|
97
|
+
"@deepseek-ai/dsh-workspace": "0.2.2-alpha.2",
|
|
89
98
|
"@types/node": "22.20.0",
|
|
90
99
|
"tsdown": "0.22.2",
|
|
91
100
|
"typescript": "6.0.3",
|
|
92
101
|
"vite-tsconfig-paths": "6.1.1",
|
|
93
102
|
"vitest": "4.1.8",
|
|
94
|
-
"@gestaltrun/dsh-workspace-bundle": "^0.1.0"
|
|
103
|
+
"@gestaltrun/dsh-workspace-bundle": "^0.1.0",
|
|
104
|
+
"@deepseek-ai/dsh-subagent": "0.2.2-alpha.2",
|
|
105
|
+
"@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.2-alpha.2",
|
|
106
|
+
"@deepseek-ai/dsh-schedule": "0.2.2-alpha.2",
|
|
107
|
+
"@deepseek-ai/dsh-session-snapshot": "0.2.2-alpha.2",
|
|
108
|
+
"@deepseek-ai/dsh-llm-replay": "0.2.2-alpha.2",
|
|
109
|
+
"@deepseek-ai/dsh-loader-smoke": "0.2.2-alpha.2",
|
|
110
|
+
"@deepseek-ai/dsh-fs-local": "0.2.2-alpha.2",
|
|
111
|
+
"@deepseek-ai/dsh-working-directory": "0.2.2-alpha.2",
|
|
112
|
+
"@deepseek-ai/dsh-session-query-sqlite": "0.2.2-alpha.2",
|
|
113
|
+
"@deepseek-ai/dsh-agent-preset": "0.2.2-alpha.2",
|
|
114
|
+
"@deepseek-ai/dsh-attachment-local": "0.2.2-alpha.2",
|
|
115
|
+
"@deepseek-ai/dsh-attachment": "0.2.2-alpha.2",
|
|
116
|
+
"@deepseek-ai/dsh-fs": "0.2.2-alpha.2",
|
|
117
|
+
"@deepseek-ai/dsh-tool-testkit": "0.2.2-alpha.2",
|
|
118
|
+
"@deepseek-ai/dsh-tool-executor-native": "0.2.2-alpha.2"
|
|
95
119
|
},
|
|
96
120
|
"scripts": {
|
|
97
121
|
"build": "node scripts/clean.mjs && tsc -p tsconfig.build.json && tsdown",
|
|
98
|
-
"typecheck": "tsc --noEmit",
|
|
99
|
-
"test": "vitest run",
|
|
100
|
-
"smoke:loader": "node scripts/smoke-loader.mjs"
|
|
122
|
+
"typecheck": "tsc --noEmit && tsc -p tsconfig.test.json --noEmit",
|
|
123
|
+
"test": "vitest run && node tests/run-restart.mjs && node ../cloud-placement/tests/run.mjs ../im-runtime/tests/placement-return.test.ts ../im-runtime/tests/checkpoint-recovery.test.ts ../im-runtime/tests/checkpoint-recovery-recorded.test.ts ../im-runtime/tests/checkpoint-cursor-conflict.test.ts ../im-runtime/tests/checkpoint-lifecycle.test.ts ../im-runtime/tests/released-placement-resume.test.ts ../im-runtime/tests/placement-task-ownership.test.ts",
|
|
124
|
+
"smoke:loader": "node scripts/smoke-loader.mjs",
|
|
125
|
+
"test:restart": "node tests/run-restart.mjs",
|
|
126
|
+
"test:typecheck": "tsc -p tsconfig.test.json --noEmit"
|
|
101
127
|
}
|
|
102
128
|
}
|