@defend-tech/opencode-optima 0.1.19 → 0.1.20
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/index.js +53 -4
- package/dist/sanitize_cli.js +53 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8831,10 +8831,21 @@ function resolveOptimaPluginOptions(rawInput = {}, pluginOptions = {}) {
|
|
|
8831
8831
|
function pickConfiguredClickUp(rawInput = {}, repoCfg = {}, pluginOptions = {}) {
|
|
8832
8832
|
return pluginOptions?.clickup || pluginOptions?.experimental?.optima?.clickup || rawInput?.options?.clickup || rawInput?.options?.experimental?.optima?.clickup || rawInput?.experimental?.optima?.clickup || rawInput?.config?.experimental?.optima?.clickup || rawInput?.opencode?.experimental?.optima?.clickup || repoCfg?.experimental?.optima?.clickup || repoCfg?.clickup || null;
|
|
8833
8833
|
}
|
|
8834
|
+
function normalizeOpenCodeBaseUrl(value, defaultValue = "http://127.0.0.1:3001") {
|
|
8835
|
+
const candidate = String(value || defaultValue || "").trim();
|
|
8836
|
+
if (!candidate) return "";
|
|
8837
|
+
try {
|
|
8838
|
+
const url = new URL(candidate);
|
|
8839
|
+
return url.toString().replace(/\/+$/, "");
|
|
8840
|
+
} catch {
|
|
8841
|
+
return candidate.replace(/\/+$/, "");
|
|
8842
|
+
}
|
|
8843
|
+
}
|
|
8834
8844
|
function normalizeClickUpWebhookConfig(rawClickUp = null, worktree = process.cwd()) {
|
|
8835
8845
|
const raw = isPlainObject(rawClickUp) ? rawClickUp : {};
|
|
8836
8846
|
const webhook = isPlainObject(raw.webhook) ? raw.webhook : {};
|
|
8837
8847
|
const routing = isPlainObject(raw.routing) ? raw.routing : {};
|
|
8848
|
+
const opencode = isPlainObject(raw.opencode) ? raw.opencode : {};
|
|
8838
8849
|
const location = isPlainObject(webhook.location) ? webhook.location : {};
|
|
8839
8850
|
const events = Array.isArray(webhook.events) && webhook.events.length > 0 ? [...new Set(webhook.events.map((event) => String(event || "").trim()).filter(Boolean))] : [...CLICKUP_WEBHOOK_EVENTS];
|
|
8840
8851
|
const ignoredStatuses = Array.isArray(routing.ignored_statuses) && routing.ignored_statuses.length > 0 ? routing.ignored_statuses : CLICKUP_WEBHOOK_TERMINAL_STATUSES;
|
|
@@ -8844,6 +8855,9 @@ function normalizeClickUpWebhookConfig(rawClickUp = null, worktree = process.cwd
|
|
|
8844
8855
|
teamId: String(raw.team_id || raw.teamId || "").trim(),
|
|
8845
8856
|
apiToken: String(raw.api_token || raw.apiToken || "").trim(),
|
|
8846
8857
|
log: normalizeClickUpWebhookLogLevel(raw.log),
|
|
8858
|
+
opencode: {
|
|
8859
|
+
baseUrl: normalizeOpenCodeBaseUrl(opencode.base_url || opencode.baseUrl || raw.opencode_base_url || raw.opencodeBaseUrl)
|
|
8860
|
+
},
|
|
8847
8861
|
webhook: {
|
|
8848
8862
|
publicUrl: String(webhook.public_url || webhook.publicUrl || "").trim(),
|
|
8849
8863
|
bindHost: String(webhook.bind_host || webhook.bindHost || "127.0.0.1").trim(),
|
|
@@ -8877,6 +8891,13 @@ function normalizeClickUpWebhookConfig(rawClickUp = null, worktree = process.cwd
|
|
|
8877
8891
|
if (!config.webhook.bindHost) errors.push("clickup.webhook.bind_host is required");
|
|
8878
8892
|
if (!Number.isInteger(config.webhook.bindPort) || config.webhook.bindPort <= 0) errors.push("clickup.webhook.bind_port must be a positive integer");
|
|
8879
8893
|
if (!config.webhook.location.list_id && !config.webhook.location.folder_id && !config.webhook.location.space_id) errors.push("one clickup.webhook.location id is required");
|
|
8894
|
+
if (config.opencode.baseUrl) {
|
|
8895
|
+
try {
|
|
8896
|
+
new URL(config.opencode.baseUrl);
|
|
8897
|
+
} catch {
|
|
8898
|
+
errors.push("clickup.opencode.base_url must be a valid URL");
|
|
8899
|
+
}
|
|
8900
|
+
}
|
|
8880
8901
|
const missingEvents = CLICKUP_WEBHOOK_EVENTS.filter((event) => !config.webhook.events.includes(event));
|
|
8881
8902
|
if (missingEvents.length > 0) errors.push(`clickup.webhook.events missing: ${missingEvents.join(", ")}`);
|
|
8882
8903
|
if (config.routing.targetAgent !== "workflow_product_manager") errors.push("clickup.routing.target_agent must be workflow_product_manager");
|
|
@@ -9246,6 +9267,32 @@ function assertOpenCodePromptAccepted(result) {
|
|
|
9246
9267
|
}
|
|
9247
9268
|
return result;
|
|
9248
9269
|
}
|
|
9270
|
+
async function sendOpenCodeSessionEventDirect({ baseUrl, sessionId, text, fetchImpl = globalThis.fetch } = {}) {
|
|
9271
|
+
if (typeof fetchImpl !== "function") throw new Error("OpenCode direct prompt delivery requires fetch.");
|
|
9272
|
+
const root = normalizeOpenCodeBaseUrl(baseUrl, "");
|
|
9273
|
+
if (!root) throw new Error("OpenCode direct prompt delivery requires a base URL.");
|
|
9274
|
+
const url = `${root}/api/session/${encodeURIComponent(sessionId)}/prompt`;
|
|
9275
|
+
const response = await fetchImpl(url, {
|
|
9276
|
+
method: "POST",
|
|
9277
|
+
headers: { "content-type": "application/json" },
|
|
9278
|
+
body: JSON.stringify({ prompt: { text }, delivery: "queue", resume: true })
|
|
9279
|
+
});
|
|
9280
|
+
const raw = await response.text();
|
|
9281
|
+
let data = null;
|
|
9282
|
+
if (raw) {
|
|
9283
|
+
try {
|
|
9284
|
+
data = JSON.parse(raw);
|
|
9285
|
+
} catch (error) {
|
|
9286
|
+
if (response.ok) throw new Error(`OpenCode prompt response was not JSON: ${error.message}`);
|
|
9287
|
+
}
|
|
9288
|
+
}
|
|
9289
|
+
if (!response.ok) {
|
|
9290
|
+
const message = data?.error?.message || data?.message || raw || `OpenCode prompt request failed with status ${response.status}.`;
|
|
9291
|
+
throw new Error(message);
|
|
9292
|
+
}
|
|
9293
|
+
if (!data?.data?.id) throw new Error("OpenCode prompt response did not include data.id.");
|
|
9294
|
+
return { ok: true, method: "http", status: response.status, data: data.data, response: data };
|
|
9295
|
+
}
|
|
9249
9296
|
async function callOpenCodePromptWithFallbacks(method, sessionId, flatPayload, structuredPayload) {
|
|
9250
9297
|
const attempts = [
|
|
9251
9298
|
{ id: sessionId, ...flatPayload },
|
|
@@ -9263,7 +9310,9 @@ async function callOpenCodePromptWithFallbacks(method, sessionId, flatPayload, s
|
|
|
9263
9310
|
}
|
|
9264
9311
|
throw firstError;
|
|
9265
9312
|
}
|
|
9266
|
-
async function sendOpenCodeSessionEvent(client, { sessionId, agent, text, directory } = {}) {
|
|
9313
|
+
async function sendOpenCodeSessionEvent(client, { sessionId, agent, text, directory, opencodeBaseUrl, baseUrl, fetchImpl } = {}) {
|
|
9314
|
+
const directBaseUrl = opencodeBaseUrl || baseUrl;
|
|
9315
|
+
if (directBaseUrl) return sendOpenCodeSessionEventDirect({ baseUrl: directBaseUrl, sessionId, text, fetchImpl });
|
|
9267
9316
|
const parts = [{ type: "text", text }];
|
|
9268
9317
|
const flatPayload = { directory, agent, parts };
|
|
9269
9318
|
const structuredPayload = { query: { directory }, body: { agent, parts } };
|
|
@@ -9517,7 +9566,7 @@ async function routeClickUpWebhookEventUnlocked({ payload, config, state = {}, w
|
|
|
9517
9566
|
appendClickUpWebhookLocalLog(worktree, { type: "pending_session_metadata_failed", taskId, sessionId: pendingSessionId, message: error.message });
|
|
9518
9567
|
throw error;
|
|
9519
9568
|
}
|
|
9520
|
-
await sendSessionEvent(openCodeClient, { sessionId: pendingSessionId, agent: config.routing.targetAgent, text: prompt, directory: config.basePath });
|
|
9569
|
+
await sendSessionEvent(openCodeClient, { sessionId: pendingSessionId, agent: config.routing.targetAgent, text: prompt, directory: config.basePath, opencodeBaseUrl: config.opencode?.baseUrl });
|
|
9521
9570
|
const nextMetadata = clearClickUpPendingSessionMetadata(setClickUpSessionMetadata(pendingMetadata, config.routing.metadataKey, pendingSessionId), config.routing.metadataKey);
|
|
9522
9571
|
await clickupClient.updateTaskMetadata({ taskId, fieldId: config.routing.metadataFieldId, value: nextMetadata });
|
|
9523
9572
|
const { [taskId]: _completedPending, ...remainingPending } = stateToPersist.pendingSessions || {};
|
|
@@ -9526,7 +9575,7 @@ async function routeClickUpWebhookEventUnlocked({ payload, config, state = {}, w
|
|
|
9526
9575
|
}
|
|
9527
9576
|
const sessionId = String(existingSessionId);
|
|
9528
9577
|
if (await sessionExists(openCodeClient, sessionId)) {
|
|
9529
|
-
await sendSessionEvent(openCodeClient, { sessionId, agent: config.routing.targetAgent, text: prompt, directory: config.basePath });
|
|
9578
|
+
await sendSessionEvent(openCodeClient, { sessionId, agent: config.routing.targetAgent, text: prompt, directory: config.basePath, opencodeBaseUrl: config.opencode?.baseUrl });
|
|
9530
9579
|
return finish({ ok: true, action: "sent_to_existing_session", taskId, sessionId, eventKey });
|
|
9531
9580
|
}
|
|
9532
9581
|
const at = now().toISOString();
|
|
@@ -11277,7 +11326,7 @@ Follow-up: use optima_prompt_workflow with session_id '${sessionId}' to check in
|
|
|
11277
11326
|
}
|
|
11278
11327
|
};
|
|
11279
11328
|
}
|
|
11280
|
-
OptimaPlugin.__internals = { BUNDLE_AGENTS_DIR, activeClickUpWebhookLifecycleRegistry, cleanupManagedClickUpWebhook, deleteClickUpWebhookBestEffort, BUNDLE_POLICIES_DIR, buildClickUpApplyPayloadResult, buildClickUpCreateSubtasksPayload, buildClickUpStartTaskPayload, buildClickUpSummaryPayload, buildClickUpTransitionPayload, buildOptimaAgents, clickUpCommentMentionsProductManager, clickUpWebhookAuditLogDir, clickUpWebhookAuditLogPath, createClickUpApiClient, ensureClickUpWebhookSubscription, handleClickUpWebhookRequest, isClickUpWebhookStateActive, normalizeClickUpWebhookConfig, normalizeClickUpWebhookLogLevel, readClickUpWebhookState, resolveOptimaPluginOptions, resolveSecretReference, routeClickUpWebhookEvent, sendOpenCodeSessionEvent, startClickUpWebhookListener, validateClickUpWebhookState, verifyClickUpSignature, writeClickUpWebhookState, decideClickUpStatusAction, deriveClickUpBranchName, deriveClickUpPendingSubtaskBranch, deriveClickUpPrTarget, deriveClickUpWorktree, determineClickUpMergeAuthority, ensureOptimaGitignoreRules, explicitSafeInputWorktree, finalApprovalAssignees, formatValidationResult, isIgnoredClickUpTaskType, isOptimaPluginPackageWorktree, isSafeWritableDirectory, loadHumansRegistry, mergeClickUpAgentMetadata, mergeClickUpSessionMetadata, migrateLegacyOptimaLayout, normalizeAgentMetadataJson, normalizeClickUpStatus, normalizeClickUpTaskType, normalizePromptResponseParts, normalizeWorkflowTaskPath, parseClickUpSubtasksMarkdown, parseHumansRegistry, parseMarkdownArtifact, parseMarkdownSections, preEstimateClickUpWork, readMarkdownArtifact, resolveHumanRoles, resolveSafeWorktree, safeWorktreeOrFailure, stripRawLogSections, validateMainWorkspaceBranchSafety, workflowFinalMessageFromPromptResponse };
|
|
11329
|
+
OptimaPlugin.__internals = { BUNDLE_AGENTS_DIR, activeClickUpWebhookLifecycleRegistry, cleanupManagedClickUpWebhook, deleteClickUpWebhookBestEffort, BUNDLE_POLICIES_DIR, buildClickUpApplyPayloadResult, buildClickUpCreateSubtasksPayload, buildClickUpStartTaskPayload, buildClickUpSummaryPayload, buildClickUpTransitionPayload, buildOptimaAgents, clickUpCommentMentionsProductManager, clickUpWebhookAuditLogDir, clickUpWebhookAuditLogPath, createClickUpApiClient, ensureClickUpWebhookSubscription, handleClickUpWebhookRequest, isClickUpWebhookStateActive, normalizeClickUpWebhookConfig, normalizeClickUpWebhookLogLevel, normalizeOpenCodeBaseUrl, readClickUpWebhookState, resolveOptimaPluginOptions, resolveSecretReference, routeClickUpWebhookEvent, sendOpenCodeSessionEvent, sendOpenCodeSessionEventDirect, startClickUpWebhookListener, validateClickUpWebhookState, verifyClickUpSignature, writeClickUpWebhookState, decideClickUpStatusAction, deriveClickUpBranchName, deriveClickUpPendingSubtaskBranch, deriveClickUpPrTarget, deriveClickUpWorktree, determineClickUpMergeAuthority, ensureOptimaGitignoreRules, explicitSafeInputWorktree, finalApprovalAssignees, formatValidationResult, isIgnoredClickUpTaskType, isOptimaPluginPackageWorktree, isSafeWritableDirectory, loadHumansRegistry, mergeClickUpAgentMetadata, mergeClickUpSessionMetadata, migrateLegacyOptimaLayout, normalizeAgentMetadataJson, normalizeClickUpStatus, normalizeClickUpTaskType, normalizePromptResponseParts, normalizeWorkflowTaskPath, parseClickUpSubtasksMarkdown, parseHumansRegistry, parseMarkdownArtifact, parseMarkdownSections, preEstimateClickUpWork, readMarkdownArtifact, resolveHumanRoles, resolveSafeWorktree, safeWorktreeOrFailure, stripRawLogSections, validateMainWorkspaceBranchSafety, workflowFinalMessageFromPromptResponse };
|
|
11281
11330
|
export {
|
|
11282
11331
|
OptimaPlugin as default
|
|
11283
11332
|
};
|
package/dist/sanitize_cli.js
CHANGED
|
@@ -8838,10 +8838,21 @@ function resolveOptimaPluginOptions(rawInput = {}, pluginOptions = {}) {
|
|
|
8838
8838
|
function pickConfiguredClickUp(rawInput = {}, repoCfg = {}, pluginOptions = {}) {
|
|
8839
8839
|
return pluginOptions?.clickup || pluginOptions?.experimental?.optima?.clickup || rawInput?.options?.clickup || rawInput?.options?.experimental?.optima?.clickup || rawInput?.experimental?.optima?.clickup || rawInput?.config?.experimental?.optima?.clickup || rawInput?.opencode?.experimental?.optima?.clickup || repoCfg?.experimental?.optima?.clickup || repoCfg?.clickup || null;
|
|
8840
8840
|
}
|
|
8841
|
+
function normalizeOpenCodeBaseUrl(value, defaultValue = "http://127.0.0.1:3001") {
|
|
8842
|
+
const candidate = String(value || defaultValue || "").trim();
|
|
8843
|
+
if (!candidate) return "";
|
|
8844
|
+
try {
|
|
8845
|
+
const url = new URL(candidate);
|
|
8846
|
+
return url.toString().replace(/\/+$/, "");
|
|
8847
|
+
} catch {
|
|
8848
|
+
return candidate.replace(/\/+$/, "");
|
|
8849
|
+
}
|
|
8850
|
+
}
|
|
8841
8851
|
function normalizeClickUpWebhookConfig(rawClickUp = null, worktree = process.cwd()) {
|
|
8842
8852
|
const raw = isPlainObject(rawClickUp) ? rawClickUp : {};
|
|
8843
8853
|
const webhook = isPlainObject(raw.webhook) ? raw.webhook : {};
|
|
8844
8854
|
const routing = isPlainObject(raw.routing) ? raw.routing : {};
|
|
8855
|
+
const opencode = isPlainObject(raw.opencode) ? raw.opencode : {};
|
|
8845
8856
|
const location = isPlainObject(webhook.location) ? webhook.location : {};
|
|
8846
8857
|
const events = Array.isArray(webhook.events) && webhook.events.length > 0 ? [...new Set(webhook.events.map((event) => String(event || "").trim()).filter(Boolean))] : [...CLICKUP_WEBHOOK_EVENTS];
|
|
8847
8858
|
const ignoredStatuses = Array.isArray(routing.ignored_statuses) && routing.ignored_statuses.length > 0 ? routing.ignored_statuses : CLICKUP_WEBHOOK_TERMINAL_STATUSES;
|
|
@@ -8851,6 +8862,9 @@ function normalizeClickUpWebhookConfig(rawClickUp = null, worktree = process.cwd
|
|
|
8851
8862
|
teamId: String(raw.team_id || raw.teamId || "").trim(),
|
|
8852
8863
|
apiToken: String(raw.api_token || raw.apiToken || "").trim(),
|
|
8853
8864
|
log: normalizeClickUpWebhookLogLevel(raw.log),
|
|
8865
|
+
opencode: {
|
|
8866
|
+
baseUrl: normalizeOpenCodeBaseUrl(opencode.base_url || opencode.baseUrl || raw.opencode_base_url || raw.opencodeBaseUrl)
|
|
8867
|
+
},
|
|
8854
8868
|
webhook: {
|
|
8855
8869
|
publicUrl: String(webhook.public_url || webhook.publicUrl || "").trim(),
|
|
8856
8870
|
bindHost: String(webhook.bind_host || webhook.bindHost || "127.0.0.1").trim(),
|
|
@@ -8884,6 +8898,13 @@ function normalizeClickUpWebhookConfig(rawClickUp = null, worktree = process.cwd
|
|
|
8884
8898
|
if (!config.webhook.bindHost) errors.push("clickup.webhook.bind_host is required");
|
|
8885
8899
|
if (!Number.isInteger(config.webhook.bindPort) || config.webhook.bindPort <= 0) errors.push("clickup.webhook.bind_port must be a positive integer");
|
|
8886
8900
|
if (!config.webhook.location.list_id && !config.webhook.location.folder_id && !config.webhook.location.space_id) errors.push("one clickup.webhook.location id is required");
|
|
8901
|
+
if (config.opencode.baseUrl) {
|
|
8902
|
+
try {
|
|
8903
|
+
new URL(config.opencode.baseUrl);
|
|
8904
|
+
} catch {
|
|
8905
|
+
errors.push("clickup.opencode.base_url must be a valid URL");
|
|
8906
|
+
}
|
|
8907
|
+
}
|
|
8887
8908
|
const missingEvents = CLICKUP_WEBHOOK_EVENTS.filter((event) => !config.webhook.events.includes(event));
|
|
8888
8909
|
if (missingEvents.length > 0) errors.push(`clickup.webhook.events missing: ${missingEvents.join(", ")}`);
|
|
8889
8910
|
if (config.routing.targetAgent !== "workflow_product_manager") errors.push("clickup.routing.target_agent must be workflow_product_manager");
|
|
@@ -9253,6 +9274,32 @@ function assertOpenCodePromptAccepted(result) {
|
|
|
9253
9274
|
}
|
|
9254
9275
|
return result;
|
|
9255
9276
|
}
|
|
9277
|
+
async function sendOpenCodeSessionEventDirect({ baseUrl, sessionId, text, fetchImpl = globalThis.fetch } = {}) {
|
|
9278
|
+
if (typeof fetchImpl !== "function") throw new Error("OpenCode direct prompt delivery requires fetch.");
|
|
9279
|
+
const root = normalizeOpenCodeBaseUrl(baseUrl, "");
|
|
9280
|
+
if (!root) throw new Error("OpenCode direct prompt delivery requires a base URL.");
|
|
9281
|
+
const url = `${root}/api/session/${encodeURIComponent(sessionId)}/prompt`;
|
|
9282
|
+
const response = await fetchImpl(url, {
|
|
9283
|
+
method: "POST",
|
|
9284
|
+
headers: { "content-type": "application/json" },
|
|
9285
|
+
body: JSON.stringify({ prompt: { text }, delivery: "queue", resume: true })
|
|
9286
|
+
});
|
|
9287
|
+
const raw = await response.text();
|
|
9288
|
+
let data = null;
|
|
9289
|
+
if (raw) {
|
|
9290
|
+
try {
|
|
9291
|
+
data = JSON.parse(raw);
|
|
9292
|
+
} catch (error) {
|
|
9293
|
+
if (response.ok) throw new Error(`OpenCode prompt response was not JSON: ${error.message}`);
|
|
9294
|
+
}
|
|
9295
|
+
}
|
|
9296
|
+
if (!response.ok) {
|
|
9297
|
+
const message = data?.error?.message || data?.message || raw || `OpenCode prompt request failed with status ${response.status}.`;
|
|
9298
|
+
throw new Error(message);
|
|
9299
|
+
}
|
|
9300
|
+
if (!data?.data?.id) throw new Error("OpenCode prompt response did not include data.id.");
|
|
9301
|
+
return { ok: true, method: "http", status: response.status, data: data.data, response: data };
|
|
9302
|
+
}
|
|
9256
9303
|
async function callOpenCodePromptWithFallbacks(method, sessionId, flatPayload, structuredPayload) {
|
|
9257
9304
|
const attempts = [
|
|
9258
9305
|
{ id: sessionId, ...flatPayload },
|
|
@@ -9270,7 +9317,9 @@ async function callOpenCodePromptWithFallbacks(method, sessionId, flatPayload, s
|
|
|
9270
9317
|
}
|
|
9271
9318
|
throw firstError;
|
|
9272
9319
|
}
|
|
9273
|
-
async function sendOpenCodeSessionEvent(client, { sessionId, agent, text, directory } = {}) {
|
|
9320
|
+
async function sendOpenCodeSessionEvent(client, { sessionId, agent, text, directory, opencodeBaseUrl, baseUrl, fetchImpl } = {}) {
|
|
9321
|
+
const directBaseUrl = opencodeBaseUrl || baseUrl;
|
|
9322
|
+
if (directBaseUrl) return sendOpenCodeSessionEventDirect({ baseUrl: directBaseUrl, sessionId, text, fetchImpl });
|
|
9274
9323
|
const parts = [{ type: "text", text }];
|
|
9275
9324
|
const flatPayload = { directory, agent, parts };
|
|
9276
9325
|
const structuredPayload = { query: { directory }, body: { agent, parts } };
|
|
@@ -9524,7 +9573,7 @@ async function routeClickUpWebhookEventUnlocked({ payload, config, state = {}, w
|
|
|
9524
9573
|
appendClickUpWebhookLocalLog(worktree, { type: "pending_session_metadata_failed", taskId, sessionId: pendingSessionId, message: error.message });
|
|
9525
9574
|
throw error;
|
|
9526
9575
|
}
|
|
9527
|
-
await sendSessionEvent(openCodeClient, { sessionId: pendingSessionId, agent: config.routing.targetAgent, text: prompt, directory: config.basePath });
|
|
9576
|
+
await sendSessionEvent(openCodeClient, { sessionId: pendingSessionId, agent: config.routing.targetAgent, text: prompt, directory: config.basePath, opencodeBaseUrl: config.opencode?.baseUrl });
|
|
9528
9577
|
const nextMetadata = clearClickUpPendingSessionMetadata(setClickUpSessionMetadata(pendingMetadata, config.routing.metadataKey, pendingSessionId), config.routing.metadataKey);
|
|
9529
9578
|
await clickupClient.updateTaskMetadata({ taskId, fieldId: config.routing.metadataFieldId, value: nextMetadata });
|
|
9530
9579
|
const { [taskId]: _completedPending, ...remainingPending } = stateToPersist.pendingSessions || {};
|
|
@@ -9533,7 +9582,7 @@ async function routeClickUpWebhookEventUnlocked({ payload, config, state = {}, w
|
|
|
9533
9582
|
}
|
|
9534
9583
|
const sessionId = String(existingSessionId);
|
|
9535
9584
|
if (await sessionExists(openCodeClient, sessionId)) {
|
|
9536
|
-
await sendSessionEvent(openCodeClient, { sessionId, agent: config.routing.targetAgent, text: prompt, directory: config.basePath });
|
|
9585
|
+
await sendSessionEvent(openCodeClient, { sessionId, agent: config.routing.targetAgent, text: prompt, directory: config.basePath, opencodeBaseUrl: config.opencode?.baseUrl });
|
|
9537
9586
|
return finish({ ok: true, action: "sent_to_existing_session", taskId, sessionId, eventKey });
|
|
9538
9587
|
}
|
|
9539
9588
|
const at = now().toISOString();
|
|
@@ -11284,7 +11333,7 @@ Follow-up: use optima_prompt_workflow with session_id '${sessionId}' to check in
|
|
|
11284
11333
|
}
|
|
11285
11334
|
};
|
|
11286
11335
|
}
|
|
11287
|
-
OptimaPlugin.__internals = { BUNDLE_AGENTS_DIR, activeClickUpWebhookLifecycleRegistry, cleanupManagedClickUpWebhook, deleteClickUpWebhookBestEffort, BUNDLE_POLICIES_DIR, buildClickUpApplyPayloadResult, buildClickUpCreateSubtasksPayload, buildClickUpStartTaskPayload, buildClickUpSummaryPayload, buildClickUpTransitionPayload, buildOptimaAgents, clickUpCommentMentionsProductManager, clickUpWebhookAuditLogDir, clickUpWebhookAuditLogPath, createClickUpApiClient, ensureClickUpWebhookSubscription, handleClickUpWebhookRequest, isClickUpWebhookStateActive, normalizeClickUpWebhookConfig, normalizeClickUpWebhookLogLevel, readClickUpWebhookState, resolveOptimaPluginOptions, resolveSecretReference, routeClickUpWebhookEvent, sendOpenCodeSessionEvent, startClickUpWebhookListener, validateClickUpWebhookState, verifyClickUpSignature, writeClickUpWebhookState, decideClickUpStatusAction, deriveClickUpBranchName, deriveClickUpPendingSubtaskBranch, deriveClickUpPrTarget, deriveClickUpWorktree, determineClickUpMergeAuthority, ensureOptimaGitignoreRules, explicitSafeInputWorktree, finalApprovalAssignees, formatValidationResult, isIgnoredClickUpTaskType, isOptimaPluginPackageWorktree, isSafeWritableDirectory, loadHumansRegistry, mergeClickUpAgentMetadata, mergeClickUpSessionMetadata, migrateLegacyOptimaLayout, normalizeAgentMetadataJson, normalizeClickUpStatus, normalizeClickUpTaskType, normalizePromptResponseParts, normalizeWorkflowTaskPath, parseClickUpSubtasksMarkdown, parseHumansRegistry, parseMarkdownArtifact, parseMarkdownSections, preEstimateClickUpWork, readMarkdownArtifact, resolveHumanRoles, resolveSafeWorktree, safeWorktreeOrFailure, stripRawLogSections, validateMainWorkspaceBranchSafety, workflowFinalMessageFromPromptResponse };
|
|
11336
|
+
OptimaPlugin.__internals = { BUNDLE_AGENTS_DIR, activeClickUpWebhookLifecycleRegistry, cleanupManagedClickUpWebhook, deleteClickUpWebhookBestEffort, BUNDLE_POLICIES_DIR, buildClickUpApplyPayloadResult, buildClickUpCreateSubtasksPayload, buildClickUpStartTaskPayload, buildClickUpSummaryPayload, buildClickUpTransitionPayload, buildOptimaAgents, clickUpCommentMentionsProductManager, clickUpWebhookAuditLogDir, clickUpWebhookAuditLogPath, createClickUpApiClient, ensureClickUpWebhookSubscription, handleClickUpWebhookRequest, isClickUpWebhookStateActive, normalizeClickUpWebhookConfig, normalizeClickUpWebhookLogLevel, normalizeOpenCodeBaseUrl, readClickUpWebhookState, resolveOptimaPluginOptions, resolveSecretReference, routeClickUpWebhookEvent, sendOpenCodeSessionEvent, sendOpenCodeSessionEventDirect, startClickUpWebhookListener, validateClickUpWebhookState, verifyClickUpSignature, writeClickUpWebhookState, decideClickUpStatusAction, deriveClickUpBranchName, deriveClickUpPendingSubtaskBranch, deriveClickUpPrTarget, deriveClickUpWorktree, determineClickUpMergeAuthority, ensureOptimaGitignoreRules, explicitSafeInputWorktree, finalApprovalAssignees, formatValidationResult, isIgnoredClickUpTaskType, isOptimaPluginPackageWorktree, isSafeWritableDirectory, loadHumansRegistry, mergeClickUpAgentMetadata, mergeClickUpSessionMetadata, migrateLegacyOptimaLayout, normalizeAgentMetadataJson, normalizeClickUpStatus, normalizeClickUpTaskType, normalizePromptResponseParts, normalizeWorkflowTaskPath, parseClickUpSubtasksMarkdown, parseHumansRegistry, parseMarkdownArtifact, parseMarkdownSections, preEstimateClickUpWork, readMarkdownArtifact, resolveHumanRoles, resolveSafeWorktree, safeWorktreeOrFailure, stripRawLogSections, validateMainWorkspaceBranchSafety, workflowFinalMessageFromPromptResponse };
|
|
11288
11337
|
|
|
11289
11338
|
// src/sanitize_cli.js
|
|
11290
11339
|
var { migrateLegacyOptimaLayout: migrateLegacyOptimaLayout2 } = OptimaPlugin.__internals;
|