@defend-tech/opencode-optima 0.1.45 → 0.1.47
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 +15 -14
- package/dist/sanitize_cli.js +15 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9565,10 +9565,10 @@ function clearClickUpPendingSessionMetadata(metadata, metadataKey) {
|
|
|
9565
9565
|
}
|
|
9566
9566
|
async function openCodeSessionExists(client, sessionId) {
|
|
9567
9567
|
const getAttempts = [
|
|
9568
|
-
{
|
|
9569
|
-
{ id: sessionId },
|
|
9568
|
+
{ path: { id: sessionId } },
|
|
9570
9569
|
{ path: { sessionID: sessionId } },
|
|
9571
|
-
{
|
|
9570
|
+
{ sessionID: sessionId },
|
|
9571
|
+
{ id: sessionId }
|
|
9572
9572
|
];
|
|
9573
9573
|
if (typeof client?.session?.get === "function") {
|
|
9574
9574
|
for (const attempt of getAttempts) {
|
|
@@ -9580,10 +9580,10 @@ async function openCodeSessionExists(client, sessionId) {
|
|
|
9580
9580
|
}
|
|
9581
9581
|
}
|
|
9582
9582
|
const messageAttempts = [
|
|
9583
|
-
{
|
|
9584
|
-
{ id: sessionId, limit: 1 },
|
|
9583
|
+
{ path: { id: sessionId }, query: { limit: 1 } },
|
|
9585
9584
|
{ path: { sessionID: sessionId }, query: { limit: 1 } },
|
|
9586
|
-
{
|
|
9585
|
+
{ sessionID: sessionId, limit: 1 },
|
|
9586
|
+
{ id: sessionId, limit: 1 }
|
|
9587
9587
|
];
|
|
9588
9588
|
if (typeof client?.session?.messages === "function") {
|
|
9589
9589
|
for (const attempt of messageAttempts) {
|
|
@@ -9605,7 +9605,7 @@ async function createOpenCodeSession(client, { title, directory, agent } = {}) {
|
|
|
9605
9605
|
if (agent) flatPayload.agent = agent;
|
|
9606
9606
|
const body = { title };
|
|
9607
9607
|
if (agent) body.agent = agent;
|
|
9608
|
-
const attempts = [
|
|
9608
|
+
const attempts = [{ query: { directory }, body }, flatPayload];
|
|
9609
9609
|
let firstError = null;
|
|
9610
9610
|
for (const attempt of attempts) {
|
|
9611
9611
|
try {
|
|
@@ -9700,10 +9700,10 @@ async function sendOpenCodeSessionEventDirect({ baseUrl, sessionId, text, agent,
|
|
|
9700
9700
|
}
|
|
9701
9701
|
async function callOpenCodePromptWithFallbacks(method, sessionId, flatPayload, structuredPayload) {
|
|
9702
9702
|
const attempts = [
|
|
9703
|
-
{ sessionID: sessionId, ...flatPayload },
|
|
9704
|
-
{ id: sessionId, ...flatPayload },
|
|
9705
9703
|
{ ...structuredPayload, path: { id: sessionId } },
|
|
9706
|
-
{ ...structuredPayload, path: { sessionID: sessionId } }
|
|
9704
|
+
{ ...structuredPayload, path: { sessionID: sessionId } },
|
|
9705
|
+
{ sessionID: sessionId, ...flatPayload },
|
|
9706
|
+
{ id: sessionId, ...flatPayload }
|
|
9707
9707
|
];
|
|
9708
9708
|
let firstError = null;
|
|
9709
9709
|
for (const attempt of attempts) {
|
|
@@ -9753,10 +9753,10 @@ function normalizeOpenCodeSessionMessages(result) {
|
|
|
9753
9753
|
async function readOpenCodeSessionMessages(client, { sessionId, limit = 20 } = {}) {
|
|
9754
9754
|
if (typeof client?.session?.messages !== "function") return null;
|
|
9755
9755
|
const attempts = [
|
|
9756
|
-
{ sessionID: sessionId, limit },
|
|
9757
|
-
{ id: sessionId, limit },
|
|
9758
9756
|
{ path: { id: sessionId }, query: { limit } },
|
|
9759
|
-
{ path: { sessionID: sessionId }, query: { limit } }
|
|
9757
|
+
{ path: { sessionID: sessionId }, query: { limit } },
|
|
9758
|
+
{ sessionID: sessionId, limit },
|
|
9759
|
+
{ id: sessionId, limit }
|
|
9760
9760
|
];
|
|
9761
9761
|
let firstError = null;
|
|
9762
9762
|
for (const attempt of attempts) {
|
|
@@ -10077,7 +10077,8 @@ async function withClickUpTaskRouteLock(taskId, operation) {
|
|
|
10077
10077
|
async function routeClickUpWebhookEventUnlocked({ payload, config, state = {}, worktree = process.cwd(), clickupClient, openCodeClient, sessionExists = openCodeSessionExists, createSession = createOpenCodeSession, sendSessionEvent = sendOpenCodeSessionEvent, ensureTaskWorktree = ensureClickUpTaskWorktree, verifySessionEventDelivery = verifyOpenCodeSessionEventDelivery, saveState = null, now = () => /* @__PURE__ */ new Date(), host = os.hostname(), commentLedgerPath = clickUpCommentLedgerPath(worktree) } = {}) {
|
|
10078
10078
|
const eventType = clickUpEventType(payload);
|
|
10079
10079
|
const eventKey = clickUpWebhookEventKey(payload);
|
|
10080
|
-
const
|
|
10080
|
+
const isStartupAssignmentReconciliation = payload?.startup_reconciliation === true && eventType === "taskAssigneeUpdated";
|
|
10081
|
+
const remembered = isStartupAssignmentReconciliation ? { duplicate: false, state } : rememberClickUpWebhookEvent(state, eventKey);
|
|
10081
10082
|
if (remembered.duplicate) return { ok: true, action: "ignored", reason: "duplicate", eventKey };
|
|
10082
10083
|
let stateToPersist = remembered.state;
|
|
10083
10084
|
let commentLedgerKey = "";
|
package/dist/sanitize_cli.js
CHANGED
|
@@ -9572,10 +9572,10 @@ function clearClickUpPendingSessionMetadata(metadata, metadataKey) {
|
|
|
9572
9572
|
}
|
|
9573
9573
|
async function openCodeSessionExists(client, sessionId) {
|
|
9574
9574
|
const getAttempts = [
|
|
9575
|
-
{
|
|
9576
|
-
{ id: sessionId },
|
|
9575
|
+
{ path: { id: sessionId } },
|
|
9577
9576
|
{ path: { sessionID: sessionId } },
|
|
9578
|
-
{
|
|
9577
|
+
{ sessionID: sessionId },
|
|
9578
|
+
{ id: sessionId }
|
|
9579
9579
|
];
|
|
9580
9580
|
if (typeof client?.session?.get === "function") {
|
|
9581
9581
|
for (const attempt of getAttempts) {
|
|
@@ -9587,10 +9587,10 @@ async function openCodeSessionExists(client, sessionId) {
|
|
|
9587
9587
|
}
|
|
9588
9588
|
}
|
|
9589
9589
|
const messageAttempts = [
|
|
9590
|
-
{
|
|
9591
|
-
{ id: sessionId, limit: 1 },
|
|
9590
|
+
{ path: { id: sessionId }, query: { limit: 1 } },
|
|
9592
9591
|
{ path: { sessionID: sessionId }, query: { limit: 1 } },
|
|
9593
|
-
{
|
|
9592
|
+
{ sessionID: sessionId, limit: 1 },
|
|
9593
|
+
{ id: sessionId, limit: 1 }
|
|
9594
9594
|
];
|
|
9595
9595
|
if (typeof client?.session?.messages === "function") {
|
|
9596
9596
|
for (const attempt of messageAttempts) {
|
|
@@ -9612,7 +9612,7 @@ async function createOpenCodeSession(client, { title, directory, agent } = {}) {
|
|
|
9612
9612
|
if (agent) flatPayload.agent = agent;
|
|
9613
9613
|
const body = { title };
|
|
9614
9614
|
if (agent) body.agent = agent;
|
|
9615
|
-
const attempts = [
|
|
9615
|
+
const attempts = [{ query: { directory }, body }, flatPayload];
|
|
9616
9616
|
let firstError = null;
|
|
9617
9617
|
for (const attempt of attempts) {
|
|
9618
9618
|
try {
|
|
@@ -9707,10 +9707,10 @@ async function sendOpenCodeSessionEventDirect({ baseUrl, sessionId, text, agent,
|
|
|
9707
9707
|
}
|
|
9708
9708
|
async function callOpenCodePromptWithFallbacks(method, sessionId, flatPayload, structuredPayload) {
|
|
9709
9709
|
const attempts = [
|
|
9710
|
-
{ sessionID: sessionId, ...flatPayload },
|
|
9711
|
-
{ id: sessionId, ...flatPayload },
|
|
9712
9710
|
{ ...structuredPayload, path: { id: sessionId } },
|
|
9713
|
-
{ ...structuredPayload, path: { sessionID: sessionId } }
|
|
9711
|
+
{ ...structuredPayload, path: { sessionID: sessionId } },
|
|
9712
|
+
{ sessionID: sessionId, ...flatPayload },
|
|
9713
|
+
{ id: sessionId, ...flatPayload }
|
|
9714
9714
|
];
|
|
9715
9715
|
let firstError = null;
|
|
9716
9716
|
for (const attempt of attempts) {
|
|
@@ -9760,10 +9760,10 @@ function normalizeOpenCodeSessionMessages(result) {
|
|
|
9760
9760
|
async function readOpenCodeSessionMessages(client, { sessionId, limit = 20 } = {}) {
|
|
9761
9761
|
if (typeof client?.session?.messages !== "function") return null;
|
|
9762
9762
|
const attempts = [
|
|
9763
|
-
{ sessionID: sessionId, limit },
|
|
9764
|
-
{ id: sessionId, limit },
|
|
9765
9763
|
{ path: { id: sessionId }, query: { limit } },
|
|
9766
|
-
{ path: { sessionID: sessionId }, query: { limit } }
|
|
9764
|
+
{ path: { sessionID: sessionId }, query: { limit } },
|
|
9765
|
+
{ sessionID: sessionId, limit },
|
|
9766
|
+
{ id: sessionId, limit }
|
|
9767
9767
|
];
|
|
9768
9768
|
let firstError = null;
|
|
9769
9769
|
for (const attempt of attempts) {
|
|
@@ -10084,7 +10084,8 @@ async function withClickUpTaskRouteLock(taskId, operation) {
|
|
|
10084
10084
|
async function routeClickUpWebhookEventUnlocked({ payload, config, state = {}, worktree = process.cwd(), clickupClient, openCodeClient, sessionExists = openCodeSessionExists, createSession = createOpenCodeSession, sendSessionEvent = sendOpenCodeSessionEvent, ensureTaskWorktree = ensureClickUpTaskWorktree, verifySessionEventDelivery = verifyOpenCodeSessionEventDelivery, saveState = null, now = () => /* @__PURE__ */ new Date(), host = os.hostname(), commentLedgerPath = clickUpCommentLedgerPath(worktree) } = {}) {
|
|
10085
10085
|
const eventType = clickUpEventType(payload);
|
|
10086
10086
|
const eventKey = clickUpWebhookEventKey(payload);
|
|
10087
|
-
const
|
|
10087
|
+
const isStartupAssignmentReconciliation = payload?.startup_reconciliation === true && eventType === "taskAssigneeUpdated";
|
|
10088
|
+
const remembered = isStartupAssignmentReconciliation ? { duplicate: false, state } : rememberClickUpWebhookEvent(state, eventKey);
|
|
10088
10089
|
if (remembered.duplicate) return { ok: true, action: "ignored", reason: "duplicate", eventKey };
|
|
10089
10090
|
let stateToPersist = remembered.state;
|
|
10090
10091
|
let commentLedgerKey = "";
|