opencode-wait-a-minute 1.1.0-rc.10 → 1.1.0-rc.9

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.
Files changed (2) hide show
  1. package/index.js +57 -57
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -606,63 +606,6 @@ const WaitAMinutePlugin = async (pluginInput) => {
606
606
  return root;
607
607
  };
608
608
 
609
- /**
610
- * Runs after tool.execute.before — persists success/failure to the
611
- * cognition store via noteSuccess/noteFailure, reading experiment IDs
612
- * from the sessionExecutions map (or input._wam* overrides) instead of
613
- * input.hypothesisId which is never set by tool.execute.before.
614
- */
615
- async function postToolExecution(input, output) {
616
- const toolName = input?.tool || "";
617
- try {
618
- if (bypassed) return;
619
- const sid = input?.sessionID;
620
- const taskRoot = await resolveSessionBase(sid);
621
- const taskId = sessionTasks.get(sid) || readActiveTaskIdFresh(taskRoot) || "default-task";
622
- const wamRoot = taskRoot;
623
- const key = input._wamCallID || input?.callID || `${sid}:${toolName}`;
624
- const mapping = sessionExecutions.get(key) || {};
625
-
626
- if (input?.tool && output?.error) {
627
- try {
628
- await noteFailure(wamRoot, taskId, {
629
- hypothesisId: input._wamHypothesisId || mapping.hypothesisId || input.hypothesisId,
630
- experimentId: input._wamExperimentId || mapping.experimentId || input.experimentId,
631
- requirementId: input._wamRequirementId || mapping.requirementId || input.requirementId,
632
- reason: output.error || "tool execution failed",
633
- actual: output.actual,
634
- unexpected: output.unexpected,
635
- provenance: `agent-tool-${toolName}-failure`,
636
- });
637
- } catch (e) {
638
- console.log(`[wait-a-minute] postToolExecution noteFailure error:`, e.message);
639
- }
640
- } else if (input?.tool) {
641
- try {
642
- await noteSuccess(wamRoot, taskId, {
643
- hypothesisId: input._wamHypothesisId || mapping.hypothesisId || input.hypothesisId,
644
- experimentId: input._wamExperimentId || mapping.experimentId || input.experimentId,
645
- requirementId: input._wamRequirementId || mapping.requirementId || input.requirementId,
646
- result: output.result,
647
- actual: output.actual,
648
- unexpected: output.unexpected,
649
- provenance: `agent-tool-${toolName}-success`,
650
- });
651
- } catch (e) {
652
- console.log(`[wait-a-minute] postToolExecution noteSuccess error:`, e.message);
653
- }
654
- }
655
- } catch (err) {
656
- console.error("[wait-a-minute] postToolExecution error:", err);
657
- } finally {
658
- const cleanupKey = input._wamCallID || input?.callID || `${input?.sessionID}:${toolName}`;
659
- if (cleanupKey && cleanupKey !== `${input?.sessionID}:${toolName}`) {
660
- sessionExecutions.delete(cleanupKey);
661
- }
662
- }
663
- }
664
-
665
-
666
609
  // -------------------------------------------------------------------------
667
610
  // opencode 1.18.25 plugin API: factory RETURNS the hooks object
668
611
  // -------------------------------------------------------------------------
@@ -880,6 +823,63 @@ async function postToolExecution(input, output) {
880
823
  };
881
824
  };
882
825
 
826
+ /**
827
+ * Runs after tool.execute.before — persists success/failure to the
828
+ * cognition store via noteSuccess/noteFailure, reading experiment IDs
829
+ * from the sessionExecutions map (or input._wam* overrides) instead of
830
+ * input.hypothesisId which is never set by tool.execute.before.
831
+ */
832
+ async function postToolExecution(input, output) {
833
+ try {
834
+ if (bypassed) return;
835
+ const sid = input?.sessionID;
836
+ const taskRoot = await resolveSessionBase(sid);
837
+ const taskId = sessionTasks.get(sid) || readActiveTaskIdFresh(taskRoot) || "default-task";
838
+ const wamRoot = taskRoot;
839
+ const toolName = input?.tool || "";
840
+ const key = input._wamCallID || input?.callID || `${sid}:${toolName}`;
841
+ const mapping = sessionExecutions.get(key) || {};
842
+
843
+ if (input?.tool && output?.error) {
844
+ try {
845
+ await noteFailure(wamRoot, taskId, {
846
+ hypothesisId: input._wamHypothesisId || mapping.hypothesisId || input.hypothesisId,
847
+ experimentId: input._wamExperimentId || mapping.experimentId || input.experimentId,
848
+ requirementId: input._wamRequirementId || mapping.requirementId || input.requirementId,
849
+ reason: output.error || "tool execution failed",
850
+ actual: output.actual,
851
+ unexpected: output.unexpected,
852
+ provenance: `agent-tool-${toolName}-failure`,
853
+ });
854
+ } catch (e) {
855
+ console.log(`[wait-a-minute] postToolExecution noteFailure error:`, e.message);
856
+ }
857
+ } else if (input?.tool) {
858
+ try {
859
+ await noteSuccess(wamRoot, taskId, {
860
+ hypothesisId: input._wamHypothesisId || mapping.hypothesisId || input.hypothesisId,
861
+ experimentId: input._wamExperimentId || mapping.experimentId || input.experimentId,
862
+ requirementId: input._wamRequirementId || mapping.requirementId || input.requirementId,
863
+ result: output.result,
864
+ actual: output.actual,
865
+ unexpected: output.unexpected,
866
+ provenance: `agent-tool-${toolName}-success`,
867
+ });
868
+ } catch (e) {
869
+ console.log(`[wait-a-minute] postToolExecution noteSuccess error:`, e.message);
870
+ }
871
+ }
872
+ } catch (err) {
873
+ console.error("[wait-a-minute] postToolExecution error:", err);
874
+ } finally {
875
+ const cleanupKey = input._wamCallID || input?.callID || `${input?.sessionID}:${toolName}`;
876
+ if (cleanupKey && cleanupKey !== `${input?.sessionID}:${toolName}`) {
877
+ sessionExecutions.delete(cleanupKey);
878
+ }
879
+ }
880
+ }
881
+
882
+
883
883
  /**
884
884
  * Clasifica un mensaje recibido durante ASKING (spec clarification-gate):
885
885
  * "answer" (respuesta natural), "implementation" (intento de implementar →
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencode-wait-a-minute",
3
3
  "description": "WAM keeps more state than it sends: deterministic task-state, context reconstruction, and evidence-backed completion for OpenCode agents.",
4
- "version": "1.1.0-rc.10",
4
+ "version": "1.1.0-rc.9",
5
5
  "main": "index.js",
6
6
  "engines": {
7
7
  "node": ">=20"