@defend-tech/opencode-optima 0.1.27 → 0.1.29

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 CHANGED
@@ -7946,6 +7946,7 @@ var LEGACY_NOMADWORKS_DIRNAME = ".nomadworks";
7946
7946
  var LEGACY_ORBITA_DIRNAME = ".orbita";
7947
7947
  var LEGACY_STATICENG_DIRNAME = ".staticeng";
7948
7948
  var OPTIMA_GITIGNORE_RULES = [
7949
+ ".optima/",
7949
7950
  ".optima/.config/",
7950
7951
  ".optima/**/.env",
7951
7952
  ".optima/**/.env.*",
@@ -9239,14 +9240,31 @@ function appendClickUpCommentLedgerEntry(ledgerPath, entry = {}) {
9239
9240
  } catch {
9240
9241
  }
9241
9242
  }
9243
+ function stableClickUpCommentVersionMarker(value) {
9244
+ if (value === null || value === void 0 || value === "") return "";
9245
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return String(value).trim();
9246
+ if (Array.isArray(value)) {
9247
+ const parts = value.map((item) => stableClickUpCommentVersionMarker(item)).filter(Boolean);
9248
+ return parts.length ? parts.join(",") : "";
9249
+ }
9250
+ if (!isPlainObject(value)) return String(value).trim();
9251
+ if (Array.isArray(value.vector)) {
9252
+ const versions = value.vector.map((item) => stableClickUpCommentVersionMarker(item?.version ?? item?.date_updated ?? item?.updated_at ?? item?.revision)).filter(Boolean).sort();
9253
+ if (versions.length) return `vector:${versions.join(",")}`;
9254
+ }
9255
+ const direct = value.version ?? value.date_updated ?? value.updated_at ?? value.revision ?? value.modified_at;
9256
+ const directMarker = stableClickUpCommentVersionMarker(direct);
9257
+ if (directMarker) return directMarker;
9258
+ return `json:${crypto.createHash("sha256").update(JSON.stringify(value, Object.keys(value).sort())).digest("hex").slice(0, 16)}`;
9259
+ }
9242
9260
  function clickUpCommentLedgerKey({ taskId, eventType, payload }) {
9243
9261
  const history = Array.isArray(payload?.history_items) ? payload.history_items[0] : payload?.history_item;
9244
9262
  const comment = clickUpCommentFromPayload(payload);
9245
9263
  const commentId = String(comment?.id || payload?.comment_id || payload?.commentId || history?.comment_id || history?.commentId || "").trim();
9246
9264
  if (!commentId) return "";
9247
- const explicitVersion = String(
9265
+ const explicitVersion = stableClickUpCommentVersionMarker(
9248
9266
  comment?.date_updated || comment?.dateUpdated || comment?.updated_at || comment?.updatedAt || comment?._version_vector || comment?.version_vector || comment?.versionVector || comment?.version || comment?.revision || comment?.modified_at || comment?.modifiedAt || ""
9249
- ).trim();
9267
+ );
9250
9268
  const contentVersion = crypto.createHash("sha256").update(JSON.stringify({ text: clickUpCommentText(comment), parts: Array.isArray(comment.comment) ? comment.comment : null })).digest("hex").slice(0, 16);
9251
9269
  return [String(taskId || "").trim(), "comment", commentId, explicitVersion || `sha256-${contentVersion}`].filter(Boolean).join(":");
9252
9270
  }
@@ -11478,7 +11496,7 @@ Follow-up: use optima_prompt_workflow with session_id '${sessionId}' to check in
11478
11496
  }
11479
11497
  };
11480
11498
  }
11481
- OptimaPlugin.__internals = { BUNDLE_AGENTS_DIR, BUNDLE_ASSETS_DIR, CLICKUP_DEFINITION_DOC_PARENT, activeClickUpWebhookLifecycleRegistry, cleanupManagedClickUpWebhook, deleteClickUpWebhookBestEffort, BUNDLE_POLICIES_DIR, buildClickUpApplyPayloadResult, buildClickUpCreateSubtasksPayload, buildClickUpStartTaskPayload, buildClickUpSummaryPayload, buildClickUpTransitionPayload, buildOptimaAgents, clickUpCommentLedgerKey, clickUpCommentMentionsProductManager, clickUpWebhookAuditLogDir, clickUpWebhookAuditLogPath, createClickUpApiClient, ensureClickUpWebhookSubscription, handleClickUpWebhookRequest, isClickUpWebhookStateActive, normalizeClickUpWebhookConfig, normalizeClickUpWebhookLogLevel, normalizeOpenCodeBaseUrl, readClickUpCommentLedger, readClickUpWebhookState, recordClickUpCommentVersionProcessed, 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 };
11499
+ OptimaPlugin.__internals = { BUNDLE_AGENTS_DIR, BUNDLE_ASSETS_DIR, CLICKUP_DEFINITION_DOC_PARENT, activeClickUpWebhookLifecycleRegistry, cleanupManagedClickUpWebhook, deleteClickUpWebhookBestEffort, BUNDLE_POLICIES_DIR, buildClickUpApplyPayloadResult, buildClickUpCreateSubtasksPayload, buildClickUpStartTaskPayload, buildClickUpSummaryPayload, buildClickUpTransitionPayload, buildOptimaAgents, clickUpCommentLedgerKey, clickUpCommentMentionsProductManager, clickUpWebhookAuditLogDir, clickUpWebhookAuditLogPath, createClickUpApiClient, ensureClickUpWebhookSubscription, handleClickUpWebhookRequest, isClickUpWebhookStateActive, normalizeClickUpWebhookConfig, normalizeClickUpWebhookLogLevel, normalizeOpenCodeBaseUrl, readClickUpCommentLedger, readClickUpWebhookState, recordClickUpCommentVersionProcessed, resolveOptimaPluginOptions, resolveSecretReference, routeClickUpWebhookEvent, sendOpenCodeSessionEvent, sendOpenCodeSessionEventDirect, stableClickUpCommentVersionMarker, 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 };
11482
11500
  export {
11483
11501
  OptimaPlugin as default
11484
11502
  };
@@ -7953,6 +7953,7 @@ var LEGACY_NOMADWORKS_DIRNAME = ".nomadworks";
7953
7953
  var LEGACY_ORBITA_DIRNAME = ".orbita";
7954
7954
  var LEGACY_STATICENG_DIRNAME = ".staticeng";
7955
7955
  var OPTIMA_GITIGNORE_RULES = [
7956
+ ".optima/",
7956
7957
  ".optima/.config/",
7957
7958
  ".optima/**/.env",
7958
7959
  ".optima/**/.env.*",
@@ -9246,14 +9247,31 @@ function appendClickUpCommentLedgerEntry(ledgerPath, entry = {}) {
9246
9247
  } catch {
9247
9248
  }
9248
9249
  }
9250
+ function stableClickUpCommentVersionMarker(value) {
9251
+ if (value === null || value === void 0 || value === "") return "";
9252
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return String(value).trim();
9253
+ if (Array.isArray(value)) {
9254
+ const parts = value.map((item) => stableClickUpCommentVersionMarker(item)).filter(Boolean);
9255
+ return parts.length ? parts.join(",") : "";
9256
+ }
9257
+ if (!isPlainObject(value)) return String(value).trim();
9258
+ if (Array.isArray(value.vector)) {
9259
+ const versions = value.vector.map((item) => stableClickUpCommentVersionMarker(item?.version ?? item?.date_updated ?? item?.updated_at ?? item?.revision)).filter(Boolean).sort();
9260
+ if (versions.length) return `vector:${versions.join(",")}`;
9261
+ }
9262
+ const direct = value.version ?? value.date_updated ?? value.updated_at ?? value.revision ?? value.modified_at;
9263
+ const directMarker = stableClickUpCommentVersionMarker(direct);
9264
+ if (directMarker) return directMarker;
9265
+ return `json:${crypto.createHash("sha256").update(JSON.stringify(value, Object.keys(value).sort())).digest("hex").slice(0, 16)}`;
9266
+ }
9249
9267
  function clickUpCommentLedgerKey({ taskId, eventType, payload }) {
9250
9268
  const history = Array.isArray(payload?.history_items) ? payload.history_items[0] : payload?.history_item;
9251
9269
  const comment = clickUpCommentFromPayload(payload);
9252
9270
  const commentId = String(comment?.id || payload?.comment_id || payload?.commentId || history?.comment_id || history?.commentId || "").trim();
9253
9271
  if (!commentId) return "";
9254
- const explicitVersion = String(
9272
+ const explicitVersion = stableClickUpCommentVersionMarker(
9255
9273
  comment?.date_updated || comment?.dateUpdated || comment?.updated_at || comment?.updatedAt || comment?._version_vector || comment?.version_vector || comment?.versionVector || comment?.version || comment?.revision || comment?.modified_at || comment?.modifiedAt || ""
9256
- ).trim();
9274
+ );
9257
9275
  const contentVersion = crypto.createHash("sha256").update(JSON.stringify({ text: clickUpCommentText(comment), parts: Array.isArray(comment.comment) ? comment.comment : null })).digest("hex").slice(0, 16);
9258
9276
  return [String(taskId || "").trim(), "comment", commentId, explicitVersion || `sha256-${contentVersion}`].filter(Boolean).join(":");
9259
9277
  }
@@ -11485,7 +11503,7 @@ Follow-up: use optima_prompt_workflow with session_id '${sessionId}' to check in
11485
11503
  }
11486
11504
  };
11487
11505
  }
11488
- OptimaPlugin.__internals = { BUNDLE_AGENTS_DIR, BUNDLE_ASSETS_DIR, CLICKUP_DEFINITION_DOC_PARENT, activeClickUpWebhookLifecycleRegistry, cleanupManagedClickUpWebhook, deleteClickUpWebhookBestEffort, BUNDLE_POLICIES_DIR, buildClickUpApplyPayloadResult, buildClickUpCreateSubtasksPayload, buildClickUpStartTaskPayload, buildClickUpSummaryPayload, buildClickUpTransitionPayload, buildOptimaAgents, clickUpCommentLedgerKey, clickUpCommentMentionsProductManager, clickUpWebhookAuditLogDir, clickUpWebhookAuditLogPath, createClickUpApiClient, ensureClickUpWebhookSubscription, handleClickUpWebhookRequest, isClickUpWebhookStateActive, normalizeClickUpWebhookConfig, normalizeClickUpWebhookLogLevel, normalizeOpenCodeBaseUrl, readClickUpCommentLedger, readClickUpWebhookState, recordClickUpCommentVersionProcessed, 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 };
11506
+ OptimaPlugin.__internals = { BUNDLE_AGENTS_DIR, BUNDLE_ASSETS_DIR, CLICKUP_DEFINITION_DOC_PARENT, activeClickUpWebhookLifecycleRegistry, cleanupManagedClickUpWebhook, deleteClickUpWebhookBestEffort, BUNDLE_POLICIES_DIR, buildClickUpApplyPayloadResult, buildClickUpCreateSubtasksPayload, buildClickUpStartTaskPayload, buildClickUpSummaryPayload, buildClickUpTransitionPayload, buildOptimaAgents, clickUpCommentLedgerKey, clickUpCommentMentionsProductManager, clickUpWebhookAuditLogDir, clickUpWebhookAuditLogPath, createClickUpApiClient, ensureClickUpWebhookSubscription, handleClickUpWebhookRequest, isClickUpWebhookStateActive, normalizeClickUpWebhookConfig, normalizeClickUpWebhookLogLevel, normalizeOpenCodeBaseUrl, readClickUpCommentLedger, readClickUpWebhookState, recordClickUpCommentVersionProcessed, resolveOptimaPluginOptions, resolveSecretReference, routeClickUpWebhookEvent, sendOpenCodeSessionEvent, sendOpenCodeSessionEventDirect, stableClickUpCommentVersionMarker, 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 };
11489
11507
 
11490
11508
  // src/sanitize_cli.js
11491
11509
  var { migrateLegacyOptimaLayout: migrateLegacyOptimaLayout2 } = OptimaPlugin.__internals;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defend-tech/opencode-optima",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@github.com/defend-tech/opencode-optima.git"