opencode-plugin-flow 5.1.1 → 5.2.1

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.
@@ -1,9 +1,10 @@
1
1
  import { type FlowResponse, type FlowService } from "../../application/flow-service.js";
2
2
  export declare function createWorkspaceFlowService(workspace: string): FlowService;
3
- export declare function flowStatus(workspace: string, input?: unknown): Promise<FlowResponse>;
3
+ export declare function flowStatus(workspace: string, input: unknown): Promise<FlowResponse>;
4
4
  export declare function flowPlanSave(workspace: string, input: unknown): Promise<FlowResponse>;
5
5
  export declare function flowPlanApprove(workspace: string): Promise<FlowResponse>;
6
6
  export declare function flowRunStart(workspace: string, input: unknown): Promise<FlowResponse>;
7
7
  export declare function flowFeatureComplete(workspace: string, input: unknown): Promise<FlowResponse>;
8
+ export declare function flowReviewStart(workspace: string, input: unknown): Promise<FlowResponse>;
8
9
  export declare function flowFeatureReset(workspace: string, input: unknown): Promise<FlowResponse>;
9
10
  export declare function flowSessionClose(workspace: string, input: unknown): Promise<FlowResponse>;
@@ -11,6 +11,10 @@ export declare class ArchiveCollisionError extends Error {
11
11
  readonly code = "FLOW_ARCHIVE_COLLISION";
12
12
  constructor(message: string, options?: ErrorOptions);
13
13
  }
14
+ export declare class UnclosedSessionArchiveError extends Error {
15
+ readonly code = "FLOW_ARCHIVE_REQUIRES_CLOSURE";
16
+ constructor(message: string);
17
+ }
14
18
  export declare function normalizeWorkspaceRoot(rawPath: string | undefined): string | null;
15
19
  export declare function assertMutableWorkspaceRoot(rawPath: string): string;
16
20
  export declare function resolveWorkspaceRoot(context: {
@@ -20,14 +24,40 @@ export declare function resolveWorkspaceRoot(context: {
20
24
  export declare function flowDir(worktree: string): string;
21
25
  export declare function sessionPath(worktree: string): string;
22
26
  export declare function historyDir(worktree: string): string;
27
+ /**
28
+ * Map the exact, case-sensitive session identity into a portable lowercase
29
+ * archive component. The fixed digest avoids both case-fold collisions and
30
+ * filesystem component growth while lookup still verifies the parsed id.
31
+ */
32
+ export declare function archivedSessionFilename(sessionId: string): string;
23
33
  export declare function archivedSessionPath(worktree: string, sessionId: string): string;
34
+ type ArchiveAndClearTestHooks = {
35
+ afterHistoryPinned?: (() => Promise<void>) | undefined;
36
+ afterFlowPinnedBeforeDelete?: (() => Promise<void>) | undefined;
37
+ pinnedHelperTestExecutable?: string | undefined;
38
+ pinnedHelperTestRuntime?: "node" | "bun" | "electron" | undefined;
39
+ pinnedHelperReadyTimeoutMs?: number | undefined;
40
+ pinnedHelperCompletionTimeoutMs?: number | undefined;
41
+ };
24
42
  export type SessionLockOptions = {
25
43
  timeoutMs?: number;
26
44
  };
27
45
  export declare function withSessionLock<T>(worktree: string, task: () => Promise<T>, lockOptions?: SessionLockOptions): Promise<T>;
28
46
  export declare function loadSession(worktree: string): Promise<Session | null>;
47
+ /**
48
+ * Find any canonical archive containing an operation id. Close-start preflight
49
+ * uses this wider lookup because a retry handle must not collide with any
50
+ * historical mutation identity.
51
+ */
29
52
  export declare function findArchivedSessionByOperationId(worktree: string, operationId: string): Promise<Session | null>;
30
- export declare function quarantineUnreadableSession(worktree: string): Promise<string | null>;
53
+ /**
54
+ * Recover only the archive whose accepted closure owns this retry handle.
55
+ * A later session may reuse the same text for a non-close mutation without
56
+ * making the original accepted close ambiguous.
57
+ */
58
+ export declare function findArchivedSessionByCloseRetryOperationId(worktree: string, operationId: string): Promise<Session | null>;
59
+ export declare function quarantineUnreadableSession(worktree: string, hooks?: ArchiveAndClearTestHooks): Promise<string | null>;
31
60
  export declare function saveSession(worktree: string, session: Session): Promise<Session>;
32
- export declare function archiveAndClearSession(worktree: string, session: Session): Promise<void>;
61
+ export declare function archiveAndClearSession(worktree: string, session: Session, hooks?: ArchiveAndClearTestHooks): Promise<void>;
33
62
  export declare function ensureFlowGitignore(worktree: string): Promise<void>;
63
+ export {};
@@ -1,6 +1,4 @@
1
1
  import { type Hooks } from "@opencode-ai/plugin";
2
- export type FlowHostInputOperation = "status" | "planSave" | "runStart" | "featureComplete" | "featureReset" | "sessionClose";
3
- export declare function acceptsFlowHostInput(operation: FlowHostInputOperation, input: unknown): boolean;
4
2
  type FlowTools = NonNullable<Hooks["tool"]>;
5
3
  export declare function createTools(ctx: unknown): FlowTools;
6
4
  export {};
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Frozen historical prompt assembly used only for comparative evaluation.
2
+ * Frozen comparison prompt assembly used only for compiler-shape evaluation.
3
3
  *
4
4
  * These strings capture the pre-compiler public startup and hidden-worker
5
- * prompts. They are not production prompt sources and must never be selected by
6
- * the default compiled Flow surfaces. Keep the exception explicit so manual
5
+ * topology while retaining the current Session v4 lifecycle and nested wire
6
+ * contract. They are not production prompt sources and must never be selected
7
+ * by the default compiled Flow surfaces. Keep the exception explicit so manual
7
8
  * baseline text cannot be mistaken for a maintained projection of skill rules.
8
9
  */
9
10
  export declare const LEGACY_PROMPT_BASELINE: Readonly<{
@@ -44,6 +44,13 @@ export type PromptRepetitionClassification = {
44
44
  occurrences: string[];
45
45
  rationale: string;
46
46
  };
47
+ export type LifecycleFlatRequestExample = {
48
+ tool: "flow_status" | "flow_review_start" | "flow_feature_complete" | "flow_session_close";
49
+ line: number;
50
+ topLevelField: string | null;
51
+ };
52
+ /** Finds lifecycle-tool examples that bypass the required `request` envelope. */
53
+ export declare function auditLifecycleFlatRequestExamples(text: string): LifecycleFlatRequestExample[];
47
54
  export declare function measurePromptText(options: {
48
55
  surface: string;
49
56
  variant: FlowPromptVariant | "runtime";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-plugin-flow",
3
- "version": "5.1.1",
3
+ "version": "5.2.1",
4
4
  "description": "Stateful planning and execution workflow plugin for OpenCode",
5
5
  "type": "module",
6
6
  "repository": {
@@ -39,6 +39,10 @@
39
39
  "package:smoke": "bun test tests/package-smoke.test.ts",
40
40
  "release:monitor": "node scripts/release-monitor.mjs",
41
41
  "smoke:live": "FLOW_LIVE_SMOKE=1 bun test tests/live-opencode-smoke.test.ts",
42
+ "test:lifecycle:invariants": "bun test tests/review-lifecycle-coverage-map.test.ts tests/lifecycle-invariant-sequences.test.ts tests/lifecycle-invariant-v4-only.test.ts",
43
+ "test:lifecycle:recovery": "bun test tests/lifecycle-invariant-recovery.test.ts",
44
+ "test:contracts": "bun test tests/lifecycle-invariant-contracts.test.ts tests/opencode-schema-contract.test.ts",
45
+ "verify:lifecycle": "bun run test:lifecycle:invariants && bun run test:lifecycle:recovery && bun run test:contracts",
42
46
  "test": "bun test tests",
43
47
  "typecheck": "tsc --noEmit",
44
48
  "check": "bun run typecheck && bun run lint && bun run prompt:quality && bun run build && bun run test"