@sentry/junior 0.91.0 → 0.92.0
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/{agent-hooks-MXAF7RQL.js → agent-hooks-BYSSWCNW.js} +7 -7
- package/dist/api/people/list.d.ts +3 -3
- package/dist/api/people/list.js +15 -15
- package/dist/api/people/list.query.d.ts +2 -2
- package/dist/api/people/profile.d.ts +3 -3
- package/dist/api/people/profile.js +12 -12
- package/dist/api/people/profile.query.d.ts +2 -2
- package/dist/api/people/shared.d.ts +13 -13
- package/dist/api/people/types.d.ts +12 -12
- package/dist/api-reference.d.ts +1 -1
- package/dist/app.js +334 -263
- package/dist/{catalog-runtime-DXE6NXHT.js → catalog-runtime-NZHMSMYC.js} +2 -2
- package/dist/chat/actor.d.ts +75 -0
- package/dist/chat/agent/prompt.d.ts +2 -2
- package/dist/chat/agent/request.d.ts +13 -13
- package/dist/chat/agent/resume.d.ts +5 -4
- package/dist/chat/agent/tools.d.ts +2 -2
- package/dist/chat/capabilities/jr-rpc-command.d.ts +1 -1
- package/dist/chat/conversation-privacy.d.ts +11 -0
- package/dist/chat/conversations/sql/migrations.d.ts +1 -1
- package/dist/chat/conversations/sql/schema/conversations.d.ts +2 -19
- package/dist/chat/conversations/sql/schema.d.ts +2 -19
- package/dist/chat/conversations/sql/store.d.ts +3 -3
- package/dist/chat/conversations/store.d.ts +4 -4
- package/dist/chat/credentials/context.d.ts +4 -4
- package/dist/chat/logging.d.ts +2 -2
- package/dist/chat/no-reply.d.ts +1 -1
- package/dist/chat/oauth-flow.d.ts +1 -1
- package/dist/chat/pi/messages.d.ts +2 -2
- package/dist/chat/pi/transcript.d.ts +15 -0
- package/dist/chat/plugins/agent-hooks.d.ts +3 -3
- package/dist/chat/plugins/credential-hooks.d.ts +2 -8
- package/dist/chat/prompt.d.ts +3 -6
- package/dist/chat/runtime/reply-executor.d.ts +1 -1
- package/dist/chat/runtime/turn-input.d.ts +1 -1
- package/dist/chat/sandbox/egress/schemas.d.ts +2 -2
- package/dist/chat/sandbox/egress/session.d.ts +1 -1
- package/dist/chat/services/context-compaction.d.ts +1 -1
- package/dist/chat/services/conversation-memory.d.ts +1 -1
- package/dist/chat/services/mcp-auth-orchestration.d.ts +1 -1
- package/dist/chat/services/message-actor-identity.d.ts +4 -4
- package/dist/chat/services/pending-auth.d.ts +2 -2
- package/dist/chat/services/plugin-auth-orchestration.d.ts +1 -1
- package/dist/chat/services/provider-default-config.d.ts +1 -1
- package/dist/chat/services/subscribed-decision.d.ts +1 -1
- package/dist/chat/services/turn-result.d.ts +1 -1
- package/dist/chat/services/turn-session-record.d.ts +11 -8
- package/dist/chat/services/turn-thinking-level.d.ts +1 -1
- package/dist/chat/slack/assistant-thread/title.d.ts +1 -1
- package/dist/chat/slack/tools/canvas/create.d.ts +41 -1
- package/dist/chat/slack/tools/canvas/edit.d.ts +60 -1
- package/dist/chat/slack/tools/canvas/read.d.ts +60 -1
- package/dist/chat/slack/tools/canvas/write.d.ts +41 -1
- package/dist/chat/slack/tools/channel-list-messages.d.ts +45 -1
- package/dist/chat/slack/tools/context.d.ts +3 -3
- package/dist/chat/slack/tools/list/add-items.d.ts +42 -1
- package/dist/chat/slack/tools/list/create.d.ts +40 -1
- package/dist/chat/slack/tools/list/get-items.d.ts +40 -1
- package/dist/chat/slack/tools/list/update-item.d.ts +46 -1
- package/dist/chat/slack/tools/message-add-reaction.d.ts +40 -1
- package/dist/chat/slack/tools/send-message.d.ts +45 -1
- package/dist/chat/slack/tools/thread-read.d.ts +44 -1
- package/dist/chat/slack/tools/user-lookup.d.ts +45 -1
- package/dist/chat/slack/user.d.ts +3 -3
- package/dist/chat/slack/vision-context.d.ts +2 -2
- package/dist/chat/sql/schema.d.ts +2 -19
- package/dist/chat/state/conversation-details.d.ts +4 -4
- package/dist/chat/state/conversation.d.ts +1 -1
- package/dist/chat/state/session-log.d.ts +140 -26
- package/dist/chat/state/turn-session.d.ts +18 -5
- package/dist/chat/task-execution/slack-work.d.ts +2 -2
- package/dist/chat/task-execution/state.d.ts +4 -4
- package/dist/chat/tool-support/zod-tool.d.ts +16 -4
- package/dist/chat/tools/advisor/tool.d.ts +41 -1
- package/dist/chat/tools/definition.d.ts +10 -0
- package/dist/chat/tools/execute-tool.d.ts +41 -1
- package/dist/chat/tools/resource-events.d.ts +124 -3
- package/dist/chat/tools/runtime/report-progress.d.ts +40 -1
- package/dist/chat/tools/sandbox/bash.d.ts +41 -1
- package/dist/chat/tools/sandbox/edit-file.d.ts +44 -1
- package/dist/chat/tools/sandbox/find-files.d.ts +42 -1
- package/dist/chat/tools/sandbox/grep.d.ts +46 -1
- package/dist/chat/tools/sandbox/list-dir.d.ts +41 -1
- package/dist/chat/tools/sandbox/read-file.d.ts +42 -1
- package/dist/chat/tools/sandbox/write-file.d.ts +41 -1
- package/dist/chat/tools/search-tools.d.ts +102 -1
- package/dist/chat/tools/skill/call-mcp-tool.d.ts +10 -1
- package/dist/chat/tools/skill/load-skill.d.ts +40 -1
- package/dist/chat/tools/skill/search-mcp-tools.d.ts +100 -1
- package/dist/chat/tools/system-time.d.ts +38 -1
- package/dist/chat/tools/types.d.ts +4 -4
- package/dist/chat/tools/web/fetch-tool.d.ts +41 -1
- package/dist/chat/tools/web/image-generate.d.ts +62 -1
- package/dist/chat/tools/web/search.d.ts +41 -1
- package/dist/{chunk-HXL2ZV74.js → chunk-3F54A3YM.js} +82 -11
- package/dist/{chunk-ZGDTBSQ7.js → chunk-7DVIELX3.js} +405 -136
- package/dist/{chunk-GCWD2VHP.js → chunk-7FS3K243.js} +284 -124
- package/dist/{chunk-AOISHLSF.js → chunk-ACJENBVF.js} +143 -20
- package/dist/{chunk-IRRMABQD.js → chunk-APIVR44P.js} +10 -10
- package/dist/{chunk-PIB4EOW6.js → chunk-BMQ5DXHV.js} +19 -72
- package/dist/{chunk-XP7F4LYB.js → chunk-BTH37NCU.js} +4 -4
- package/dist/{chunk-5GBUZI6M.js → chunk-H7KUZAMZ.js} +4 -4
- package/dist/{chunk-TYUXD3FN.js → chunk-MC4ZZE4Q.js} +1 -1
- package/dist/{chunk-QCKGI74V.js → chunk-N25HRI6B.js} +10 -10
- package/dist/{chunk-2S7M37HY.js → chunk-NIFONS4W.js} +86 -47
- package/dist/{chunk-ONFOWI2D.js → chunk-OJP53WIU.js} +16 -15
- package/dist/{chunk-NW7AXDA5.js → chunk-OZJXGX4U.js} +2 -2
- package/dist/{chunk-KC42JAAQ.js → chunk-PFXC67GJ.js} +3 -3
- package/dist/{chunk-ZUK7BL63.js → chunk-S6QKIGRM.js} +66 -54
- package/dist/{chunk-IX76WFJV.js → chunk-TF5VLGA7.js} +10 -10
- package/dist/{chunk-DACFZ5CI.js → chunk-VY7TVOIK.js} +16 -12
- package/dist/{chunk-AN2437E3.js → chunk-YTNPU7I2.js} +2 -2
- package/dist/{chunk-3MPOMK3K.js → chunk-YYBX2BD5.js} +61 -3
- package/dist/{chunk-RS6ANWVT.js → chunk-ZATRYQLR.js} +1 -1
- package/dist/cli/chat.js +20 -20
- package/dist/cli/check.js +3 -3
- package/dist/cli/plugins.js +9 -9
- package/dist/cli/snapshot-warmup.js +6 -6
- package/dist/cli/upgrade.js +9 -9
- package/dist/{db-CXI7PR5U.js → db-GCK43OO3.js} +4 -4
- package/dist/instrumentation.js +1 -1
- package/dist/reporting/conversations.d.ts +3 -3
- package/dist/reporting.d.ts +1 -1
- package/dist/reporting.js +48 -50
- package/dist/{runner-FKL3RAHA.js → runner-XWTFA26U.js} +20 -18
- package/dist/{validation-I7GD2YWS.js → validation-KYAWETI4.js} +3 -3
- package/package.json +6 -6
- package/dist/chat/requester.d.ts +0 -68
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getChatConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3F54A3YM.js";
|
|
4
4
|
import {
|
|
5
5
|
parseDestination,
|
|
6
6
|
sameDestination
|
|
7
7
|
} from "./chunk-GHGPTPBL.js";
|
|
8
8
|
import {
|
|
9
9
|
normalizeIdentityEmail,
|
|
10
|
-
|
|
11
|
-
} from "./chunk-
|
|
10
|
+
parseStoredSlackActor
|
|
11
|
+
} from "./chunk-S6QKIGRM.js";
|
|
12
12
|
|
|
13
13
|
// src/chat/conversations/sql/store.ts
|
|
14
14
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -139,16 +139,13 @@ var juniorConversations = pgTable4(
|
|
|
139
139
|
actorIdentityId: text4("actor_identity_id").references(
|
|
140
140
|
() => juniorIdentities.id
|
|
141
141
|
),
|
|
142
|
-
requesterIdentityId: text4("requester_identity_id").references(
|
|
143
|
-
() => juniorIdentities.id
|
|
144
|
-
),
|
|
145
142
|
creatorIdentityId: text4("creator_identity_id").references(
|
|
146
143
|
() => juniorIdentities.id
|
|
147
144
|
),
|
|
148
145
|
credentialSubjectIdentityId: text4(
|
|
149
146
|
"credential_subject_identity_id"
|
|
150
147
|
).references(() => juniorIdentities.id),
|
|
151
|
-
|
|
148
|
+
actor: jsonb3("actor_json").$type(),
|
|
152
149
|
channelName: text4("channel_name"),
|
|
153
150
|
title: text4("title"),
|
|
154
151
|
createdAt: timestamptz("created_at").notNull(),
|
|
@@ -178,10 +175,6 @@ var juniorConversations = pgTable4(
|
|
|
178
175
|
table.actorIdentityId,
|
|
179
176
|
table.lastActivityAt.desc()
|
|
180
177
|
),
|
|
181
|
-
index3("junior_conversations_requester_activity_idx").on(
|
|
182
|
-
table.requesterIdentityId,
|
|
183
|
-
table.lastActivityAt.desc()
|
|
184
|
-
),
|
|
185
178
|
index3("junior_conversations_origin_idx").on(
|
|
186
179
|
table.originType,
|
|
187
180
|
table.originId,
|
|
@@ -546,13 +539,69 @@ CREATE INDEX IF NOT EXISTS junior_identities_verified_email_idx
|
|
|
546
539
|
AND email_normalized IS NOT NULL
|
|
547
540
|
`
|
|
548
541
|
];
|
|
542
|
+
var actorCutoverStatements = [
|
|
543
|
+
`
|
|
544
|
+
UPDATE junior_conversations
|
|
545
|
+
SET actor_identity_id = requester_identity_id
|
|
546
|
+
WHERE requester_identity_id IS NOT NULL
|
|
547
|
+
`,
|
|
548
|
+
`
|
|
549
|
+
DO $$
|
|
550
|
+
BEGIN
|
|
551
|
+
IF EXISTS (
|
|
552
|
+
SELECT 1
|
|
553
|
+
FROM information_schema.columns
|
|
554
|
+
WHERE table_name = 'junior_conversations'
|
|
555
|
+
AND column_name = 'requester_json'
|
|
556
|
+
) AND NOT EXISTS (
|
|
557
|
+
SELECT 1
|
|
558
|
+
FROM information_schema.columns
|
|
559
|
+
WHERE table_name = 'junior_conversations'
|
|
560
|
+
AND column_name = 'actor_json'
|
|
561
|
+
) THEN
|
|
562
|
+
ALTER TABLE junior_conversations
|
|
563
|
+
RENAME COLUMN requester_json TO actor_json;
|
|
564
|
+
END IF;
|
|
565
|
+
END $$;
|
|
566
|
+
`,
|
|
567
|
+
`
|
|
568
|
+
ALTER TABLE junior_conversations
|
|
569
|
+
ADD COLUMN IF NOT EXISTS actor_json JSONB
|
|
570
|
+
`,
|
|
571
|
+
`
|
|
572
|
+
DO $$
|
|
573
|
+
BEGIN
|
|
574
|
+
IF EXISTS (
|
|
575
|
+
SELECT 1
|
|
576
|
+
FROM information_schema.columns
|
|
577
|
+
WHERE table_name = 'junior_conversations'
|
|
578
|
+
AND column_name = 'requester_json'
|
|
579
|
+
) THEN
|
|
580
|
+
UPDATE junior_conversations
|
|
581
|
+
SET actor_json = COALESCE(actor_json, requester_json);
|
|
582
|
+
END IF;
|
|
583
|
+
END $$;
|
|
584
|
+
`,
|
|
585
|
+
`
|
|
586
|
+
DROP INDEX IF EXISTS junior_conversations_requester_activity_idx
|
|
587
|
+
`,
|
|
588
|
+
`
|
|
589
|
+
ALTER TABLE junior_conversations
|
|
590
|
+
DROP COLUMN IF EXISTS requester_identity_id
|
|
591
|
+
`,
|
|
592
|
+
`
|
|
593
|
+
ALTER TABLE junior_conversations
|
|
594
|
+
DROP COLUMN IF EXISTS requester_json
|
|
595
|
+
`
|
|
596
|
+
];
|
|
549
597
|
var migrations = [
|
|
550
598
|
defineMigration("0001_conversation_core", coreMetadataStatements),
|
|
551
599
|
defineMigration(
|
|
552
600
|
"0002_slack_destination_visibility_backfill",
|
|
553
601
|
destinationVisibilityBackfillStatements
|
|
554
602
|
),
|
|
555
|
-
defineMigration("0003_user_identities", userIdentityStatements)
|
|
603
|
+
defineMigration("0003_user_identities", userIdentityStatements),
|
|
604
|
+
defineMigration("0004_actor_cutover", actorCutoverStatements)
|
|
556
605
|
];
|
|
557
606
|
function parseStoredMigrationRecord(value) {
|
|
558
607
|
return migrationRecordSchema.parse(value);
|
|
@@ -629,18 +678,18 @@ function sourceFromValue(value) {
|
|
|
629
678
|
}
|
|
630
679
|
return void 0;
|
|
631
680
|
}
|
|
632
|
-
function
|
|
633
|
-
if (!
|
|
681
|
+
function identityFromActor(actor) {
|
|
682
|
+
if (!actor?.slackUserId) {
|
|
634
683
|
return void 0;
|
|
635
684
|
}
|
|
636
685
|
return {
|
|
637
686
|
kind: "user",
|
|
638
687
|
provider: "slack",
|
|
639
|
-
providerTenantId:
|
|
640
|
-
providerSubjectId:
|
|
641
|
-
...
|
|
642
|
-
...
|
|
643
|
-
...
|
|
688
|
+
providerTenantId: actor.teamId,
|
|
689
|
+
providerSubjectId: actor.slackUserId,
|
|
690
|
+
...actor.fullName ? { displayName: actor.fullName } : {},
|
|
691
|
+
...actor.slackUserName ? { handle: actor.slackUserName } : {},
|
|
692
|
+
...actor.email ? { email: actor.email, emailVerified: true } : {},
|
|
644
693
|
metadata: { platform: "slack" }
|
|
645
694
|
};
|
|
646
695
|
}
|
|
@@ -672,7 +721,7 @@ function systemIdentityFromSource(source) {
|
|
|
672
721
|
return void 0;
|
|
673
722
|
}
|
|
674
723
|
function actorIdentityForConversation(conversation) {
|
|
675
|
-
return
|
|
724
|
+
return identityFromActor(conversation.actor) ?? systemIdentityFromSource(conversation.source);
|
|
676
725
|
}
|
|
677
726
|
function originTypeFromSource(source) {
|
|
678
727
|
return source;
|
|
@@ -722,7 +771,7 @@ function privacyFromRow(row) {
|
|
|
722
771
|
}
|
|
723
772
|
return row.destinationVisibility === "public" ? "public" : "private";
|
|
724
773
|
}
|
|
725
|
-
function
|
|
774
|
+
function actorFromIdentityRow(identity, fallback) {
|
|
726
775
|
if (!identity || identity.provider !== "slack") {
|
|
727
776
|
return fallback;
|
|
728
777
|
}
|
|
@@ -743,15 +792,15 @@ function conversationFromRow(readRow) {
|
|
|
743
792
|
throw new Error("Conversation record schema version is invalid");
|
|
744
793
|
}
|
|
745
794
|
const destination = row.destination === void 0 || row.destination === null ? void 0 : parseDestination(row.destination);
|
|
746
|
-
const
|
|
747
|
-
readRow.
|
|
748
|
-
|
|
795
|
+
const actor = actorFromIdentityRow(
|
|
796
|
+
readRow.actorIdentity,
|
|
797
|
+
parseStoredSlackActor(row.actor)
|
|
749
798
|
);
|
|
750
799
|
if (row.destination !== void 0 && row.destination !== null && !destination) {
|
|
751
800
|
throw new Error("Conversation record destination is invalid");
|
|
752
801
|
}
|
|
753
|
-
if (row.
|
|
754
|
-
throw new Error("Conversation record
|
|
802
|
+
if (row.actor !== void 0 && row.actor !== null && !actor) {
|
|
803
|
+
throw new Error("Conversation record actor is invalid");
|
|
755
804
|
}
|
|
756
805
|
const source = row.source === void 0 || row.source === null ? void 0 : sourceFromValue(row.source);
|
|
757
806
|
if (row.source !== void 0 && row.source !== null && !source) {
|
|
@@ -772,7 +821,7 @@ function conversationFromRow(readRow) {
|
|
|
772
821
|
updatedAtMs: requiredMsFromDate(row.updatedAt),
|
|
773
822
|
execution,
|
|
774
823
|
...destination ? { destination } : {},
|
|
775
|
-
...
|
|
824
|
+
...actor ? { actor } : {},
|
|
776
825
|
...row.channelName ? { channelName: row.channelName } : {},
|
|
777
826
|
...source ? { source } : {},
|
|
778
827
|
...row.title ? { title: row.title } : {},
|
|
@@ -802,7 +851,7 @@ function assertSameConversationDestination(args) {
|
|
|
802
851
|
`Conversation destination changed for ${args.conversationId}`
|
|
803
852
|
);
|
|
804
853
|
}
|
|
805
|
-
function
|
|
854
|
+
function mergeActor(current2, next) {
|
|
806
855
|
if (!current2) {
|
|
807
856
|
return next;
|
|
808
857
|
}
|
|
@@ -879,7 +928,7 @@ var SqlStore = class {
|
|
|
879
928
|
destination: current2.destination ?? args.destination,
|
|
880
929
|
source: current2.source ?? args.source,
|
|
881
930
|
channelName: current2.channelName ?? args.channelName,
|
|
882
|
-
|
|
931
|
+
actor: mergeActor(current2.actor, args.actor),
|
|
883
932
|
title: current2.title ?? args.title,
|
|
884
933
|
lastActivityAtMs: Math.max(current2.lastActivityAtMs, activityAtMs),
|
|
885
934
|
updatedAtMs: nowMs,
|
|
@@ -903,7 +952,7 @@ var SqlStore = class {
|
|
|
903
952
|
updatedAtMs: args.updatedAtMs,
|
|
904
953
|
...args.channelName ? { channelName: args.channelName } : {},
|
|
905
954
|
...args.destination ? { destination: args.destination } : {},
|
|
906
|
-
...args.
|
|
955
|
+
...args.actor ? { actor: args.actor } : {},
|
|
907
956
|
...args.source ? { source: args.source } : {},
|
|
908
957
|
...args.title ? { title: args.title } : {},
|
|
909
958
|
...args.visibility ? { visibility: args.visibility } : {},
|
|
@@ -936,7 +985,7 @@ var SqlStore = class {
|
|
|
936
985
|
existing.lastActivityAtMs,
|
|
937
986
|
conversation.lastActivityAtMs
|
|
938
987
|
),
|
|
939
|
-
|
|
988
|
+
actor: existing.actor ?? conversation.actor,
|
|
940
989
|
source: existing.source ?? conversation.source,
|
|
941
990
|
title: existing.title ?? conversation.title,
|
|
942
991
|
updatedAtMs: Math.max(
|
|
@@ -953,13 +1002,13 @@ var SqlStore = class {
|
|
|
953
1002
|
const rows = await this.executor.db().select({
|
|
954
1003
|
conversation: juniorConversations,
|
|
955
1004
|
destinationVisibility: juniorDestinations.visibility,
|
|
956
|
-
|
|
1005
|
+
actorIdentity: juniorIdentities
|
|
957
1006
|
}).from(juniorConversations).leftJoin(
|
|
958
1007
|
juniorDestinations,
|
|
959
1008
|
eq2(juniorDestinations.id, juniorConversations.destinationId)
|
|
960
1009
|
).leftJoin(
|
|
961
1010
|
juniorIdentities,
|
|
962
|
-
eq2(juniorIdentities.id, juniorConversations.
|
|
1011
|
+
eq2(juniorIdentities.id, juniorConversations.actorIdentityId)
|
|
963
1012
|
).orderBy(
|
|
964
1013
|
desc(juniorConversations.lastActivityAt),
|
|
965
1014
|
asc(juniorConversations.conversationId)
|
|
@@ -1003,13 +1052,13 @@ var SqlStore = class {
|
|
|
1003
1052
|
const rows = await this.executor.db().select({
|
|
1004
1053
|
conversation: juniorConversations,
|
|
1005
1054
|
destinationVisibility: juniorDestinations.visibility,
|
|
1006
|
-
|
|
1055
|
+
actorIdentity: juniorIdentities
|
|
1007
1056
|
}).from(juniorConversations).leftJoin(
|
|
1008
1057
|
juniorDestinations,
|
|
1009
1058
|
eq2(juniorDestinations.id, juniorConversations.destinationId)
|
|
1010
1059
|
).leftJoin(
|
|
1011
1060
|
juniorIdentities,
|
|
1012
|
-
eq2(juniorIdentities.id, juniorConversations.
|
|
1061
|
+
eq2(juniorIdentities.id, juniorConversations.actorIdentityId)
|
|
1013
1062
|
).where(eq2(juniorConversations.conversationId, conversationId));
|
|
1014
1063
|
return rows[0];
|
|
1015
1064
|
}
|
|
@@ -1028,14 +1077,6 @@ var SqlStore = class {
|
|
|
1028
1077
|
}),
|
|
1029
1078
|
conversation.updatedAtMs
|
|
1030
1079
|
);
|
|
1031
|
-
const requesterIdentityObservation = identityFromRequester(
|
|
1032
|
-
conversation.requester
|
|
1033
|
-
);
|
|
1034
|
-
const requesterIdentity = requesterIdentityObservation ? await upsertIdentity(
|
|
1035
|
-
this.executor,
|
|
1036
|
-
requesterIdentityObservation,
|
|
1037
|
-
conversation.updatedAtMs
|
|
1038
|
-
) : void 0;
|
|
1039
1080
|
const actorIdentityObservation = actorIdentityForConversation(conversation);
|
|
1040
1081
|
const actorIdentity = actorIdentityObservation ? await upsertIdentity(
|
|
1041
1082
|
this.executor,
|
|
@@ -1052,10 +1093,9 @@ var SqlStore = class {
|
|
|
1052
1093
|
destinationId: destinationId ?? null,
|
|
1053
1094
|
destination: conversation.destination ?? null,
|
|
1054
1095
|
actorIdentityId: actorIdentity?.id ?? null,
|
|
1055
|
-
requesterIdentityId: requesterIdentity?.id ?? null,
|
|
1056
1096
|
creatorIdentityId: null,
|
|
1057
1097
|
credentialSubjectIdentityId: null,
|
|
1058
|
-
|
|
1098
|
+
actor: conversation.actor ?? null,
|
|
1059
1099
|
channelName: conversation.channelName ?? null,
|
|
1060
1100
|
title: conversation.title ?? null,
|
|
1061
1101
|
createdAt: dateFromMs2(conversation.createdAtMs),
|
|
@@ -1076,10 +1116,9 @@ var SqlStore = class {
|
|
|
1076
1116
|
destinationId: sql4`coalesce(excluded.destination_id, ${juniorConversations.destinationId})`,
|
|
1077
1117
|
destination: sql4`coalesce(excluded.destination_json, ${juniorConversations.destination})`,
|
|
1078
1118
|
actorIdentityId: sql4`coalesce(excluded.actor_identity_id, ${juniorConversations.actorIdentityId})`,
|
|
1079
|
-
requesterIdentityId: sql4`coalesce(excluded.requester_identity_id, ${juniorConversations.requesterIdentityId})`,
|
|
1080
1119
|
creatorIdentityId: sql4`coalesce(excluded.creator_identity_id, ${juniorConversations.creatorIdentityId})`,
|
|
1081
1120
|
credentialSubjectIdentityId: sql4`coalesce(excluded.credential_subject_identity_id, ${juniorConversations.credentialSubjectIdentityId})`,
|
|
1082
|
-
|
|
1121
|
+
actor: sql4`coalesce(excluded.actor_json, ${juniorConversations.actor})`,
|
|
1083
1122
|
channelName: sql4`coalesce(excluded.channel_name, ${juniorConversations.channelName})`,
|
|
1084
1123
|
title: sql4`coalesce(excluded.title, ${juniorConversations.title})`,
|
|
1085
1124
|
createdAt: sql4`least(${juniorConversations.createdAt}, excluded.created_at)`,
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
3
3
|
buildConversationStatePatch
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PFXC67GJ.js";
|
|
5
5
|
import {
|
|
6
6
|
abandonAgentTurnSessionRecord,
|
|
7
7
|
getAgentTurnSessionRecord,
|
|
8
8
|
upsertAgentTurnSessionRecord
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7FS3K243.js";
|
|
10
10
|
import {
|
|
11
11
|
getStateAdapter
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZATRYQLR.js";
|
|
13
13
|
import {
|
|
14
14
|
getPiMessageRole,
|
|
15
15
|
trimTrailingAssistantMessages
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3F54A3YM.js";
|
|
17
17
|
import {
|
|
18
18
|
getActiveTraceId,
|
|
19
19
|
logException
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-S6QKIGRM.js";
|
|
21
21
|
import {
|
|
22
22
|
isRecord,
|
|
23
23
|
toOptionalString
|
|
@@ -152,7 +152,7 @@ function logSessionRecordError(error, eventName, args, attributes, message) {
|
|
|
152
152
|
eventName,
|
|
153
153
|
{
|
|
154
154
|
slackThreadId: args.logContext.threadId,
|
|
155
|
-
slackUserId: args.logContext.
|
|
155
|
+
slackUserId: args.logContext.actorId,
|
|
156
156
|
slackChannelId: args.logContext.channelId,
|
|
157
157
|
runId: args.logContext.runId,
|
|
158
158
|
assistantUserName: args.logContext.assistantUserName,
|
|
@@ -219,9 +219,10 @@ async function persistRunningSessionRecord(args) {
|
|
|
219
219
|
sliceId: args.sliceId,
|
|
220
220
|
state: "running",
|
|
221
221
|
piMessages: args.messages,
|
|
222
|
+
...args.trailingMessageProvenance ? { trailingMessageProvenance: args.trailingMessageProvenance } : {},
|
|
222
223
|
...args.surface ?? latestSessionRecord?.surface ? { surface: args.surface ?? latestSessionRecord?.surface } : {},
|
|
223
224
|
...args.loadedSkillNames ? { loadedSkillNames: args.loadedSkillNames } : {},
|
|
224
|
-
...args.
|
|
225
|
+
...args.actor ?? latestSessionRecord?.actor ? { actor: args.actor ?? latestSessionRecord?.actor } : {},
|
|
225
226
|
...getActiveTraceId() ?? latestSessionRecord?.traceId ? { traceId: getActiveTraceId() ?? latestSessionRecord?.traceId } : {},
|
|
226
227
|
...(args.turnStartMessageIndex ?? latestSessionRecord?.turnStartMessageIndex) !== void 0 ? {
|
|
227
228
|
turnStartMessageIndex: args.turnStartMessageIndex ?? latestSessionRecord?.turnStartMessageIndex
|
|
@@ -276,7 +277,7 @@ async function persistCompletedSessionRecord(args) {
|
|
|
276
277
|
...args.loadedSkillNames ?? latestSessionRecord?.loadedSkillNames ? {
|
|
277
278
|
loadedSkillNames: args.loadedSkillNames ?? latestSessionRecord?.loadedSkillNames
|
|
278
279
|
} : {},
|
|
279
|
-
...args.
|
|
280
|
+
...args.actor ?? latestSessionRecord?.actor ? { actor: args.actor ?? latestSessionRecord?.actor } : {},
|
|
280
281
|
...getActiveTraceId() ?? latestSessionRecord?.traceId ? { traceId: getActiveTraceId() ?? latestSessionRecord?.traceId } : {},
|
|
281
282
|
...(args.turnStartMessageIndex ?? latestSessionRecord?.turnStartMessageIndex) !== void 0 ? {
|
|
282
283
|
turnStartMessageIndex: args.turnStartMessageIndex ?? latestSessionRecord?.turnStartMessageIndex
|
|
@@ -306,7 +307,7 @@ async function completeDeliveredTurn(args) {
|
|
|
306
307
|
allMessages: args.messages,
|
|
307
308
|
loadedSkillNames: args.loadedSkillNames,
|
|
308
309
|
logContext: args.logContext,
|
|
309
|
-
|
|
310
|
+
actor: args.actor,
|
|
310
311
|
surface: args.surface,
|
|
311
312
|
turnStartMessageIndex: args.turnStartMessageIndex
|
|
312
313
|
});
|
|
@@ -347,7 +348,7 @@ async function persistAuthPauseSessionRecord(args) {
|
|
|
347
348
|
resumeReason: "auth",
|
|
348
349
|
resumedFromSliceId: args.currentSliceId,
|
|
349
350
|
errorMessage: args.errorMessage,
|
|
350
|
-
...args.
|
|
351
|
+
...args.actor ?? latestSessionRecord?.actor ? { actor: args.actor ?? latestSessionRecord?.actor } : {},
|
|
351
352
|
...getActiveTraceId() ?? latestSessionRecord?.traceId ? { traceId: getActiveTraceId() ?? latestSessionRecord?.traceId } : {}
|
|
352
353
|
});
|
|
353
354
|
} catch (recordError) {
|
|
@@ -407,7 +408,7 @@ async function persistTimeoutSessionRecord(args) {
|
|
|
407
408
|
resumeReason: "timeout",
|
|
408
409
|
resumedFromSliceId: latestSessionRecord?.resumedFromSliceId,
|
|
409
410
|
errorMessage: `Agent continuation exceeded slice limit (${AGENT_CONTINUE_MAX_SLICES})`,
|
|
410
|
-
...args.
|
|
411
|
+
...args.actor ?? latestSessionRecord?.actor ? { actor: args.actor ?? latestSessionRecord?.actor } : {},
|
|
411
412
|
...getActiveTraceId() ?? latestSessionRecord?.traceId ? { traceId: getActiveTraceId() ?? latestSessionRecord?.traceId } : {}
|
|
412
413
|
});
|
|
413
414
|
}
|
|
@@ -427,7 +428,7 @@ async function persistTimeoutSessionRecord(args) {
|
|
|
427
428
|
resumeReason: "timeout",
|
|
428
429
|
resumedFromSliceId: args.currentSliceId,
|
|
429
430
|
errorMessage: args.errorMessage,
|
|
430
|
-
...args.
|
|
431
|
+
...args.actor ?? latestSessionRecord?.actor ? { actor: args.actor ?? latestSessionRecord?.actor } : {},
|
|
431
432
|
...getActiveTraceId() ?? latestSessionRecord?.traceId ? { traceId: getActiveTraceId() ?? latestSessionRecord?.traceId } : {}
|
|
432
433
|
});
|
|
433
434
|
} catch (recordError) {
|
|
@@ -479,7 +480,7 @@ async function persistYieldSessionRecord(args) {
|
|
|
479
480
|
resumeReason: "yield",
|
|
480
481
|
resumedFromSliceId: latestSessionRecord?.resumedFromSliceId,
|
|
481
482
|
errorMessage: args.errorMessage,
|
|
482
|
-
...args.
|
|
483
|
+
...args.actor ?? latestSessionRecord?.actor ? { actor: args.actor ?? latestSessionRecord?.actor } : {},
|
|
483
484
|
...getActiveTraceId() ?? latestSessionRecord?.traceId ? { traceId: getActiveTraceId() ?? latestSessionRecord?.traceId } : {}
|
|
484
485
|
});
|
|
485
486
|
} catch (recordError) {
|
|
@@ -869,14 +870,14 @@ function canReusePendingAuthLink(args) {
|
|
|
869
870
|
if (!pendingAuth) {
|
|
870
871
|
return false;
|
|
871
872
|
}
|
|
872
|
-
return pendingAuth.kind === args.kind && pendingAuth.provider === args.provider && pendingAuth.
|
|
873
|
+
return pendingAuth.kind === args.kind && pendingAuth.provider === args.provider && pendingAuth.actorId === args.actorId && pendingAuth.scope === args.scope && pendingAuth.sessionId === args.sessionId && pendingAuth.linkSentAtMs + AUTH_LINK_REUSE_WINDOW_MS > (args.nowMs ?? Date.now());
|
|
873
874
|
}
|
|
874
875
|
function getConversationPendingAuth(args) {
|
|
875
876
|
const pendingAuth = args.conversation.processing.pendingAuth;
|
|
876
877
|
if (!pendingAuth) {
|
|
877
878
|
return void 0;
|
|
878
879
|
}
|
|
879
|
-
if (pendingAuth.kind !== args.kind || pendingAuth.provider !== args.provider || pendingAuth.
|
|
880
|
+
if (pendingAuth.kind !== args.kind || pendingAuth.provider !== args.provider || pendingAuth.actorId !== args.actorId || pendingAuth.scope !== args.scope) {
|
|
880
881
|
return void 0;
|
|
881
882
|
}
|
|
882
883
|
return pendingAuth;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getStateAdapter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZATRYQLR.js";
|
|
4
4
|
import {
|
|
5
5
|
logException,
|
|
6
6
|
logInfo,
|
|
7
7
|
logWarn
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-S6QKIGRM.js";
|
|
9
9
|
|
|
10
10
|
// src/chat/plugins/logging.ts
|
|
11
11
|
function createPluginLogger(plugin) {
|
|
@@ -88,17 +88,17 @@ function coercePendingAuthState(value) {
|
|
|
88
88
|
}
|
|
89
89
|
const kind = value.kind;
|
|
90
90
|
const provider = toOptionalString(value.provider);
|
|
91
|
-
const
|
|
91
|
+
const actorId = toOptionalString(value.actorId);
|
|
92
92
|
const scope = toOptionalString(value.scope);
|
|
93
93
|
const sessionId = toOptionalString(value.sessionId);
|
|
94
94
|
const linkSentAtMs = toOptionalNumber(value.linkSentAtMs);
|
|
95
|
-
if (kind !== "mcp" && kind !== "plugin" || !provider || !
|
|
95
|
+
if (kind !== "mcp" && kind !== "plugin" || !provider || !actorId || !sessionId || typeof linkSentAtMs !== "number") {
|
|
96
96
|
return void 0;
|
|
97
97
|
}
|
|
98
98
|
return {
|
|
99
99
|
kind,
|
|
100
100
|
provider,
|
|
101
|
-
|
|
101
|
+
actorId,
|
|
102
102
|
...scope ? { scope } : {},
|
|
103
103
|
sessionId,
|
|
104
104
|
linkSentAtMs
|