@openspecui/server 9.0.3 → 11.0.0

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/dist/index.mjs +88 -2
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -13033,6 +13033,89 @@ async function mutateActiveRootConfig(input) {
13033
13033
  });
13034
13034
  }
13035
13035
 
13036
+ //#endregion
13037
+ //#region src/change-diff-evidence-service.ts
13038
+ function isShowDiffSuccess(data) {
13039
+ return Array.isArray(data.deltas);
13040
+ }
13041
+ function diagnosticDetail(data) {
13042
+ if (!data || isShowDiffSuccess(data)) return null;
13043
+ const first = data.status?.[0];
13044
+ if (!first) return null;
13045
+ return `${first.code}: ${first.message}`;
13046
+ }
13047
+ function projectDelta(delta) {
13048
+ const record = delta;
13049
+ return {
13050
+ spec: record.spec,
13051
+ operation: record.operation,
13052
+ diff: record.diff ?? null,
13053
+ warning: record.warning ?? null
13054
+ };
13055
+ }
13056
+ /** Build the display argv mirroring `withRoot(['show', id, '--json', '--diff'], selector)`. */
13057
+ function buildShowDiffCommand(changeId, store) {
13058
+ const args = [
13059
+ "show",
13060
+ changeId,
13061
+ "--json",
13062
+ "--diff"
13063
+ ];
13064
+ if (store !== void 0) args.push("--store", store);
13065
+ return `openspec ${args.join(" ")}`;
13066
+ }
13067
+ /**
13068
+ * Read the CLI MODIFIED-delta diff evidence for one change.
13069
+ *
13070
+ * The projection is separately fetched CLI evidence: the local delta parser keeps owning the
13071
+ * delta display and nothing here recomputes or backfills a diff. Sessions without the 1.11
13072
+ * `requirementDiff` capability (admitted 1.10, retired, bypassed, or unavailable CLI) and
13073
+ * sessions without a resolved planning root return a typed unavailable projection without
13074
+ * spawning any process.
13075
+ */
13076
+ async function readChangeDiffEvidence(deps, rootContext, changeId) {
13077
+ const cli = rootContext.cli;
13078
+ const detectedVersion = cli.available ? cli.version ?? null : null;
13079
+ if (!deriveOpenSpecCliCapabilities(cli.available ? parseOpenSpecCliVersion(cli.version) : null).requirementDiff) return {
13080
+ kind: "unavailable",
13081
+ reason: "capability",
13082
+ detectedVersion
13083
+ };
13084
+ if (!rootContext.planningRoot) return {
13085
+ kind: "unavailable",
13086
+ reason: "root-unavailable"
13087
+ };
13088
+ const selector = getRootContextCliSelector(rootContext);
13089
+ const gated = await deps.cliExecutor.contracts.showChangeDiff(changeId, {
13090
+ capabilities: { requirementDiff: true },
13091
+ ...selector
13092
+ });
13093
+ if (gated.kind === "unavailable") return {
13094
+ kind: "unavailable",
13095
+ reason: "capability",
13096
+ detectedVersion
13097
+ };
13098
+ const result = gated.result;
13099
+ const data = result.data;
13100
+ if (!data || !isShowDiffSuccess(data)) return {
13101
+ kind: "unavailable",
13102
+ reason: "command-failed",
13103
+ detail: diagnosticDetail(data) ?? result.contractError ?? (result.stderr.trim() || "The show --diff command failed."),
13104
+ exitCode: result.exitCode
13105
+ };
13106
+ const root = data.root;
13107
+ return {
13108
+ kind: "executed",
13109
+ deltas: data.deltas.map(projectDelta),
13110
+ provenance: {
13111
+ command: buildShowDiffCommand(changeId, selector.store),
13112
+ root: root.path,
13113
+ rootSource: root.source,
13114
+ exitCode: result.exitCode
13115
+ }
13116
+ };
13117
+ }
13118
+
13036
13119
  //#endregion
13037
13120
  //#region src/cli-mutation-invalidator.ts
13038
13121
  /** Settlement boundary shared by buffered and streaming CLI mutation execution. */
@@ -15449,6 +15532,9 @@ const changeRouter = router({
15449
15532
  getRaw: publicProcedure.input(z.object({ id: z.string() })).query(async ({ ctx, input }) => {
15450
15533
  return runPlanningRoot(ctx, ({ adapter }) => adapter.readChangeRaw(input.id));
15451
15534
  }),
15535
+ diffEvidence: publicProcedure.input(z.object({ id: z.string() })).query(async ({ ctx, input }) => {
15536
+ return runPlanningRootRead(ctx, ({ rootContext }) => readChangeDiffEvidence({ cliExecutor: ctx.cliExecutor }, rootContext, input.id));
15537
+ }),
15452
15538
  save: publicProcedure.input(z.object({
15453
15539
  id: z.string(),
15454
15540
  proposal: z.string(),
@@ -15784,7 +15870,7 @@ const cliRouter = router({
15784
15870
  const cli = rootContext.cli;
15785
15871
  if (!deriveOpenSpecCliCapabilities(cli.available ? parseOpenSpecCliVersion(cli.version) : null).archivedValidation) throw new TRPCError({
15786
15872
  code: "PRECONDITION_FAILED",
15787
- message: "Archived task validation requires the detected OpenSpec CLI to declare the 1.9 archived-validation capability."
15873
+ message: "Archived task validation requires an admitted OpenSpec CLI line (both admitted lines declare the archived-validation capability)."
15788
15874
  });
15789
15875
  }
15790
15876
  return ctx.cliExecutor.contracts.validate({
@@ -15853,7 +15939,7 @@ const cliRouter = router({
15853
15939
  })
15854
15940
  });
15855
15941
  /** Config-owned Agent registry, policy, physical inventory, and CLI mutation boundary. */
15856
- const agentIntegrationToolIdSchema = z.string().min(1).refine((toolId) => getAvailableTools().some((tool) => tool.value === toolId), "Agent tool must be an available OpenSpec 1.9 registry id.");
15942
+ const agentIntegrationToolIdSchema = z.string().min(1).refine((toolId) => getAvailableTools().some((tool) => tool.value === toolId), "Agent tool must be an available registry id on the admitted OpenSpec CLI line.");
15857
15943
  const agentIntegrationsRouter = router({
15858
15944
  get: publicProcedure.query(({ ctx }) => ctx.agentDeliveryProjectionService.getCurrent()),
15859
15945
  refresh: publicProcedure.query(({ ctx }) => ctx.agentDeliveryProjectionService.refresh()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openspecui/server",
3
- "version": "9.0.3",
3
+ "version": "11.0.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.mjs",
6
6
  "exports": {
@@ -33,8 +33,8 @@
33
33
  "@hono/node-server": "^1.14.1",
34
34
  "@huggingface/hub": "^2.12.0",
35
35
  "@lydell/node-pty": "^1.1.0",
36
- "@openspecui/core": "9.0.3",
37
- "@openspecui/search": "9.0.3",
36
+ "@openspecui/core": "11.0.0",
37
+ "@openspecui/search": "11.0.0",
38
38
  "@opentelemetry/api": "^1.9.1",
39
39
  "@opentelemetry/exporter-trace-otlp-http": "^0.221.0",
40
40
  "@opentelemetry/sdk-node": "^0.221.0",