@sentry/junior 0.311.0 → 0.313.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-B1wujchl.js → adapter-CYAvJzZS.js} +1 -1
- package/dist/{adapter-context-G2M0y6rP.js → adapter-context-CVsHoVSf.js} +2 -2
- package/dist/{admin-DCiBhUT1.js → admin-Cyhb4TwZ.js} +1 -1
- package/dist/{agent-runner-BVHPUIc8.js → agent-runner-B5y9MsT-.js} +3487 -3493
- 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 +294 -311
- package/dist/{app-Cw5Vy6H6.d.ts → app-DA8-hCMj.d.ts} +2 -9
- package/dist/app.d.ts +1 -1
- package/dist/app.js +336 -604
- package/dist/{background-compaction-queue-CJDnWVOJ.js → background-compaction-queue-iZXadLV3.js} +60 -85
- package/dist/{catalog-runtime-DMY3VV-D.js → catalog-runtime-kkE3hvCX.js} +1 -1
- package/dist/channel-access-mt7K6dPh.js +221 -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-CWbwKj0j.js} +59 -27
- package/dist/{continue-in-slack-DNXSC9So.js → continue-in-slack-CxyFzdlF.js} +7 -8
- package/dist/{conversation-feed-DkinDu5o.js → conversation-feed-BEXLD3Me.js} +86 -21
- package/dist/{conversation-privacy-DxttrKb9.js → conversation-privacy-BrMiDN61.js} +1 -1
- package/dist/{conversation-turn-DWw7Xhdr.js → conversation-turn-B35eu0uz.js} +78 -56
- package/dist/{credential-sync-Bk8wGb8Y.js → credential-sync-DWTOEQrm.js} +15 -15
- package/dist/{projection-Cns7XwWa.js → credentialed-Dyv8b-lu.js} +16306 -20732
- package/dist/{db-7ETESH44.d.ts → db-DYGcXYl3.d.ts} +11 -6
- package/dist/{db-DTxzH7u5.js → db-PwSRzWWn.js} +181 -100
- package/dist/{executor-DqTiYj9S.js → executor-CgWyWfYz.js} +117 -99
- package/dist/{html-B9Sl4Axb.js → html-DidUcRhI.js} +6 -6
- package/dist/ingest-B0AggUEC.js +7931 -0
- package/dist/{install-Sg4ePfLl.js → install-2urLLXNt.js} +2 -2
- package/dist/instrumentation.js +3 -3
- package/dist/{lineage-BHAMpNKr.js → lineage-BXplQAVH.js} +2 -2
- package/dist/{stop-CYsfc0Ed.js → list-DyIyReSV.js} +709 -475
- package/dist/{logging-FjclQsXu.js → logging-DNt-qOIO.js} +1 -1
- package/dist/{schedule-BLJ476XQ.js → media-B0pZJ0bG.js} +1058 -11
- package/dist/{message-CJ7_RL50.js → message-Z5YKC-Af.js} +35 -28
- package/dist/{model-input-CMLh4Cwq.js → model-input-BhPJYdSV.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-ByvDdcdY.js} +2 -2
- package/dist/{oauth-relay-Bu9kkaQu.js → oauth-relay-D-kK0yoN.js} +1 -1
- package/dist/{registry-BPwuOP2O.js → registry-POH4bZC4.js} +1 -1
- package/dist/reporting-window-C4dbzDiR.js +124 -0
- package/dist/request-deadline-BUiRYQYj.js +24 -0
- package/dist/{resolve-BK29bBry.js → resolve-CWtBNSKP.js} +3 -3
- package/dist/{runner-BcAE-cJm.js → runner-CsZ_VRxp.js} +14 -16
- package/dist/{sandbox-egress-signals-C-q0go5b.js → sandbox-egress-signals-FbCk1FkN.js} +1 -1
- package/dist/{schema-DYcJeV7d.d.ts → schema-DBf18QPS.d.ts} +2773 -3630
- package/dist/{schema-BLgSZXcL.js → schema-DojR2uCL.js} +106 -121
- package/dist/{service-account-iJoCtkHR.js → service-account-CDYb9hfX.js} +3 -3
- package/dist/{service-account-gN0zqf0S.js → service-account-o15pZWcJ.js} +5 -5
- package/dist/{skills-BoZ80epJ.js → skills-B0jP4whm.js} +2 -2
- package/dist/{slack-conversation-unfurl-CogYrITA.js → slack-conversation-unfurl-D26t9kBC.js} +9 -9
- package/dist/{spawn-Dk92r7mX.js → spawn-BjljgExZ.js} +14 -32
- package/dist/start-conversation-DbVujrwO.js +755 -0
- package/dist/{state-DH3Cmgp3.js → state-BTawTCme.js} +4 -4
- package/dist/statuses-BKwqCPhj.js +69 -0
- package/dist/store-CjXrp-Up.js +492 -0
- package/dist/task-queue-Cwlatjz3.js +90 -0
- package/dist/task-runner--Ke8KSMf.js +1432 -0
- package/dist/{thread-context-BW2BsQbH.js → thread-context-B8exINEe.js} +6 -7
- package/dist/turn-membership-DTR3SaKD.js +5859 -0
- package/dist/{validation-DrJd0nnq.js → validation-Ce0qbMlT.js} +1 -1
- package/dist/{task-queue-C_zldF5J.js → vercel-queue-q4z8w5QO.js} +93 -172
- package/dist/{version-CNKZ8owc.js → version-DFh4n9nr.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{warmup-BWdHew2H.js → warmup-D5hzqTcp.js} +4853 -13605
- package/dist/web-message-id-C6P83ans.js +10 -0
- package/dist/{worker-t9qpu_Zx.js → worker-CDg9Lbpg.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/0158_keep_legacy_archive_columns.sql +5 -0
- package/migrations/0159_conversation_embeddings_fk_validate.sql +5 -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/0158_snapshot.json +6515 -0
- package/migrations/meta/0159_snapshot.json +6515 -0
- package/migrations/meta/_journal.json +120 -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
package/dist/{background-compaction-queue-CJDnWVOJ.js → background-compaction-queue-iZXadLV3.js}
RENAMED
|
@@ -1,85 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { r as getChatConfig } from "./config-CWbwKj0j.js";
|
|
2
|
+
import { h as logWarn } from "./logging-DNt-qOIO.js";
|
|
3
|
+
import { c as QUEUE_SIGNATURE_MAX_AGE_MS, d as getQueueProvider, l as signQueueMessage, u as verifyQueueMessage } from "./vercel-queue-q4z8w5QO.js";
|
|
4
|
+
import { n as runWithNewTurnRequestDeadline, r as runWithTurnRequestDeadline } from "./request-deadline-BUiRYQYj.js";
|
|
4
5
|
import * as z from "zod";
|
|
5
6
|
import { createHash } from "node:crypto";
|
|
6
|
-
/** Validate the v2 conversation work hint sent through Vercel Queue. */
|
|
7
|
-
const conversationQueueMessageSchema = z.object({
|
|
8
|
-
schemaVersion: z.literal(2),
|
|
9
|
-
conversationId: z.string().trim().min(1)
|
|
10
|
-
}).strict();
|
|
11
|
-
var ConversationQueueMessageRejectedError = class extends Error {
|
|
12
|
-
conversationId;
|
|
13
|
-
reason;
|
|
14
|
-
constructor(reason, message, options = {}) {
|
|
15
|
-
super(message);
|
|
16
|
-
this.name = "ConversationQueueMessageRejectedError";
|
|
17
|
-
this.reason = reason;
|
|
18
|
-
this.conversationId = options.conversationId;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
/** Return whether an error means the queue message was permanently rejected. */
|
|
22
|
-
function isConversationQueueMessageRejectedError(error) {
|
|
23
|
-
return error instanceof ConversationQueueMessageRejectedError;
|
|
24
|
-
}
|
|
25
|
-
/** Build the idempotency key of a wake that one worker event sends. */
|
|
26
|
-
function nudgeIdempotencyKey(reason, conversationId, nowMs) {
|
|
27
|
-
return `${reason}:${conversationId}:${nowMs}`;
|
|
28
|
-
}
|
|
29
|
-
// src/chat/task-execution/queue-signing.ts
|
|
30
|
-
const conversationQueueSign = {
|
|
31
|
-
context: "junior.conversation_work_queue.v2",
|
|
32
|
-
schema: conversationQueueMessageSchema,
|
|
33
|
-
separator: ":",
|
|
34
|
-
signatureVersion: "v2",
|
|
35
|
-
parts: (message) => [message.conversationId]
|
|
36
|
-
};
|
|
37
|
-
const CONVERSATION_WORK_QUEUE_SIGNATURE_MAX_SKEW_MS = QUEUE_SIGNATURE_MAX_AGE_MS;
|
|
38
|
-
/** Sign a conversation queue payload before it crosses the public callback route. */
|
|
39
|
-
function signConversationQueueMessage(message, nowMs = Date.now()) {
|
|
40
|
-
return signQueueMessage(conversationQueueSign, message, nowMs);
|
|
41
|
-
}
|
|
42
|
-
/** Explain whether a queue payload is verified, rejected, or unavailable. */
|
|
43
|
-
function verifyConversationQueueMessage(value, nowMs = Date.now()) {
|
|
44
|
-
return verifyQueueMessage(conversationQueueSign, value, nowMs);
|
|
45
|
-
}
|
|
46
|
-
const CONVERSATION_WORK_QUEUE_RETENTION_SECONDS = CONVERSATION_WORK_QUEUE_SIGNATURE_MAX_SKEW_MS / 1e3;
|
|
47
|
-
let defaultQueue;
|
|
48
|
-
/** Resolve the Vercel Queue topic used for conversation wake-up nudges. */
|
|
49
|
-
function resolveConversationWorkQueueTopic(options = {}) {
|
|
50
|
-
return options.topic?.trim() || process.env["JUNIOR_CONVERSATION_WORK_QUEUE_TOPIC"]?.trim() || "junior_conversation_work";
|
|
51
|
-
}
|
|
52
|
-
function toDelaySeconds(options) {
|
|
53
|
-
if (!options?.delayMs || options.delayMs <= 0) return;
|
|
54
|
-
return Math.ceil(options.delayMs / 1e3);
|
|
55
|
-
}
|
|
56
|
-
/** Create the Vercel Queue implementation for conversation wake-up nudges. */
|
|
57
|
-
function createVercelConversationWorkQueue(options = {}) {
|
|
58
|
-
const topic = resolveConversationWorkQueueTopic(options);
|
|
59
|
-
const client = options.client ?? getQueueProvider();
|
|
60
|
-
return { async send(message, sendOptions) {
|
|
61
|
-
const payload = signConversationQueueMessage(message);
|
|
62
|
-
return await withSpan("conversation.work.publish", "queue.publish", { conversationId: message.conversationId }, async (setSpanAttributes) => {
|
|
63
|
-
const result = await client.send(topic, payload, {
|
|
64
|
-
idempotencyKey: sendOptions?.idempotencyKey,
|
|
65
|
-
delaySeconds: toDelaySeconds(sendOptions),
|
|
66
|
-
retentionSeconds: options.retentionSeconds ?? CONVERSATION_WORK_QUEUE_RETENTION_SECONDS
|
|
67
|
-
});
|
|
68
|
-
if (!result.messageId) return {};
|
|
69
|
-
setSpanAttributes({ "messaging.message.id": result.messageId });
|
|
70
|
-
return { messageId: result.messageId };
|
|
71
|
-
}, {
|
|
72
|
-
"messaging.destination.name": topic,
|
|
73
|
-
"messaging.message.body.size": Buffer.byteLength(JSON.stringify(payload)),
|
|
74
|
-
"messaging.system": getQueueProvider().messagingSystem
|
|
75
|
-
});
|
|
76
|
-
} };
|
|
77
|
-
}
|
|
78
|
-
/** Return the default production conversation work queue. */
|
|
79
|
-
function getVercelConversationWorkQueue() {
|
|
80
|
-
defaultQueue ??= createVercelConversationWorkQueue();
|
|
81
|
-
return defaultQueue;
|
|
82
|
-
}
|
|
83
7
|
// src/chat/sandbox/snapshot/job-queue.ts
|
|
84
8
|
/** Send Workspace snapshot build messages. */
|
|
85
9
|
const SIGNATURE_CONTEXT = "junior.workspace_snapshot_queue.v1";
|
|
@@ -118,6 +42,56 @@ async function sendWorkspaceSnapshotJob(message) {
|
|
|
118
42
|
async function sendNextWorkspaceSnapshotJob(message) {
|
|
119
43
|
await send(message);
|
|
120
44
|
}
|
|
45
|
+
// src/chat/queue/callback.ts
|
|
46
|
+
/** Shared queue callback wiring for signed messages. */
|
|
47
|
+
/** Build the HTTP callback and local-dev consumer for one signed queue. */
|
|
48
|
+
function queueCallback(options) {
|
|
49
|
+
const consume = async (message, metadata) => {
|
|
50
|
+
if (options.skip?.(metadata)) return;
|
|
51
|
+
try {
|
|
52
|
+
await runWithTurnRequestDeadline(() => options.run(message, metadata));
|
|
53
|
+
} catch (error) {
|
|
54
|
+
const reason = options.permanentError?.(error);
|
|
55
|
+
if (!reason) throw error;
|
|
56
|
+
options.onRejected(reason, metadata, error);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const handler = async (value, metadata) => {
|
|
60
|
+
if (options.skip?.(metadata)) return;
|
|
61
|
+
const checked = options.verify(value);
|
|
62
|
+
if (checked.status === "rejected") {
|
|
63
|
+
options.onRejected(checked.reason, metadata);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (checked.status === "unavailable") throw new Error(`Queue message verification unavailable: ${checked.reason}`);
|
|
67
|
+
await runWithNewTurnRequestDeadline(() => consume(checked.message, metadata));
|
|
68
|
+
};
|
|
69
|
+
const retry = (error, metadata) => {
|
|
70
|
+
const reason = options.permanentError?.(error);
|
|
71
|
+
if (reason) {
|
|
72
|
+
options.onRejected(reason, metadata, error);
|
|
73
|
+
return { acknowledge: true };
|
|
74
|
+
}
|
|
75
|
+
if (options.maxDeliveries !== null && metadata.deliveryCount >= options.maxDeliveries) return { acknowledge: true };
|
|
76
|
+
};
|
|
77
|
+
const consumer = {
|
|
78
|
+
consumerGroup: options.consumerGroup,
|
|
79
|
+
handler,
|
|
80
|
+
retry,
|
|
81
|
+
topic: options.topic,
|
|
82
|
+
visibilityTimeoutSeconds: options.visibilityTimeoutSeconds
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
/** Run a message that an in-process queue already trusts. */
|
|
86
|
+
consume,
|
|
87
|
+
consumer,
|
|
88
|
+
create: () => getQueueProvider().createCallback(consumer),
|
|
89
|
+
registerDev: () => {
|
|
90
|
+
if (process.env["NODE_ENV"] !== "development") return;
|
|
91
|
+
return getQueueProvider().registerDevConsumer?.(consumer);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
121
95
|
// src/chat/cache-warming/queue.ts
|
|
122
96
|
/** Send and receive delayed cache warmup messages. */
|
|
123
97
|
/** Deploy topic name. Keep stable for Vercel queue wiring. */
|
|
@@ -134,14 +108,15 @@ const cacheWarmupSign = {
|
|
|
134
108
|
}).strict(), z.object({
|
|
135
109
|
kind: z.literal("horizon"),
|
|
136
110
|
conversationId: z.string().min(1),
|
|
137
|
-
generation: z.string().min(1)
|
|
111
|
+
generation: z.string().min(1),
|
|
112
|
+
step: z.number().int().min(2).optional()
|
|
138
113
|
}).strict()]),
|
|
139
114
|
signatureVersion: "v1",
|
|
140
115
|
parts: (message) => [
|
|
141
116
|
message.kind,
|
|
142
117
|
message.conversationId,
|
|
143
118
|
message.generation,
|
|
144
|
-
message.kind === "warmup" ? String(message.cycle) : "",
|
|
119
|
+
message.kind === "warmup" ? String(message.cycle) : message.step ? String(message.step) : "",
|
|
145
120
|
message.kind === "warmup" ? String(message.cacheExpiresAtMs) : ""
|
|
146
121
|
]
|
|
147
122
|
};
|
|
@@ -150,7 +125,7 @@ async function sendCacheWarmup(message, delayMs) {
|
|
|
150
125
|
await getQueueProvider().send(CACHE_WARMUP_QUEUE_TOPIC, signQueueMessage(cacheWarmupSign, message), {
|
|
151
126
|
delaySeconds: Math.max(0, Math.floor(delayMs / 1e3)),
|
|
152
127
|
retentionSeconds: message.kind === "warmup" ? Math.min(QUEUE_SIGNATURE_MAX_AGE_MS / 1e3, Math.ceil(Math.max(0, delayMs) / 1e3) + 120) : QUEUE_SIGNATURE_MAX_AGE_MS / 1e3,
|
|
153
|
-
idempotencyKey: `cache-warmup_${message.generation}_${message.kind === "warmup" ? message.cycle : message.kind}`
|
|
128
|
+
idempotencyKey: `cache-warmup_${message.generation}_${message.kind === "warmup" ? message.cycle : `${message.kind}${message.step ? `_${message.step}` : ""}`}`
|
|
154
129
|
});
|
|
155
130
|
}
|
|
156
131
|
function logCacheWarmupRejected(reason, metadata, error) {
|
|
@@ -169,7 +144,7 @@ function cacheWarmupCallback() {
|
|
|
169
144
|
maxDeliveries: 1,
|
|
170
145
|
onRejected: logCacheWarmupRejected,
|
|
171
146
|
run: async (message) => {
|
|
172
|
-
const { runCacheWarmup } = await import("./warmup-
|
|
147
|
+
const { runCacheWarmup } = await import("./warmup-D5hzqTcp.js").then((n) => n.c);
|
|
173
148
|
await runCacheWarmup(message);
|
|
174
149
|
},
|
|
175
150
|
skip: () => !getChatConfig().cacheWarmingEnabled,
|
|
@@ -228,4 +203,4 @@ const vercelBackgroundCompactionQueue = { send: async (message) => {
|
|
|
228
203
|
retentionSeconds: QUEUE_SIGNATURE_MAX_AGE_MS / 1e3
|
|
229
204
|
});
|
|
230
205
|
} };
|
|
231
|
-
export {
|
|
206
|
+
export { CACHE_WARMUP_QUEUE_TOPIC as a, registerVercelCacheWarmupDevConsumer as c, WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC as d, sendNextWorkspaceSnapshotJob as f, verifyBackgroundCompactionMessage as i, sendCacheWarmup as l, verifyWorkspaceSnapshotJobMessage as m, backgroundCompactionId as n, cacheWarmupQueueConsumer as o, sendWorkspaceSnapshotJob as p, vercelBackgroundCompactionQueue as r, createVercelCacheWarmupCallback as s, BACKGROUND_COMPACTION_QUEUE_TOPIC as t, queueCallback as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { t as createPluginCatalogRuntime } from "./registry-
|
|
2
|
+
import { t as createPluginCatalogRuntime } from "./registry-POH4bZC4.js";
|
|
3
3
|
// src/chat/plugins/catalog-runtime.ts
|
|
4
4
|
var catalog_runtime_exports = /* @__PURE__ */ __exportAll({ pluginCatalogRuntime: () => pluginCatalogRuntime });
|
|
5
5
|
const pluginCatalogRuntime = createPluginCatalogRuntime();
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { a as getConversationStore } from "./db-PwSRzWWn.js";
|
|
2
|
+
import { Ao as getSlackClient, Eo as SlackActionError, Ro as withSlackRetries } from "./credentialed-Dyv8b-lu.js";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
// src/chat/slack/channel.ts
|
|
5
|
+
const replySubtypeSchema = z.object({ subtype: z.string().optional() });
|
|
6
|
+
/** List channel history using Slack-native, pre-validated timestamp bounds. */
|
|
7
|
+
async function listChannelMessages(input) {
|
|
8
|
+
const client = getSlackClient();
|
|
9
|
+
const channelId = input.channelId;
|
|
10
|
+
const targetLimit = Math.max(1, Math.min(input.limit, 1e3));
|
|
11
|
+
const maxPages = Math.max(1, Math.min(input.maxPages ?? 5, 10));
|
|
12
|
+
const messages = [];
|
|
13
|
+
let cursor = input.cursor;
|
|
14
|
+
let pages = 0;
|
|
15
|
+
while (messages.length < targetLimit && pages < maxPages) {
|
|
16
|
+
pages += 1;
|
|
17
|
+
const pageLimit = Math.max(1, Math.min(200, targetLimit - messages.length));
|
|
18
|
+
const response = await withSlackRetries(() => client.conversations.history({
|
|
19
|
+
channel: channelId,
|
|
20
|
+
limit: pageLimit,
|
|
21
|
+
cursor,
|
|
22
|
+
oldest: input.oldest,
|
|
23
|
+
latest: input.latest,
|
|
24
|
+
inclusive: input.inclusive
|
|
25
|
+
}), 3, { action: "conversations.history" });
|
|
26
|
+
const batch = response.messages ?? [];
|
|
27
|
+
messages.push(...batch);
|
|
28
|
+
cursor = response.response_metadata?.next_cursor || void 0;
|
|
29
|
+
if (!cursor) break;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
messages: messages.slice(0, targetLimit),
|
|
33
|
+
nextCursor: cursor
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** Read replies from a Slack thread identified by a validated native thread timestamp. */
|
|
37
|
+
async function listThreadReplies(input) {
|
|
38
|
+
const client = getSlackClient();
|
|
39
|
+
const channelId = input.channelId;
|
|
40
|
+
const targetLimit = Math.max(1, Math.min(input.limit ?? 1e3, 1e3));
|
|
41
|
+
const maxPages = Math.max(1, Math.min(input.maxPages ?? 10, 10));
|
|
42
|
+
const pendingTargets = new Set((input.targetMessageTs ?? []).filter((value) => typeof value === "string" && value.length > 0));
|
|
43
|
+
const hasTargetMessages = pendingTargets.size > 0;
|
|
44
|
+
const replies = [];
|
|
45
|
+
let cursor;
|
|
46
|
+
let pages = 0;
|
|
47
|
+
while (replies.length < targetLimit && pages < maxPages) {
|
|
48
|
+
pages += 1;
|
|
49
|
+
const pageLimit = Math.max(1, Math.min(200, targetLimit - replies.length));
|
|
50
|
+
const response = await withSlackRetries(() => client.conversations.replies({
|
|
51
|
+
channel: channelId,
|
|
52
|
+
ts: input.threadTs,
|
|
53
|
+
limit: pageLimit,
|
|
54
|
+
cursor
|
|
55
|
+
}), 3, { action: "conversations.replies" });
|
|
56
|
+
const batch = response.messages ?? [];
|
|
57
|
+
replies.push(...batch.map((reply) => ({
|
|
58
|
+
...reply,
|
|
59
|
+
...replySubtypeSchema.parse(reply)
|
|
60
|
+
})));
|
|
61
|
+
for (const reply of batch) if (typeof reply.ts === "string" && pendingTargets.size > 0) pendingTargets.delete(reply.ts);
|
|
62
|
+
cursor = response.response_metadata?.next_cursor || void 0;
|
|
63
|
+
if (!cursor || hasTargetMessages && pendingTargets.size === 0) break;
|
|
64
|
+
}
|
|
65
|
+
return replies.slice(0, targetLimit);
|
|
66
|
+
}
|
|
67
|
+
/** Return whether anyone in the workspace can read the conversation. */
|
|
68
|
+
function isPublicSlackChannel(info) {
|
|
69
|
+
return info.isChannel && !info.isPrivate && !info.isIm && !info.isMpim;
|
|
70
|
+
}
|
|
71
|
+
/** Load conversation metadata used for cross-channel read access checks. */
|
|
72
|
+
async function getConversationInfo(channelId) {
|
|
73
|
+
const client = getSlackClient();
|
|
74
|
+
const channel = (await withSlackRetries(() => client.conversations.info({ channel: channelId }), 3, {
|
|
75
|
+
action: "conversations.info",
|
|
76
|
+
idempotent: true
|
|
77
|
+
})).channel;
|
|
78
|
+
if (!channel || typeof channel !== "object") throw new Error(`Slack conversations.info returned no channel for ${channelId}`);
|
|
79
|
+
return {
|
|
80
|
+
id: channelId,
|
|
81
|
+
...typeof channel.name === "string" && channel.name ? { name: channel.name } : void 0,
|
|
82
|
+
...channel.topic?.value ? { topic: channel.topic.value } : void 0,
|
|
83
|
+
...channel.purpose?.value ? { description: channel.purpose.value } : void 0,
|
|
84
|
+
isChannel: channel.is_channel === true,
|
|
85
|
+
isPrivate: channel.is_private === true,
|
|
86
|
+
isIm: channel.is_im === true,
|
|
87
|
+
isMpim: channel.is_mpim === true,
|
|
88
|
+
...typeof channel.is_member === "boolean" ? { isMember: channel.is_member } : void 0
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/** Join a public channel so the bot can read history and threads there. */
|
|
92
|
+
async function joinPublicChannel(channelId) {
|
|
93
|
+
const client = getSlackClient();
|
|
94
|
+
await withSlackRetries(() => client.conversations.join({ channel: channelId }), 3, {
|
|
95
|
+
action: "conversations.join",
|
|
96
|
+
idempotent: true
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
const MAX_MEMBER_PAGES = 5;
|
|
100
|
+
/** Return whether a Slack user is a member of a channel, DM, or group DM. */
|
|
101
|
+
async function isConversationMember(channelId, userId) {
|
|
102
|
+
const client = getSlackClient();
|
|
103
|
+
let cursor;
|
|
104
|
+
for (let page = 0; page < MAX_MEMBER_PAGES; page += 1) {
|
|
105
|
+
const response = await withSlackRetries(() => client.conversations.members({
|
|
106
|
+
channel: channelId,
|
|
107
|
+
cursor,
|
|
108
|
+
limit: 1e3
|
|
109
|
+
}), 3, {
|
|
110
|
+
action: "conversations.members",
|
|
111
|
+
idempotent: true
|
|
112
|
+
});
|
|
113
|
+
if (response.members?.includes(userId)) return true;
|
|
114
|
+
cursor = response.response_metadata?.next_cursor || void 0;
|
|
115
|
+
if (!cursor) return false;
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
/** Read one message by its timestamp. A thread reply needs its thread. */
|
|
120
|
+
async function getChannelMessage(input) {
|
|
121
|
+
const client = getSlackClient();
|
|
122
|
+
return (await withSlackRetries(() => client.conversations.replies({
|
|
123
|
+
channel: input.channelId,
|
|
124
|
+
ts: input.threadTs ?? input.messageTs,
|
|
125
|
+
oldest: input.messageTs,
|
|
126
|
+
latest: input.messageTs,
|
|
127
|
+
inclusive: true,
|
|
128
|
+
limit: 2
|
|
129
|
+
}), 3, {
|
|
130
|
+
action: "conversations.replies",
|
|
131
|
+
idempotent: true
|
|
132
|
+
})).messages?.find((message) => message.ts === input.messageTs);
|
|
133
|
+
}
|
|
134
|
+
// src/chat/slack/tool-support/channel-access.ts
|
|
135
|
+
const DENIED_PRIVATE = "Cannot read this Slack conversation because it is private. Only the current conversation or public channels are readable.";
|
|
136
|
+
const DENIED_NOT_FOUND = "Cannot read this Slack conversation because the channel was not found or the bot cannot see it.";
|
|
137
|
+
const DENIED_NOT_IN_CHANNEL = "Cannot read this Slack conversation because the bot is not in the channel.";
|
|
138
|
+
const DENIED_MISSING_SCOPE = "Cannot verify Slack channel access because this installation is missing channel read scopes.";
|
|
139
|
+
function deny(reason, error) {
|
|
140
|
+
return {
|
|
141
|
+
allowed: false,
|
|
142
|
+
reason,
|
|
143
|
+
error
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Decide whether the model may read Slack content from a target channel.
|
|
148
|
+
*
|
|
149
|
+
* The current conversation is always readable. Any other channel first checks
|
|
150
|
+
* persisted visibility in the same workspace. Cross-channel reads require live
|
|
151
|
+
* `conversations.info` proof that the destination is public. Stale persisted
|
|
152
|
+
* public rows are not enough, so a channel that later becomes private fails
|
|
153
|
+
* closed. Channel-id prefixes alone cannot prove a channel public.
|
|
154
|
+
*/
|
|
155
|
+
async function checkSlackChannelReadAccess(args) {
|
|
156
|
+
if (args.currentChannelIds.filter((channelId) => Boolean(channelId)).includes(args.targetChannelId)) return {
|
|
157
|
+
allowed: true,
|
|
158
|
+
isMember: true
|
|
159
|
+
};
|
|
160
|
+
if (await getConversationStore().getDestinationVisibility({
|
|
161
|
+
provider: "slack",
|
|
162
|
+
providerTenantId: args.teamId,
|
|
163
|
+
providerDestinationId: args.targetChannelId
|
|
164
|
+
}) === "private") return deny("private", DENIED_PRIVATE);
|
|
165
|
+
try {
|
|
166
|
+
const info = await getConversationInfo(args.targetChannelId);
|
|
167
|
+
if (!isPublicSlackChannel(info)) return deny("private", DENIED_PRIVATE);
|
|
168
|
+
return {
|
|
169
|
+
allowed: true,
|
|
170
|
+
isPublic: true,
|
|
171
|
+
...info.name ? { channelName: info.name } : void 0,
|
|
172
|
+
...typeof info.isMember === "boolean" ? { isMember: info.isMember } : void 0
|
|
173
|
+
};
|
|
174
|
+
} catch (error) {
|
|
175
|
+
if (error instanceof SlackActionError) {
|
|
176
|
+
if (error.code === "not_found") return deny("not_found", DENIED_NOT_FOUND);
|
|
177
|
+
if (error.code === "not_in_channel") return deny("not_in_channel", DENIED_NOT_IN_CHANNEL);
|
|
178
|
+
if (error.code === "missing_scope") return deny("missing_scope", DENIED_MISSING_SCOPE);
|
|
179
|
+
}
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Join one public channel when a read failed because the bot is not a member.
|
|
185
|
+
*
|
|
186
|
+
* Callers should try the read first, then use this helper on `not_in_channel`.
|
|
187
|
+
*/
|
|
188
|
+
async function joinPublicChannelForRead(args) {
|
|
189
|
+
try {
|
|
190
|
+
await joinPublicChannel(args.targetChannelId);
|
|
191
|
+
return {
|
|
192
|
+
ok: true,
|
|
193
|
+
...args.channelName ? { channelName: args.channelName } : void 0
|
|
194
|
+
};
|
|
195
|
+
} catch (error) {
|
|
196
|
+
if (error instanceof SlackActionError) {
|
|
197
|
+
if (error.code === "missing_scope") return {
|
|
198
|
+
ok: false,
|
|
199
|
+
reason: "missing_scope",
|
|
200
|
+
error: "Cannot join this public Slack channel because this installation is missing the `channels:join` scope."
|
|
201
|
+
};
|
|
202
|
+
if (error.code === "not_found") return {
|
|
203
|
+
ok: false,
|
|
204
|
+
reason: "not_found",
|
|
205
|
+
error: DENIED_NOT_FOUND
|
|
206
|
+
};
|
|
207
|
+
if (error.apiError === "method_not_supported_for_channel_type" || error.apiError === "is_archived" || error.apiError === "cant_invite_self") return {
|
|
208
|
+
ok: false,
|
|
209
|
+
reason: "private",
|
|
210
|
+
error: DENIED_PRIVATE
|
|
211
|
+
};
|
|
212
|
+
return {
|
|
213
|
+
ok: false,
|
|
214
|
+
reason: "not_in_channel",
|
|
215
|
+
error: "Could not join this public Slack channel. Ask an admin to add the bot, then retry."
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
throw error;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
export { isConversationMember as a, listChannelMessages as c, getConversationInfo as i, listThreadReplies as l, joinPublicChannelForRead as n, isPublicSlackChannel as o, getChannelMessage as r, joinPublicChannel as s, checkSlackChannelReadAccess as t };
|
package/dist/cli/chat.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
|
|
2
|
-
import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-
|
|
2
|
+
import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-B5y9MsT-.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
5
|
import { stderr, stdin, stdout } from "node:process";
|
|
@@ -99,10 +99,10 @@ async function loadLocalPluginSet() {
|
|
|
99
99
|
async function configureLocalChatPlugins(pluginSet) {
|
|
100
100
|
const [pluginsModule, agentHooksModule, catalogRuntimeModule, validationModule, databaseModule] = await Promise.all([
|
|
101
101
|
import("../plugins-Bkk0XRo2.js").then((n) => n.o),
|
|
102
|
-
import("../
|
|
103
|
-
import("../catalog-runtime-
|
|
104
|
-
import("../validation-
|
|
105
|
-
import("../db-
|
|
102
|
+
import("../credentialed-Dyv8b-lu.js").then((n) => n.a),
|
|
103
|
+
import("../catalog-runtime-kkE3hvCX.js").then((n) => n.t),
|
|
104
|
+
import("../validation-Ce0qbMlT.js").then((n) => n.r),
|
|
105
|
+
import("../db-PwSRzWWn.js").then((n) => n.n)
|
|
106
106
|
]);
|
|
107
107
|
const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
|
|
108
108
|
const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
|
|
@@ -152,20 +152,19 @@ function localDevServerUrl() {
|
|
|
152
152
|
async function prepareLocalChatRun(io, pluginSet) {
|
|
153
153
|
defaultStateAdapterForLocalChat();
|
|
154
154
|
await configureLocalChatPlugins(pluginSet);
|
|
155
|
-
const {
|
|
156
|
-
setBriefsConfig({ enabled: true });
|
|
155
|
+
const { setEventEmbeddingsConfig } = await import("../credentialed-Dyv8b-lu.js").then((n) => n.U);
|
|
157
156
|
setEventEmbeddingsConfig({ enabled: true });
|
|
158
|
-
const { runLocalAgentTurn } = await import("../runner-
|
|
159
|
-
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-
|
|
160
|
-
const { createLocalOAuthState } = await import("../oauth-relay-
|
|
161
|
-
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-
|
|
162
|
-
const { bindSpawnAgent } = await import("../spawn-
|
|
163
|
-
const { bindMessageAgent } = await import("../message-
|
|
164
|
-
const { createChildConversationWorker, createDeliverToParent } = await import("../
|
|
165
|
-
const { createConversationTurnWorker } = await import("../conversation-turn-
|
|
166
|
-
const {
|
|
157
|
+
const { runLocalAgentTurn } = await import("../runner-CsZ_VRxp.js");
|
|
158
|
+
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-ByvDdcdY.js");
|
|
159
|
+
const { createLocalOAuthState } = await import("../oauth-relay-D-kK0yoN.js").then((n) => n.t);
|
|
160
|
+
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-FbCk1FkN.js");
|
|
161
|
+
const { bindSpawnAgent } = await import("../spawn-BjljgExZ.js").then((n) => n.n);
|
|
162
|
+
const { bindMessageAgent } = await import("../message-Z5YKC-Af.js").then((n) => n.n);
|
|
163
|
+
const { createChildConversationWorker, createDeliverToParent } = await import("../ingest-B0AggUEC.js").then((n) => n.B);
|
|
164
|
+
const { createConversationTurnWorker } = await import("../conversation-turn-B35eu0uz.js").then((n) => n.t);
|
|
165
|
+
const { resumeForPersonInput } = await import("../ingest-B0AggUEC.js").then((n) => n.Rt);
|
|
167
166
|
const { createLocalConversationWork } = await import("../conversation-work-BaT_T6EB.js");
|
|
168
|
-
const { processConversationWork } = await import("../worker-
|
|
167
|
+
const { processConversationWork } = await import("../worker-CDg9Lbpg.js").then((n) => n.n);
|
|
169
168
|
let agentRunner;
|
|
170
169
|
const localConversationWork = createLocalConversationWork(async (message) => {
|
|
171
170
|
if (!agentRunner) throw new Error("Local agent runner is not ready");
|
|
@@ -176,8 +175,8 @@ async function prepareLocalChatRun(io, pluginSet) {
|
|
|
176
175
|
await processConversationWork(message, {
|
|
177
176
|
queue: localConversationWork.queue,
|
|
178
177
|
run: async (context) => {
|
|
179
|
-
|
|
180
|
-
return
|
|
178
|
+
await resumeForPersonInput(context.conversationId, context.attempt.messages);
|
|
179
|
+
return await childWorker(context);
|
|
181
180
|
}
|
|
182
181
|
});
|
|
183
182
|
});
|
package/dist/cli/check.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as mapBounded } from "../fan-out-Cod-yEHG.js";
|
|
2
|
-
import { a as parseSkillFile } from "../skills-
|
|
3
|
-
import { N as JUNIOR_HEARTBEAT_ROUTE, R as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-
|
|
4
|
-
import { b as parsePluginManifest, y as parseInlinePluginManifest } from "../registry-
|
|
2
|
+
import { a as parseSkillFile } from "../skills-B0jP4whm.js";
|
|
3
|
+
import { N as JUNIOR_HEARTBEAT_ROUTE, R as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-DNt-qOIO.js";
|
|
4
|
+
import { b as parsePluginManifest, y as parseInlinePluginManifest } from "../registry-POH4bZC4.js";
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
import pLimit from "p-limit";
|
|
7
7
|
import path from "node:path";
|
package/dist/cli/init.js
CHANGED
package/dist/cli/main.js
CHANGED
|
@@ -45,13 +45,10 @@ async function runChat(argv, pluginSet) {
|
|
|
45
45
|
return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
|
|
46
46
|
}
|
|
47
47
|
async function runAdmin(argv) {
|
|
48
|
-
return await (await import("../admin-
|
|
48
|
+
return await (await import("../admin-Cyhb4TwZ.js")).runAdmin(argv);
|
|
49
49
|
}
|
|
50
50
|
async function runServiceAccount(argv) {
|
|
51
|
-
return await (await import("../service-account-
|
|
52
|
-
}
|
|
53
|
-
async function runBriefs(argv) {
|
|
54
|
-
return await (await import("../briefs-BDjnug6Y.js")).runBriefs(argv);
|
|
51
|
+
return await (await import("../service-account-CDYb9hfX.js")).runServiceAccount(argv);
|
|
55
52
|
}
|
|
56
53
|
function topLevelCommand(argv) {
|
|
57
54
|
return (argv[0] === "--" ? argv.slice(1) : argv)[0];
|
|
@@ -64,12 +61,11 @@ async function runMain(argv, options = {}) {
|
|
|
64
61
|
const instrument = options.instrument ?? true;
|
|
65
62
|
if (instrument) await initSentry();
|
|
66
63
|
const command = topLevelCommand(argv);
|
|
67
|
-
const cliPluginsModule = command && command !== "init" && command !== "
|
|
64
|
+
const cliPluginsModule = command && command !== "init" && command !== "admin" ? await import("./plugins.js") : void 0;
|
|
68
65
|
const pluginSet = cliPluginsModule ? await cliPluginsModule.loadCliPluginSet() ?? null : void 0;
|
|
69
66
|
const pluginCommands = cliPluginsModule ? await cliPluginsModule.loadCliPluginCommands(pluginSet) : void 0;
|
|
70
67
|
const exitCode = await runCli(argv, {
|
|
71
68
|
runAdmin,
|
|
72
|
-
runBriefs,
|
|
73
69
|
runServiceAccount,
|
|
74
70
|
runChat: async (chatArgv) => await runChat(chatArgv, pluginSet),
|
|
75
71
|
runInit,
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { o as getDb } from "../db-
|
|
2
|
-
import {
|
|
3
|
-
import { n as pluginCatalogRuntime } from "../catalog-runtime-
|
|
4
|
-
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-
|
|
1
|
+
import { o as getDb } from "../db-PwSRzWWn.js";
|
|
2
|
+
import { E as coreRegistrations, v as setPlugins, wr as createPluginLogger, y as validatePlugins } from "../credentialed-Dyv8b-lu.js";
|
|
3
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-kkE3hvCX.js";
|
|
4
|
+
import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-Ce0qbMlT.js";
|
|
5
5
|
import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
|
|
6
6
|
import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-Bkk0XRo2.js";
|
|
7
7
|
import { Command, CommanderError } from "commander";
|
package/dist/cli/run.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export declare const CLI_USAGE = "usage: junior init <dir>\n junior admin list|grant <email>|revoke <email>\n junior service-account connect|status|disconnect <plugin>\n junior snapshot create\n junior check [dir]\n junior upgrade\n junior chat\n junior chat -p <message
|
|
1
|
+
export declare const CLI_USAGE = "usage: junior init <dir>\n junior admin list|grant <email>|revoke <email>\n junior service-account connect|status|disconnect <plugin>\n junior snapshot create\n junior check [dir]\n junior upgrade\n junior chat\n junior chat -p <message>";
|
|
2
2
|
interface CliHandlers {
|
|
3
3
|
runAdmin: (argv: string[]) => Promise<number>;
|
|
4
|
-
runBriefs: (argv: string[]) => Promise<number>;
|
|
5
4
|
runServiceAccount: (argv: string[]) => Promise<number>;
|
|
6
5
|
runChat: (argv: string[]) => Promise<number>;
|
|
7
6
|
runInit: (dir: string) => Promise<void>;
|
package/dist/cli/run.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/cli/run.ts
|
|
2
|
-
const CLI_USAGE = "usage: junior init <dir>\n junior admin list|grant <email>|revoke <email>\n junior service-account connect|status|disconnect <plugin>\n junior snapshot create\n junior check [dir]\n junior upgrade\n junior chat\n junior chat -p <message
|
|
2
|
+
const CLI_USAGE = "usage: junior init <dir>\n junior admin list|grant <email>|revoke <email>\n junior service-account connect|status|disconnect <plugin>\n junior snapshot create\n junior check [dir]\n junior upgrade\n junior chat\n junior chat -p <message>";
|
|
3
3
|
const DEFAULT_IO = { error: console.error };
|
|
4
4
|
/** Strip Node's leading argv separator while preserving command-level flags. */
|
|
5
5
|
function normalizeCliArgv(argv) {
|
|
@@ -11,7 +11,6 @@ async function runCli(argv, handlers, io = DEFAULT_IO) {
|
|
|
11
11
|
if (command === "chat") return await handlers.runChat(subcommand === void 0 ? [] : [subcommand, ...rest]);
|
|
12
12
|
if (command === "admin") return await handlers.runAdmin(subcommand === void 0 ? [] : [subcommand, ...rest]);
|
|
13
13
|
if (command === "service-account") return await handlers.runServiceAccount(subcommand === void 0 ? [] : [subcommand, ...rest]);
|
|
14
|
-
if (command === "briefs") return await handlers.runBriefs(subcommand === void 0 ? [] : [subcommand, ...rest]);
|
|
15
14
|
if (command === "init") {
|
|
16
15
|
if (!subcommand || rest.length > 0) {
|
|
17
16
|
io.error(CLI_USAGE);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as pluginCatalogRuntime } from "../catalog-runtime-
|
|
3
|
-
import { n as resolve } from "../resolve-
|
|
4
|
-
import {
|
|
5
|
-
import { n as disconnectStateAdapter } from "../adapter-
|
|
1
|
+
import { r as getChatConfig } from "../config-CWbwKj0j.js";
|
|
2
|
+
import { n as pluginCatalogRuntime } from "../catalog-runtime-kkE3hvCX.js";
|
|
3
|
+
import { n as resolve } from "../resolve-CWtBNSKP.js";
|
|
4
|
+
import { Jt as create, On as SANDBOX_RUNTIME } from "../credentialed-Dyv8b-lu.js";
|
|
5
|
+
import { n as disconnectStateAdapter } from "../adapter-CYAvJzZS.js";
|
|
6
6
|
// src/cli/snapshot-create.ts
|
|
7
7
|
const DEFAULT_TIMEOUT_MS = 6e5;
|
|
8
8
|
function progressMessage(phase) {
|
package/dist/cli/upgrade.d.ts
CHANGED
package/dist/cli/upgrade.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as isPostgresErrorCode, t as createJuniorSqlExecutor } from "../executor-
|
|
1
|
+
import { r as getChatConfig } from "../config-CWbwKj0j.js";
|
|
2
|
+
import { n as isPostgresErrorCode, t as createJuniorSqlExecutor } from "../executor-CgWyWfYz.js";
|
|
3
3
|
import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
|
|
4
|
-
import { t as createPluginCatalogRuntime } from "../registry-
|
|
4
|
+
import { t as createPluginCatalogRuntime } from "../registry-POH4bZC4.js";
|
|
5
5
|
import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-Bkk0XRo2.js";
|
|
6
6
|
import { basename, dirname, join, resolve } from "node:path";
|
|
7
7
|
import { createHash } from "node:crypto";
|