@sentry/junior 0.311.0 → 0.312.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/{adapter-context-G2M0y6rP.js → adapter-context-BRjEWRy1.js} +2 -2
- package/dist/{adapter-B1wujchl.js → adapter-iIq7ihf7.js} +1 -1
- package/dist/{admin-DCiBhUT1.js → admin-DhInw5K9.js} +1 -1
- package/dist/{agent-runner-BVHPUIc8.js → agent-runner-C9iDurwX.js} +3423 -3477
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +6 -6
- package/dist/api.d.ts +2 -2
- package/dist/api.js +289 -306
- package/dist/{app-Cw5Vy6H6.d.ts → app-DRFrC8Mw.d.ts} +2 -9
- package/dist/app.d.ts +1 -1
- package/dist/app.js +338 -604
- package/dist/{background-compaction-queue-CJDnWVOJ.js → background-compaction-queue-DrKi7w3d.js} +10 -85
- package/dist/callback-mFlTUWWx.js +75 -0
- package/dist/{catalog-runtime-DMY3VV-D.js → catalog-runtime-D7xapBAX.js} +1 -1
- package/dist/channel-access-CJGfNTdn.js +221 -0
- package/dist/child-message-DcsritGf.js +179 -0
- package/dist/cli/chat.js +18 -19
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +0 -1
- package/dist/cli/main.js +3 -7
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/run.d.ts +1 -2
- package/dist/cli/run.js +1 -2
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-BrXDQefC.js → config-kXB2Y5tl.js} +59 -27
- package/dist/{continue-in-slack-DNXSC9So.js → continue-in-slack-O6pV5004.js} +7 -8
- package/dist/{conversation-feed-DkinDu5o.js → conversation-feed-uNOv_x68.js} +74 -20
- package/dist/{conversation-privacy-DxttrKb9.js → conversation-privacy-L4ja1_W6.js} +1 -1
- package/dist/{conversation-turn-DWw7Xhdr.js → conversation-turn-CeLbHqdw.js} +31 -27
- package/dist/{credential-sync-Bk8wGb8Y.js → credential-sync-I8VBGk05.js} +16 -15
- package/dist/{projection-Cns7XwWa.js → credentialed-Cb6E2phL.js} +16308 -20732
- package/dist/{db-7ETESH44.d.ts → db-BbC5stfa.d.ts} +11 -6
- package/dist/{db-DTxzH7u5.js → db-LAyyX8tk.js} +174 -91
- package/dist/{executor-DqTiYj9S.js → executor-SCub-fAq.js} +117 -97
- package/dist/{html-B9Sl4Axb.js → html-BCZ3Xtb_.js} +6 -6
- package/dist/ingest-BDf3D50j.js +3836 -0
- package/dist/{install-Sg4ePfLl.js → install-DCFJFkC0.js} +2 -2
- package/dist/instrumentation.js +3 -3
- package/dist/{lineage-BHAMpNKr.js → lineage-B_m-4TJw.js} +2 -2
- package/dist/{stop-CYsfc0Ed.js → list-CN2QA2R9.js} +663 -442
- package/dist/{logging-FjclQsXu.js → logging-dQ9ZRGQ8.js} +1 -1
- package/dist/{schedule-BLJ476XQ.js → media-CYm1QD8T.js} +1055 -11
- package/dist/{message-CJ7_RL50.js → message-DSXGj1hM.js} +19 -26
- package/dist/{model-input-CMLh4Cwq.js → model-input--TrP9hYV.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +4 -3
- package/dist/{oauth-callback-server-RVcbiDjL.js → oauth-callback-server-DHCZC6B4.js} +2 -2
- package/dist/{oauth-relay-Bu9kkaQu.js → oauth-relay-pPMGnDZt.js} +1 -1
- package/dist/{registry-BPwuOP2O.js → registry-CZOzddwu.js} +1 -1
- package/dist/{resolve-BK29bBry.js → resolve-cKOQ14Dh.js} +3 -3
- package/dist/result-DcvEOe1r.js +574 -0
- package/dist/result-event-type-BdIJuZxg.js +48 -0
- package/dist/{runner-BcAE-cJm.js → runner-DBfUW44l.js} +14 -16
- package/dist/{sandbox-egress-signals-C-q0go5b.js → sandbox-egress-signals-BVF_xAm1.js} +1 -1
- package/dist/{schema-DYcJeV7d.d.ts → schema-BEHKxr4I.d.ts} +166 -242
- package/dist/{schema-BLgSZXcL.js → schema-Bk9Nm2E8.js} +106 -121
- package/dist/{service-account-iJoCtkHR.js → service-account-CVYsFjty.js} +3 -3
- package/dist/{service-account-gN0zqf0S.js → service-account-Ts4ulcrV.js} +5 -5
- package/dist/{skills-BoZ80epJ.js → skills-VTnhAJWm.js} +2 -2
- package/dist/{slack-conversation-unfurl-CogYrITA.js → slack-conversation-unfurl-fuLnF1jE.js} +9 -9
- package/dist/{spawn-Dk92r7mX.js → spawn-vxAarlX5.js} +6 -5
- package/dist/start-conversation-CEn2KH1A.js +941 -0
- package/dist/{state-DH3Cmgp3.js → state-C1P3_Ywk.js} +4 -4
- package/dist/statuses-_cRJHXK7.js +150 -0
- package/dist/store-DFZaN-Ix.js +492 -0
- package/dist/task-queue-Cx4Lmjyk.js +90 -0
- package/dist/task-runner-CbTwFA6k.js +1432 -0
- package/dist/{thread-context-BW2BsQbH.js → thread-context-BkAZDTX2.js} +7 -7
- package/dist/thread-state-DhPndWi1.js +5625 -0
- package/dist/{validation-DrJd0nnq.js → validation-nIzMtAVJ.js} +1 -1
- package/dist/{task-queue-C_zldF5J.js → vercel-queue-hW90XzbG.js} +93 -172
- package/dist/{version-CNKZ8owc.js → version-Brbtz4Qf.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{warmup-BWdHew2H.js → warmup-BDA5myRK.js} +6463 -12290
- package/dist/web-message-id-C6P83ans.js +10 -0
- package/dist/{worker-t9qpu_Zx.js → worker-D63RcaVD.js} +20 -7
- package/migrations/0143_todos.sql +14 -0
- package/migrations/0144_inbox_items.sql +32 -0
- package/migrations/0145_todo_changed_by_agent.sql +1 -0
- package/migrations/0146_inbox_item_subject_title_parts.sql +1 -0
- package/migrations/0147_inbox_snooze_wake_reason.sql +1 -0
- package/migrations/0148_authorization_request_index.sql +1 -0
- package/migrations/0149_conversation_metadata.sql +10 -0
- package/migrations/0150_conversation_metadata_fill.sql +39 -0
- package/migrations/0151_conversation_search_index.sql +1 -0
- package/migrations/0152_inbox_item_legacy_automation_keys.sql +21 -0
- package/migrations/0153_artifact_expiry.sql +1 -0
- package/migrations/0154_artifact_permanent_sha_index.sql +1 -0
- package/migrations/0155_artifact_drop_public_sha_index.sql +3 -0
- package/migrations/0156_conversation_kind_lead.sql +6 -0
- package/migrations/0157_conversation_lead_actor_index.sql +1 -0
- package/migrations/meta/0143_snapshot.json +6434 -0
- package/migrations/meta/0144_snapshot.json +6434 -0
- package/migrations/meta/0145_snapshot.json +6440 -0
- package/migrations/meta/0146_snapshot.json +6446 -0
- package/migrations/meta/0147_snapshot.json +6452 -0
- package/migrations/meta/0148_snapshot.json +6474 -0
- package/migrations/meta/0149_snapshot.json +6490 -0
- package/migrations/meta/0150_snapshot.json +6490 -0
- package/migrations/meta/0151_snapshot.json +6505 -0
- package/migrations/meta/0152_snapshot.json +6505 -0
- package/migrations/meta/0153_snapshot.json +6511 -0
- package/migrations/meta/0154_snapshot.json +6533 -0
- package/migrations/meta/0155_snapshot.json +6511 -0
- package/migrations/meta/0156_snapshot.json +6511 -0
- package/migrations/meta/0157_snapshot.json +6527 -0
- package/migrations/meta/_journal.json +106 -1
- package/package.json +6 -6
- package/skills/design-automation-skill/SKILL.md +108 -0
- package/dist/briefs-BDjnug6Y.js +0 -395
- package/dist/conversation-ca__NDQW.js +0 -1063
- package/dist/prompt-CDqcsDYC.js +0 -910
- package/dist/store-DmmMIrQi.js +0 -335
- package/dist/task-runner-C7oCJQIx.js +0 -294
- package/dist/turn-session-routing-Xh_2nSQe.js +0 -261
- package/dist/web-message-id-Ch5dPq-a.js +0 -306
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h as logWarn, p as logException } from "./logging-
|
|
1
|
+
import { h as logWarn, p as logException } from "./logging-dQ9ZRGQ8.js";
|
|
2
2
|
import { _ as withScope } from "./sentry-CPbZjomA.js";
|
|
3
|
-
import "./config-
|
|
3
|
+
import "./config-kXB2Y5tl.js";
|
|
4
4
|
import * as z from "zod";
|
|
5
5
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
6
|
import { actorSchema, sourceSchema } from "@sentry/junior-plugin-api";
|
|
@@ -33,12 +33,14 @@ const juniorArtifacts = pgTable("junior_artifacts", {
|
|
|
33
33
|
visibility: text("visibility").$type().notNull().default("conversation"),
|
|
34
34
|
createdAt: timestamptz("created_at").notNull(),
|
|
35
35
|
/** Set when the artifact is unpublished or its live file is deleted. */
|
|
36
|
-
deleteRequestedAt: timestamptz("delete_requested_at")
|
|
36
|
+
deleteRequestedAt: timestamptz("delete_requested_at"),
|
|
37
|
+
/** When a public artifact stops serving. Null serves until unpublished. */
|
|
38
|
+
expiresAt: timestamptz("expires_at")
|
|
37
39
|
}, (table) => [
|
|
38
40
|
check("junior_artifacts_visibility_check", sql`${table.visibility} in ('conversation', 'internal', 'public')`),
|
|
39
41
|
check("junior_artifacts_path_visibility_check", sql`(${table.path} is null) = (${table.visibility} = 'public')`),
|
|
40
42
|
uniqueIndex("junior_artifacts_conversation_path_uidx").on(table.conversationId, table.path),
|
|
41
|
-
uniqueIndex("
|
|
43
|
+
uniqueIndex("junior_artifacts_permanent_sha_uidx").on(table.conversationId, table.sha256).where(sql`${table.visibility} = 'public' and ${table.expiresAt} is null`),
|
|
42
44
|
index("junior_artifacts_gc_idx").on(table.deleteRequestedAt, table.createdAt),
|
|
43
45
|
index("junior_artifacts_conversation_idx").on(table.conversationId)
|
|
44
46
|
]);
|
|
@@ -405,6 +407,8 @@ const juniorConversations = pgTable("junior_conversations", {
|
|
|
405
407
|
actor: jsonb("actor_json").$type(),
|
|
406
408
|
channelName: text("channel_name"),
|
|
407
409
|
title: text("title"),
|
|
410
|
+
summary: text("summary"),
|
|
411
|
+
metadataThroughSeq: integer("metadata_through_seq"),
|
|
408
412
|
createdAt: timestamptz("created_at").notNull(),
|
|
409
413
|
lastActivityAt: timestamptz("last_activity_at").notNull(),
|
|
410
414
|
/**
|
|
@@ -445,15 +449,17 @@ const juniorConversations = pgTable("junior_conversations", {
|
|
|
445
449
|
metricRunId: text("metric_run_id"),
|
|
446
450
|
detailVersion: integer("detail_version").notNull().default(0)
|
|
447
451
|
}, (table) => [
|
|
448
|
-
check("junior_conversations_kind_check", sql`${table.kind} in ('root', 'automation', 'thread', 'task')`),
|
|
449
|
-
check("junior_conversations_kind_parent_check", sql`${table.kind} is null or ((${table.kind} in ('root', 'automation')) = (${table.parentConversationId} is null))`),
|
|
452
|
+
check("junior_conversations_kind_check", sql`${table.kind} in ('root', 'automation', 'lead', 'thread', 'task')`),
|
|
453
|
+
check("junior_conversations_kind_parent_check", sql`${table.kind} is null or ((${table.kind} in ('root', 'automation', 'lead')) = (${table.parentConversationId} is null))`),
|
|
450
454
|
index("junior_conversations_last_activity_idx").on(table.lastActivityAt.desc(), table.conversationId),
|
|
451
455
|
index("junior_conversations_active_idx").using("btree", sql`coalesce(${table.executionUpdatedAt}, ${table.updatedAt})`, table.conversationId).where(sql`${table.executionStatus} <> 'idle'`),
|
|
452
456
|
index("junior_conversations_destination_activity_idx").on(table.destinationId, table.lastActivityAt.desc()),
|
|
453
457
|
index("junior_conversations_actor_activity_idx").on(table.actorIdentityId, table.lastActivityAt.desc()),
|
|
454
458
|
index("junior_conversations_parent_idx").on(table.parentConversationId),
|
|
455
459
|
index("junior_conversations_forked_from_idx").on(table.forkedFromConversationId),
|
|
456
|
-
index("junior_conversations_root_idx").on(table.rootConversationId)
|
|
460
|
+
index("junior_conversations_root_idx").on(table.rootConversationId),
|
|
461
|
+
uniqueIndex("junior_conversations_lead_actor_idx").on(table.actorIdentityId).where(sql`${table.kind} = 'lead'`),
|
|
462
|
+
index("junior_conversations_search_idx").using("gin", sql`to_tsvector('english', coalesce(${table.title}, '') || ' ' || coalesce(${table.summary}, ''))`)
|
|
457
463
|
]);
|
|
458
464
|
// src/db/schema/attachments.ts
|
|
459
465
|
/**
|
|
@@ -666,6 +672,7 @@ const juniorConversationEvents = pgTable("junior_conversation_events", {
|
|
|
666
672
|
index("junior_conversation_events_type_idx").on(table.conversationId, table.type, table.seq),
|
|
667
673
|
index("junior_conversation_events_plugin_report_idx").on(sql`(${table.payload}->>'namespace')`, sql`(${table.payload}->>'name')`, table.createdAt).where(sql`${table.type} = 'structured_event'`),
|
|
668
674
|
index("junior_conversation_events_guardian_review_time_idx").on(table.createdAt).where(sql`${table.type} = 'guardian_action_reviewed'`),
|
|
675
|
+
index("junior_conversation_events_authorization_request_idx").on(table.conversationId, table.createdAt).where(sql`${table.type} = 'authorization_requested'`),
|
|
669
676
|
index("junior_conversation_events_plugin_conversation_idx").on(table.conversationId, sql`(${table.payload}->>'namespace')`, sql`(${table.payload}->>'name')`, table.seq).where(sql`${table.type} = 'structured_event'`),
|
|
670
677
|
index("junior_conversation_events_actor_identity_idx").on(table.actorIdentityId, table.conversationId, table.seq),
|
|
671
678
|
index("junior_conversation_events_author_idx").on(table.conversationId, table.actorIdentityId, table.seq).where(sql`${table.actorIdentityId} is not null`),
|
|
@@ -715,53 +722,26 @@ const juniorConversationMetrics = pgTable("junior_conversation_metrics", {
|
|
|
715
722
|
index("junior_conversation_metrics_occurred_at_metric_idx").on(table.occurredAt, table.metric),
|
|
716
723
|
index("junior_conversation_metrics_turn_metric_occurred_at_idx").on(table.metric, table.occurredAt, table.actorIdentityId, table.conversationId, table.value).where(sql`${table.metric} IN ('duration_ms', 'total_tokens', 'cost_micro_usd')`)
|
|
717
724
|
]);
|
|
718
|
-
// src/db/schema/conversation-briefs.ts
|
|
719
|
-
/** Append-only Brief versions produced for completed Conversation turns. */
|
|
720
|
-
const juniorConversationBriefs = pgTable("junior_conversation_briefs", {
|
|
721
|
-
conversationId: text("conversation_id").notNull(),
|
|
722
|
-
version: integer("version").notNull(),
|
|
723
|
-
turnId: text("turn_id").notNull(),
|
|
724
|
-
throughSeq: integer("through_seq").notNull(),
|
|
725
|
-
content: jsonb("content").$type().notNull(),
|
|
726
|
-
outcomeStatus: text("outcome_status").$type(),
|
|
727
|
-
searchText: text("search_text").notNull(),
|
|
728
|
-
modelId: text("model_id").notNull(),
|
|
729
|
-
costMicroUsd: bigint("cost_micro_usd", { mode: "number" }),
|
|
730
|
-
legacyCostUsd: doublePrecision("cost_usd"),
|
|
731
|
-
createdAt: timestamptz("created_at").defaultNow().notNull()
|
|
732
|
-
}, (table) => [
|
|
733
|
-
primaryKey({
|
|
734
|
-
name: "junior_conversation_briefs_conversation_id_version_pk",
|
|
735
|
-
columns: [table.conversationId, table.version]
|
|
736
|
-
}),
|
|
737
|
-
foreignKey({
|
|
738
|
-
name: "junior_conversation_briefs_conversation_id_junior_conversations_conversation_id_fk",
|
|
739
|
-
columns: [table.conversationId],
|
|
740
|
-
foreignColumns: [juniorConversations.conversationId]
|
|
741
|
-
}).onDelete("cascade"),
|
|
742
|
-
uniqueIndex("junior_conversation_briefs_conversation_turn_idx").on(table.conversationId, table.turnId),
|
|
743
|
-
index("junior_conversation_briefs_conversation_version_idx").on(table.conversationId, table.version.desc()),
|
|
744
|
-
index("junior_conversation_briefs_created_at_idx").on(table.createdAt, table.conversationId),
|
|
745
|
-
index("junior_conversation_briefs_search_idx").using("gin", sql`to_tsvector('english', ${table.searchText})`)
|
|
746
|
-
]);
|
|
747
725
|
// src/db/schema/conversation-embeddings.ts
|
|
748
726
|
/**
|
|
749
|
-
* One embedding per Conversation, for semantic search. Its text is the
|
|
750
|
-
*
|
|
751
|
-
*
|
|
727
|
+
* One embedding per Conversation, for semantic search. Its text is the
|
|
728
|
+
* Conversation metadata. A derived index: the next metadata update replaces
|
|
729
|
+
* the row.
|
|
752
730
|
*/
|
|
753
731
|
const juniorConversationEmbeddings = pgTable("junior_conversation_embeddings", {
|
|
754
732
|
conversationId: text("conversation_id").primaryKey(),
|
|
755
|
-
|
|
733
|
+
legacyBriefVersion: integer("brief_version"),
|
|
734
|
+
/** The `metadata_through_seq` of the embedded Conversation metadata. */
|
|
735
|
+
throughSeq: integer("through_seq"),
|
|
756
736
|
provider: text("provider").notNull(),
|
|
757
737
|
model: text("model").notNull(),
|
|
758
738
|
dimensions: integer("dimensions").notNull(),
|
|
759
739
|
embedding: embeddingVector("embedding").notNull(),
|
|
760
740
|
createdAt: timestamptz("created_at").defaultNow().notNull()
|
|
761
741
|
}, (table) => [foreignKey({
|
|
762
|
-
name: "
|
|
763
|
-
columns: [table.conversationId
|
|
764
|
-
foreignColumns: [
|
|
742
|
+
name: "junior_conversation_embeddings_conversation_fk",
|
|
743
|
+
columns: [table.conversationId],
|
|
744
|
+
foreignColumns: [juniorConversations.conversationId]
|
|
765
745
|
}).onDelete("cascade"), check("junior_conversation_embeddings_dimensions_check", sql`vector_dims(${table.embedding}) = ${table.dimensions}`)]);
|
|
766
746
|
// src/db/schema/conversation-event-embeddings.ts
|
|
767
747
|
/**
|
|
@@ -813,6 +793,39 @@ const juniorConversationEventLexemes = pgTable("junior_conversation_event_lexeme
|
|
|
813
793
|
}).onDelete("cascade"),
|
|
814
794
|
index("junior_conversation_event_lexemes_lexemes_idx").using("gin", table.lexemes)
|
|
815
795
|
]);
|
|
796
|
+
// src/db/schema/conversation-briefs.ts
|
|
797
|
+
/**
|
|
798
|
+
* Legacy Brief versions. Conversation metadata replaced Briefs; only purge
|
|
799
|
+
* still deletes rows here.
|
|
800
|
+
* TODO(dcramer): Drop this table after the metadata backfill ships.
|
|
801
|
+
*/
|
|
802
|
+
const juniorConversationBriefs = pgTable("junior_conversation_briefs", {
|
|
803
|
+
conversationId: text("conversation_id").notNull(),
|
|
804
|
+
version: integer("version").notNull(),
|
|
805
|
+
turnId: text("turn_id").notNull(),
|
|
806
|
+
throughSeq: integer("through_seq").notNull(),
|
|
807
|
+
content: jsonb("content").notNull(),
|
|
808
|
+
outcomeStatus: text("outcome_status"),
|
|
809
|
+
searchText: text("search_text").notNull(),
|
|
810
|
+
modelId: text("model_id").notNull(),
|
|
811
|
+
costMicroUsd: bigint("cost_micro_usd", { mode: "number" }),
|
|
812
|
+
legacyCostUsd: doublePrecision("cost_usd"),
|
|
813
|
+
createdAt: timestamptz("created_at").defaultNow().notNull()
|
|
814
|
+
}, (table) => [
|
|
815
|
+
primaryKey({
|
|
816
|
+
name: "junior_conversation_briefs_conversation_id_version_pk",
|
|
817
|
+
columns: [table.conversationId, table.version]
|
|
818
|
+
}),
|
|
819
|
+
foreignKey({
|
|
820
|
+
name: "junior_conversation_briefs_conversation_id_junior_conversations_conversation_id_fk",
|
|
821
|
+
columns: [table.conversationId],
|
|
822
|
+
foreignColumns: [juniorConversations.conversationId]
|
|
823
|
+
}).onDelete("cascade"),
|
|
824
|
+
uniqueIndex("junior_conversation_briefs_conversation_turn_idx").on(table.conversationId, table.turnId),
|
|
825
|
+
index("junior_conversation_briefs_conversation_version_idx").on(table.conversationId, table.version.desc()),
|
|
826
|
+
index("junior_conversation_briefs_created_at_idx").on(table.createdAt, table.conversationId),
|
|
827
|
+
index("junior_conversation_briefs_search_idx").using("gin", sql`to_tsvector('english', ${table.searchText})`)
|
|
828
|
+
]);
|
|
816
829
|
// src/db/schema/conversation-bindings.ts
|
|
817
830
|
/** Provider conversation coordinates bound to Junior's opaque durable conversation id. */
|
|
818
831
|
const juniorConversationBindings = pgTable("junior_conversation_bindings", {
|
|
@@ -1051,9 +1064,9 @@ const juniorAutomations = pgTable("junior_automations", {
|
|
|
1051
1064
|
index("junior_automations_skill_idx").on(table.skill, table.createdAtMs, table.id).where(sql`${table.status} <> 'deleted' AND ${table.skill} IS NOT NULL`),
|
|
1052
1065
|
index("junior_automations_match_idx").on(table.namespace, table.identifier, table.createdAtMs, table.id).where(sql`${table.status} <> 'deleted'`)
|
|
1053
1066
|
]);
|
|
1054
|
-
// src/db/schema/
|
|
1067
|
+
// src/db/schema/inbox-items.ts
|
|
1055
1068
|
/**
|
|
1056
|
-
* One
|
|
1069
|
+
* One Inbox item: something that needs a person. An action item stores its
|
|
1057
1070
|
* `request`, and
|
|
1058
1071
|
* its `answer` after an assignee submits it. `closed_at` is set for `done`
|
|
1059
1072
|
* and `dismissed`. `closed_by_user_id` is null when an agent closed it.
|
|
@@ -1061,7 +1074,7 @@ const juniorAutomations = pgTable("junior_automations", {
|
|
|
1061
1074
|
* item gets its visibility and tenant, and where the Inbox stacks it. The id
|
|
1062
1075
|
* has no foreign key, because it can name a row of more than one table.
|
|
1063
1076
|
*/
|
|
1064
|
-
const
|
|
1077
|
+
const juniorInboxItems = pgTable("junior_inbox_items", {
|
|
1065
1078
|
id: text("id").primaryKey(),
|
|
1066
1079
|
kind: text("kind").$type().notNull(),
|
|
1067
1080
|
status: text("status").$type().notNull(),
|
|
@@ -1079,6 +1092,8 @@ const juniorReviewItems = pgTable("junior_review_items", {
|
|
|
1079
1092
|
subjectId: text("subject_id"),
|
|
1080
1093
|
subjectTitle: text("subject_title"),
|
|
1081
1094
|
subjectUrl: text("subject_url"),
|
|
1095
|
+
/** The parsed subject title of a code change (`InboxItemSubjectTitleParts`). */
|
|
1096
|
+
subjectTitleParts: jsonb("subject_title_parts").$type(),
|
|
1082
1097
|
ownerKind: text("owner_kind").$type().notNull().default("conversation"),
|
|
1083
1098
|
ownerId: text("owner_id").notNull(),
|
|
1084
1099
|
/**
|
|
@@ -1099,35 +1114,35 @@ const juniorReviewItems = pgTable("junior_review_items", {
|
|
|
1099
1114
|
createdAt: timestamptz("created_at").notNull(),
|
|
1100
1115
|
updatedAt: timestamptz("updated_at").notNull()
|
|
1101
1116
|
}, (table) => [
|
|
1102
|
-
check("
|
|
1103
|
-
check("
|
|
1104
|
-
check("
|
|
1105
|
-
check("
|
|
1106
|
-
check("
|
|
1107
|
-
uniqueIndex("
|
|
1108
|
-
index("
|
|
1109
|
-
index("
|
|
1110
|
-
index("
|
|
1111
|
-
index("
|
|
1112
|
-
index("
|
|
1113
|
-
index("
|
|
1117
|
+
check("junior_inbox_items_kind_check", sql`(${table.kind} = 'notice' and ${table.request} is null and ${table.answer} is null) or (${table.kind} = 'action' and (${table.request} is not null or ((${table.dedupeKey} like 'plugin:%' or ${table.dedupeKey} like 'automation:%') and ${table.answer} is null)))`),
|
|
1118
|
+
check("junior_inbox_items_owner_check", sql`(${table.ownerKind} = 'conversation' and ${table.dedupeKey} not like 'automation:%') or (${table.ownerKind} = 'automation' and ${table.dedupeKey} like 'automation:%')`),
|
|
1119
|
+
check("junior_inbox_items_status_check", sql`(${table.status} = 'open' and ${table.closedAt} is null) or (${table.status} in ('done', 'dismissed') and ${table.closedAt} is not null)`),
|
|
1120
|
+
check("junior_inbox_items_tenant_check", sql`(${table.provider} is null) = (${table.providerTenantId} is null)`),
|
|
1121
|
+
check("junior_inbox_items_visibility_check", sql`${table.visibility} = 'public' or not ${table.assignedToEveryone}`),
|
|
1122
|
+
uniqueIndex("junior_inbox_items_open_dedupe_uidx").on(sql`coalesce(${table.provider}, '')`, sql`coalesce(${table.providerTenantId}, '')`, table.dedupeKey).where(sql`${table.status} = 'open'`),
|
|
1123
|
+
index("junior_inbox_items_status_idx").on(table.status, table.updatedAt, table.id),
|
|
1124
|
+
index("junior_inbox_items_subject_idx").on(table.subjectId, table.status),
|
|
1125
|
+
index("junior_inbox_items_owner_idx").on(table.ownerKind, table.ownerId),
|
|
1126
|
+
index("junior_inbox_items_open_action_owner_idx").on(table.ownerId).where(sql`${table.status} = 'open' and ${table.kind} = 'action'`),
|
|
1127
|
+
index("junior_inbox_items_automation_idx").on(table.automationId, table.status),
|
|
1128
|
+
index("junior_inbox_items_answered_idx").on(table.ownerId, table.closedByUserId, table.closedAt).where(sql`${table.answer} is not null`)
|
|
1114
1129
|
]);
|
|
1115
|
-
/** The assigned Users of
|
|
1116
|
-
const
|
|
1117
|
-
itemId: text("item_id").notNull().references(() =>
|
|
1130
|
+
/** The assigned Users of an Inbox item. Everyone is a flag on the item. */
|
|
1131
|
+
const juniorInboxItemAssignees = pgTable("junior_inbox_item_assignees", {
|
|
1132
|
+
itemId: text("item_id").notNull().references(() => juniorInboxItems.id, { onDelete: "cascade" }),
|
|
1118
1133
|
userId: text("user_id").notNull().references(() => juniorUsers.id, { onDelete: "cascade" })
|
|
1119
|
-
}, (table) => [primaryKey({ columns: [table.itemId, table.userId] }), index("
|
|
1120
|
-
/** The Conversations linked to
|
|
1121
|
-
const
|
|
1122
|
-
itemId: text("item_id").notNull().references(() =>
|
|
1134
|
+
}, (table) => [primaryKey({ columns: [table.itemId, table.userId] }), index("junior_inbox_item_assignees_user_idx").on(table.userId)]);
|
|
1135
|
+
/** The Conversations linked to an Inbox item. */
|
|
1136
|
+
const juniorInboxItemConversations = pgTable("junior_inbox_item_conversations", {
|
|
1137
|
+
itemId: text("item_id").notNull().references(() => juniorInboxItems.id, { onDelete: "cascade" }),
|
|
1123
1138
|
conversationId: text("conversation_id").notNull().references(() => juniorConversations.conversationId, { onDelete: "cascade" })
|
|
1124
|
-
}, (table) => [primaryKey({ columns: [table.itemId, table.conversationId] }), index("
|
|
1139
|
+
}, (table) => [primaryKey({ columns: [table.itemId, table.conversationId] }), index("junior_inbox_item_conversations_conversation_idx").on(table.conversationId)]);
|
|
1125
1140
|
/**
|
|
1126
|
-
* The Slack message that shows
|
|
1141
|
+
* The Slack message that shows an Inbox item in one linked Slack thread.
|
|
1127
1142
|
* Junior updates it in place after each change.
|
|
1128
1143
|
*/
|
|
1129
|
-
const
|
|
1130
|
-
itemId: text("item_id").notNull().references(() =>
|
|
1144
|
+
const juniorInboxItemSlackCards = pgTable("junior_inbox_item_slack_cards", {
|
|
1145
|
+
itemId: text("item_id").notNull().references(() => juniorInboxItems.id, { onDelete: "cascade" }),
|
|
1131
1146
|
conversationId: text("conversation_id").notNull().references(() => juniorConversations.conversationId, { onDelete: "cascade" }),
|
|
1132
1147
|
teamId: text("team_id").notNull(),
|
|
1133
1148
|
channelId: text("channel_id").notNull(),
|
|
@@ -1135,21 +1150,24 @@ const juniorReviewItemSlackCards = pgTable("junior_review_item_slack_cards", {
|
|
|
1135
1150
|
}, (table) => [primaryKey({ columns: [table.itemId, table.conversationId] })]);
|
|
1136
1151
|
// src/db/schema/inbox-snoozes.ts
|
|
1137
1152
|
/**
|
|
1138
|
-
* One person's snooze of one
|
|
1153
|
+
* One person's snooze of one Inbox item. A `snoozed` row hides the item
|
|
1139
1154
|
* from that person's Inbox until one of its triggers fires. `woken` and
|
|
1140
1155
|
* `cancelled` are final. The item's own status says whether it resolved.
|
|
1156
|
+
* A trigger that wakes it records why in `wake_reason`, which only that
|
|
1157
|
+
* person sees, until they open or act on the item.
|
|
1141
1158
|
*/
|
|
1142
1159
|
const juniorInboxSnoozes = pgTable("junior_inbox_snoozes", {
|
|
1143
1160
|
id: text("id").primaryKey(),
|
|
1144
1161
|
userId: text("user_id").notNull().references(() => juniorUsers.id, { onDelete: "cascade" }),
|
|
1145
|
-
|
|
1162
|
+
inboxItemId: text("inbox_item_id").notNull().references(() => juniorInboxItems.id, { onDelete: "cascade" }),
|
|
1146
1163
|
state: text("state").$type().notNull(),
|
|
1164
|
+
wakeReason: jsonb("wake_reason").$type(),
|
|
1147
1165
|
createdAt: timestamptz("created_at").notNull()
|
|
1148
1166
|
}, (table) => [
|
|
1149
1167
|
check("junior_inbox_snoozes_state_check", sql`${table.state} in ('snoozed', 'woken', 'cancelled')`),
|
|
1150
|
-
uniqueIndex("junior_inbox_snoozes_snoozed_uidx").on(table.userId, table.
|
|
1168
|
+
uniqueIndex("junior_inbox_snoozes_snoozed_uidx").on(table.userId, table.inboxItemId).where(sql`${table.state} = 'snoozed'`),
|
|
1151
1169
|
index("junior_inbox_snoozes_settled_idx").on(table.createdAt).where(sql`${table.state} <> 'snoozed'`),
|
|
1152
|
-
index("
|
|
1170
|
+
index("junior_inbox_snoozes_inbox_item_idx").on(table.inboxItemId)
|
|
1153
1171
|
]);
|
|
1154
1172
|
/**
|
|
1155
1173
|
* An Event that ends a snooze. `wake` brings the item back; `resolve`
|
|
@@ -1191,23 +1209,25 @@ const juniorStats = pgTable("junior_stats", {
|
|
|
1191
1209
|
table.name
|
|
1192
1210
|
]
|
|
1193
1211
|
})]);
|
|
1194
|
-
// src/db/schema/
|
|
1212
|
+
// src/db/schema/todos.ts
|
|
1195
1213
|
/**
|
|
1196
|
-
* Gives each
|
|
1197
|
-
*
|
|
1198
|
-
*
|
|
1214
|
+
* Gives each To-do its id and each change its version. One sequence serves
|
|
1215
|
+
* every Conversation, so history that a fork copies from its parent never
|
|
1216
|
+
* shows a version that the fork's own To-dos reuse.
|
|
1199
1217
|
*/
|
|
1200
|
-
const
|
|
1218
|
+
const juniorTodoVersionSeq = pgSequence("junior_todo_version_seq");
|
|
1201
1219
|
/**
|
|
1202
|
-
* One
|
|
1203
|
-
* assignee: a Conversation (the
|
|
1204
|
-
* or a User.
|
|
1205
|
-
* `changed_by_user_id` is set when a person made the latest change
|
|
1206
|
-
* when the
|
|
1207
|
-
*
|
|
1208
|
-
*
|
|
1220
|
+
* One To-do: work that a Conversation has not finished. At most one
|
|
1221
|
+
* assignee: a Conversation (the list's own agent or one of its child agents)
|
|
1222
|
+
* or a User. A To-do without one belongs to the list's own agent.
|
|
1223
|
+
* `changed_by_user_id` is set when a person made the latest change.
|
|
1224
|
+
* `changed_by_conversation_id` is set when the assignee child agent closed
|
|
1225
|
+
* it, or core closed it on that child's result. Both are null when the
|
|
1226
|
+
* list's own agent made the latest change. Both User keys block deleting the User, as
|
|
1227
|
+
* Conversation participants do: setting them null would turn a person's
|
|
1228
|
+
* To-do into the agent's and hide an unseen change from `<todo-delta>`.
|
|
1209
1229
|
*/
|
|
1210
|
-
const
|
|
1230
|
+
const juniorTodos = pgTable("junior_todos", {
|
|
1211
1231
|
conversationId: text("conversation_id").notNull(),
|
|
1212
1232
|
id: bigint("id", { mode: "number" }).notNull(),
|
|
1213
1233
|
title: text("title").notNull(),
|
|
@@ -1217,21 +1237,21 @@ const juniorPlanItems = pgTable("junior_plan_items", {
|
|
|
1217
1237
|
assigneeUserId: text("assignee_user_id").references(() => juniorUsers.id),
|
|
1218
1238
|
version: bigint("version", { mode: "number" }).notNull(),
|
|
1219
1239
|
changedByUserId: text("changed_by_user_id").references(() => juniorUsers.id),
|
|
1240
|
+
changedByConversationId: text("changed_by_conversation_id"),
|
|
1220
1241
|
createdAt: timestamptz("created_at").notNull(),
|
|
1221
1242
|
updatedAt: timestamptz("updated_at").notNull()
|
|
1222
1243
|
}, (table) => [
|
|
1223
1244
|
primaryKey({
|
|
1224
|
-
name: "
|
|
1245
|
+
name: "junior_todos_pk",
|
|
1225
1246
|
columns: [table.conversationId, table.id]
|
|
1226
1247
|
}),
|
|
1227
1248
|
foreignKey({
|
|
1228
|
-
name: "
|
|
1249
|
+
name: "junior_todos_conversation_id_fk",
|
|
1229
1250
|
columns: [table.conversationId],
|
|
1230
1251
|
foreignColumns: [juniorConversations.conversationId]
|
|
1231
1252
|
}).onDelete("cascade"),
|
|
1232
|
-
check("
|
|
1233
|
-
check("
|
|
1234
|
-
uniqueIndex("junior_plan_items_in_progress_uidx").on(table.conversationId, sql`coalesce(${table.assigneeConversationId}, ${table.assigneeUserId}, ${table.conversationId})`).where(sql`${table.status} = 'in_progress'`)
|
|
1253
|
+
check("junior_todos_status_check", sql`${table.status} in ('open', 'in_progress', 'done', 'dropped')`),
|
|
1254
|
+
check("junior_todos_assignee_check", sql`${table.assigneeConversationId} is null or ${table.assigneeUserId} is null`)
|
|
1235
1255
|
]);
|
|
1236
1256
|
// src/db/schema/push-subscriptions.ts
|
|
1237
1257
|
/**
|
|
@@ -1331,11 +1351,11 @@ const juniorSqlSchema = {
|
|
|
1331
1351
|
juniorIdentities,
|
|
1332
1352
|
juniorInboxSnoozes,
|
|
1333
1353
|
juniorInboxSnoozeTriggers,
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1354
|
+
juniorInboxItemAssignees,
|
|
1355
|
+
juniorInboxItemConversations,
|
|
1356
|
+
juniorInboxItemSlackCards,
|
|
1357
|
+
juniorInboxItems,
|
|
1358
|
+
juniorTodos,
|
|
1339
1359
|
juniorPushSubscriptions,
|
|
1340
1360
|
juniorSnapshots,
|
|
1341
1361
|
juniorStats,
|
|
@@ -1837,4 +1857,4 @@ function createJuniorSqlExecutor(args) {
|
|
|
1837
1857
|
statementTimeoutMs
|
|
1838
1858
|
});
|
|
1839
1859
|
}
|
|
1840
|
-
export { MEMORY_SCOPES as $, juniorConversationMetrics as A, juniorAttachments as B, juniorConversationParticipants as C,
|
|
1860
|
+
export { MEMORY_SCOPES as $, juniorConversationMetrics as A, juniorAttachments as B, juniorConversationParticipants as C, juniorConversationEventEmbeddings as D, juniorConversationEventLexemes as E, codeChangeSearchDocument as F, slackPersonSearchDocument as G, juniorConversations as H, codeRepositorySearchDocument as I, juniorMemoryEmbeddings as J, juniorUsers as K, juniorCodeChanges as L, juniorConversationEvents as M, juniorApiTokens as N, juniorConversationEmbeddings as O, juniorConversationAnnotations as P, MEMORY_KINDS as Q, juniorCodeRepositories as R, juniorConversationReadPositions as S, juniorConversationBriefs as T, juniorIdentities as U, juniorMessageAttachments as V, slackPersonPredicate as W, juniorMemorySignals as X, juniorMemoryMemories as Y, MEMORY_EMBEDDING_DIMENSIONS as Z, juniorAutomationRuns as _, juniorWorkspaces as a, guardedCosineDistance as at, juniorAgentBindings as b, juniorTodos as c, juniorArtifacts as ct, juniorInboxSnoozes as d, MEMORY_SOURCE_PLATFORMS as et, juniorInboxItemAssignees as f, juniorAutomations as g, juniorInboxItems as h, juniorWorkspaceRepos as i, embedText as it, isUserInstruction as j, CONVERSATION_METRICS as k, juniorStats as l, juniorInboxItemSlackCards as m, isPostgresErrorCode as n, memoryRuntimeContextSchema as nt, juniorPushSubscriptions as o, parseEmbeddingBatch as ot, juniorInboxItemConversations as p, juniorDestinations as q, juniorSnapshots as r, cosineDistance as rt, juniorTodoVersionSeq as s, refreshEmbeddings as st, createJuniorSqlExecutor as t, MEMORY_SUBJECT_TYPES as tt, juniorInboxSnoozeTriggers as u, juniorAutomationVersions as v, juniorConversationBindings as w, juniorAgentInvocations as x, juniorLocationConfigurations as y, juniorAttachmentUploads as z };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as botConfig } from "./config-
|
|
1
|
+
import { on as startOAuthFlow } from "./credentialed-Cb6E2phL.js";
|
|
2
|
+
import { n as botConfig } from "./config-kXB2Y5tl.js";
|
|
3
3
|
import { t as mapBounded } from "./fan-out-Cod-yEHG.js";
|
|
4
|
-
import {
|
|
5
|
-
import { d as hasRequiredOAuthScope } from "./registry-
|
|
6
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
7
|
-
import { h as deleteMcpStoredOAuthCredentials, m as deleteMcpServerSessionId, p as deleteMcpAuthSessionsForUserProvider } from "./service-account-
|
|
4
|
+
import { nn as deleteProviderIdentityForUser, s as getSqlExecutor, tn as deleteProviderIdentityForSlackUser } from "./db-LAyyX8tk.js";
|
|
5
|
+
import { d as hasRequiredOAuthScope } from "./registry-CZOzddwu.js";
|
|
6
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-D7xapBAX.js";
|
|
7
|
+
import { h as deleteMcpStoredOAuthCredentials, m as deleteMcpServerSessionId, p as deleteMcpAuthSessionsForUserProvider } from "./service-account-Ts4ulcrV.js";
|
|
8
8
|
import { randomBytes } from "node:crypto";
|
|
9
9
|
// src/handlers/oauth-html.ts
|
|
10
10
|
/** Build pre-escaped callback HTML with the shared response security policy. */
|