@defend-tech/opencode-optima 0.1.64 → 0.1.65
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 +10 -2
- package/dist/sanitize_cli.js +10 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9337,7 +9337,7 @@ async function syncOpenChamberWorktreeVisibility({ openchamberBaseUrl, opencodeB
|
|
|
9337
9337
|
gitWorktree,
|
|
9338
9338
|
projectId: project.id
|
|
9339
9339
|
};
|
|
9340
|
-
if (!visibility.worktree || !visibility.
|
|
9340
|
+
if (!visibility.worktree || !visibility.projectDirectory) {
|
|
9341
9341
|
throw new Error(`OpenCode visibility verification failed for ${worktreePath}: ${JSON.stringify(visibility)}`);
|
|
9342
9342
|
}
|
|
9343
9343
|
return visibility;
|
|
@@ -11287,7 +11287,9 @@ async function routeClickUpWebhookEventUnlocked({ payload, config, state = {}, w
|
|
|
11287
11287
|
const sessionTitle = formatClickUpSessionTitle({ taskId, payloadTask: payload.task, task });
|
|
11288
11288
|
const existingMetadata = clickUpTaskAgentMetadata(task, config.routing.metadataFieldId);
|
|
11289
11289
|
const metadata = normalizeAgentMetadataJson(existingMetadata);
|
|
11290
|
-
const
|
|
11290
|
+
const rawExistingSessionId = getNestedMetadataValue(metadata, config.routing.metadataKey);
|
|
11291
|
+
const existingSessionId = typeof rawExistingSessionId === "string" && rawExistingSessionId.startsWith("ses_") ? rawExistingSessionId : "";
|
|
11292
|
+
if (rawExistingSessionId !== void 0 && !existingSessionId) appendClickUpWebhookLocalLog(worktree, { type: "pm_session_metadata_ignored", taskId, valueType: typeof rawExistingSessionId, reason: "not_session_id" });
|
|
11291
11293
|
const taskType = clickUpTaskType(task);
|
|
11292
11294
|
const parentTaskId = clickUpParentTaskId(task) || taskId;
|
|
11293
11295
|
const subtaskId = parentTaskId && parentTaskId !== taskId ? taskId : "";
|
|
@@ -11317,6 +11319,12 @@ async function routeClickUpWebhookEventUnlocked({ payload, config, state = {}, w
|
|
|
11317
11319
|
const prompt = formatClickUpWebhookPrompt({ eventType, taskId, payload, branch: taskRoute.branch, worktree: taskRoute.worktree, deliveryEvidencePath, humanRoleContext });
|
|
11318
11320
|
if (!existingSessionId) {
|
|
11319
11321
|
let pendingSessionId = getNestedMetadataValue(metadata, clickUpPendingSessionKey(config.routing.metadataKey)) || state.pendingSessions?.[taskId];
|
|
11322
|
+
if (pendingSessionId && !await sessionExists(openCodeClient, pendingSessionId, { directory: taskRoute.worktree })) {
|
|
11323
|
+
appendClickUpWebhookLocalLog(worktree, { type: "pending_session_stale", taskId, sessionId: pendingSessionId, worktree: taskRoute.worktree });
|
|
11324
|
+
const { [taskId]: _stalePending, ...remainingPending2 } = stateToPersist.pendingSessions || {};
|
|
11325
|
+
stateToPersist = { ...stateToPersist, pendingSessions: remainingPending2 };
|
|
11326
|
+
pendingSessionId = "";
|
|
11327
|
+
}
|
|
11320
11328
|
if (!pendingSessionId) {
|
|
11321
11329
|
try {
|
|
11322
11330
|
pendingSessionId = await createSession(openCodeClient, { title: sessionTitle, directory: taskRoute.worktree, agent: config.routing.targetAgent });
|
package/dist/sanitize_cli.js
CHANGED
|
@@ -9344,7 +9344,7 @@ async function syncOpenChamberWorktreeVisibility({ openchamberBaseUrl, opencodeB
|
|
|
9344
9344
|
gitWorktree,
|
|
9345
9345
|
projectId: project.id
|
|
9346
9346
|
};
|
|
9347
|
-
if (!visibility.worktree || !visibility.
|
|
9347
|
+
if (!visibility.worktree || !visibility.projectDirectory) {
|
|
9348
9348
|
throw new Error(`OpenCode visibility verification failed for ${worktreePath}: ${JSON.stringify(visibility)}`);
|
|
9349
9349
|
}
|
|
9350
9350
|
return visibility;
|
|
@@ -11294,7 +11294,9 @@ async function routeClickUpWebhookEventUnlocked({ payload, config, state = {}, w
|
|
|
11294
11294
|
const sessionTitle = formatClickUpSessionTitle({ taskId, payloadTask: payload.task, task });
|
|
11295
11295
|
const existingMetadata = clickUpTaskAgentMetadata(task, config.routing.metadataFieldId);
|
|
11296
11296
|
const metadata = normalizeAgentMetadataJson(existingMetadata);
|
|
11297
|
-
const
|
|
11297
|
+
const rawExistingSessionId = getNestedMetadataValue(metadata, config.routing.metadataKey);
|
|
11298
|
+
const existingSessionId = typeof rawExistingSessionId === "string" && rawExistingSessionId.startsWith("ses_") ? rawExistingSessionId : "";
|
|
11299
|
+
if (rawExistingSessionId !== void 0 && !existingSessionId) appendClickUpWebhookLocalLog(worktree, { type: "pm_session_metadata_ignored", taskId, valueType: typeof rawExistingSessionId, reason: "not_session_id" });
|
|
11298
11300
|
const taskType = clickUpTaskType(task);
|
|
11299
11301
|
const parentTaskId = clickUpParentTaskId(task) || taskId;
|
|
11300
11302
|
const subtaskId = parentTaskId && parentTaskId !== taskId ? taskId : "";
|
|
@@ -11324,6 +11326,12 @@ async function routeClickUpWebhookEventUnlocked({ payload, config, state = {}, w
|
|
|
11324
11326
|
const prompt = formatClickUpWebhookPrompt({ eventType, taskId, payload, branch: taskRoute.branch, worktree: taskRoute.worktree, deliveryEvidencePath, humanRoleContext });
|
|
11325
11327
|
if (!existingSessionId) {
|
|
11326
11328
|
let pendingSessionId = getNestedMetadataValue(metadata, clickUpPendingSessionKey(config.routing.metadataKey)) || state.pendingSessions?.[taskId];
|
|
11329
|
+
if (pendingSessionId && !await sessionExists(openCodeClient, pendingSessionId, { directory: taskRoute.worktree })) {
|
|
11330
|
+
appendClickUpWebhookLocalLog(worktree, { type: "pending_session_stale", taskId, sessionId: pendingSessionId, worktree: taskRoute.worktree });
|
|
11331
|
+
const { [taskId]: _stalePending, ...remainingPending2 } = stateToPersist.pendingSessions || {};
|
|
11332
|
+
stateToPersist = { ...stateToPersist, pendingSessions: remainingPending2 };
|
|
11333
|
+
pendingSessionId = "";
|
|
11334
|
+
}
|
|
11327
11335
|
if (!pendingSessionId) {
|
|
11328
11336
|
try {
|
|
11329
11337
|
pendingSessionId = await createSession(openCodeClient, { title: sessionTitle, directory: taskRoute.worktree, agent: config.routing.targetAgent });
|