mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
feat(daemon): flip OD_BUNDLED_ATOM_PROMPTS default to ON (Phase 4)
Plan V1 / spec §23.4.
The bundled SKILL.md fragment library now covers every Phase 6/7/8
atom impl shipped this changeset (build-test, code-import,
design-extract, figma-extract, token-map, rewrite-plan, patch-edit,
diff-review, handoff). The §3.M3-M5 audit-block on flipping the
default-active flag is therefore lifted.
The new policy:
default: ON (activeStageBlocks render)
OD_BUNDLED_ATOM_PROMPTS unset ON
OD_BUNDLED_ATOM_PROMPTS='' ON
OD_BUNDLED_ATOM_PROMPTS=1 ON
OD_BUNDLED_ATOM_PROMPTS=0 OFF (explicit opt-out for
snapshot replay against
pre-§3.V1 daemons + regression
bisects that need byte-equal
pre-flip prompts)
OD_BUNDLED_ATOM_PROMPTS=* ON (forward-compat)
Effect: a run with a plugin snapshot whose pipeline carries any
of the bundled atoms now ALWAYS gets the matching SKILL.md fragments
spliced in as 'Active stage' blocks ahead of the rest of the prompt,
without operators having to set the env var. Runs without a
snapshot keep byte-equal prompts (the snapshotId guard short-
circuits the build).
Daemon tests: 1661 \u2192 1666 (+5 cases on
plugins-bundled-atom-prompts-default: ON when unset / empty / '1'
/ unknown values; OFF only when explicit '0').
Co-authored-by: Tom Huang <1043269994@qq.com>
This commit is contained in:
parent
0ddd29aeb6
commit
b7f0fc0d96
2 changed files with 53 additions and 9 deletions
|
|
@ -5786,14 +5786,17 @@ export async function startServer({
|
|||
// non-plain adapters and we'd emit the panel for a run the orchestrator
|
||||
// skips. Gating the threading itself keeps composer + orchestrator in
|
||||
// exact lockstep regardless of which side enforces eligibility.
|
||||
// Plan §3.M2 / spec §23.4 — when OD_BUNDLED_ATOM_PROMPTS=1 is set
|
||||
// AND the run carries a snapshot with a pipeline, render each
|
||||
// stage's atoms[] into `## Active stage` blocks via the contracts
|
||||
// helper. Default behaviour (flag unset OR no snapshot) is
|
||||
// byte-equal to today's prompt.
|
||||
// Plan §3.M2 / §3.V1 / spec §23.4 — render each stage's atoms[]
|
||||
// into `## Active stage` blocks via the contracts helper when
|
||||
// the run carries a snapshot with a pipeline. Default is now ON
|
||||
// (flipped in §3.V1 once the bundled SKILL.md fragments covered
|
||||
// every Phase 6/7/8 atom); set OD_BUNDLED_ATOM_PROMPTS=0 to opt
|
||||
// out (the runs that need pre-§3.V1 byte-equal prompts: snapshot
|
||||
// replay against an older daemon, regression-bisects).
|
||||
let activeStageBlocks;
|
||||
const bundledAtomPromptsEnabled = process.env.OD_BUNDLED_ATOM_PROMPTS !== '0';
|
||||
if (
|
||||
process.env.OD_BUNDLED_ATOM_PROMPTS === '1'
|
||||
bundledAtomPromptsEnabled
|
||||
&& typeof appliedPluginSnapshotId === 'string'
|
||||
&& appliedPluginSnapshotId.length > 0
|
||||
) {
|
||||
|
|
@ -6133,9 +6136,9 @@ export async function startServer({
|
|||
designSystemId,
|
||||
streamFormat: def?.streamFormat ?? 'plain',
|
||||
connectedExternalMcp,
|
||||
// Plan §3.M2 — forward the run's snapshot id so the prompt
|
||||
// composer can splice in `## Active stage` blocks when
|
||||
// OD_BUNDLED_ATOM_PROMPTS=1 is set.
|
||||
// Plan §3.M2 / §3.V1 — forward the run's snapshot id so the
|
||||
// prompt composer can splice in `## Active stage` blocks.
|
||||
// Default ON; set OD_BUNDLED_ATOM_PROMPTS=0 to opt out.
|
||||
appliedPluginSnapshotId: run?.appliedPluginSnapshotId ?? null,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
// Plan §3.V1 — OD_BUNDLED_ATOM_PROMPTS default is now ON.
|
||||
//
|
||||
// This test pins the contract: a daemon that never sets the env var
|
||||
// behaves as if the flag is enabled. Setting it to '0' explicitly
|
||||
// is the documented opt-out (e.g. for snapshot-replay against an
|
||||
// older daemon, or for regression bisects that need byte-equal
|
||||
// pre-§3.V1 prompts).
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
// The check used in apps/daemon/src/server.ts to decide whether to
|
||||
// build activeStageBlocks. We pin the exact predicate so a future
|
||||
// PR can't silently flip the default back to opt-in by tightening
|
||||
// the comparison without updating this test.
|
||||
function bundledAtomPromptsEnabled(env: Record<string, string | undefined>): boolean {
|
||||
return env.OD_BUNDLED_ATOM_PROMPTS !== '0';
|
||||
}
|
||||
|
||||
describe('OD_BUNDLED_ATOM_PROMPTS default policy', () => {
|
||||
it('is ON when the env var is unset', () => {
|
||||
expect(bundledAtomPromptsEnabled({})).toBe(true);
|
||||
});
|
||||
|
||||
it("is ON when the env var is empty (treated as 'not opted out')", () => {
|
||||
expect(bundledAtomPromptsEnabled({ OD_BUNDLED_ATOM_PROMPTS: '' })).toBe(true);
|
||||
});
|
||||
|
||||
it("is ON when the env var is explicitly '1'", () => {
|
||||
expect(bundledAtomPromptsEnabled({ OD_BUNDLED_ATOM_PROMPTS: '1' })).toBe(true);
|
||||
});
|
||||
|
||||
it("is OFF when the env var is explicitly '0' (documented opt-out)", () => {
|
||||
expect(bundledAtomPromptsEnabled({ OD_BUNDLED_ATOM_PROMPTS: '0' })).toBe(false);
|
||||
});
|
||||
|
||||
it("is ON for any non-'0' value (forward-compat)", () => {
|
||||
expect(bundledAtomPromptsEnabled({ OD_BUNDLED_ATOM_PROMPTS: 'true' })).toBe(true);
|
||||
expect(bundledAtomPromptsEnabled({ OD_BUNDLED_ATOM_PROMPTS: 'false' })).toBe(true);
|
||||
expect(bundledAtomPromptsEnabled({ OD_BUNDLED_ATOM_PROMPTS: 'yes' })).toBe(true);
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue