@crewhaus/ir 0.1.1 → 0.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewhaus/ir",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "Canonical typed intermediate representation",
6
6
  "main": "src/index.ts",
@@ -14,8 +14,8 @@
14
14
  "license": "Apache-2.0",
15
15
  "author": {
16
16
  "name": "Max Meier",
17
- "email": "max@studiomax.io",
18
- "url": "https://studiomax.io"
17
+ "email": "max@crewhaus.ai",
18
+ "url": "https://crewhaus.ai"
19
19
  },
20
20
  "repository": {
21
21
  "type": "git",
@@ -27,12 +27,7 @@
27
27
  "url": "https://github.com/crewhaus/factory/issues"
28
28
  },
29
29
  "publishConfig": {
30
- "access": "restricted"
30
+ "access": "public"
31
31
  },
32
- "files": [
33
- "src",
34
- "README.md",
35
- "LICENSE",
36
- "NOTICE"
37
- ]
32
+ "files": ["src", "README.md", "LICENSE", "NOTICE"]
38
33
  }
package/src/index.test.ts CHANGED
@@ -27,6 +27,7 @@ import type {
27
27
  IrSubAgentDefinition,
28
28
  IrToolConfigs,
29
29
  IrV0,
30
+ IrVectorBackend,
30
31
  IrVoiceProvider,
31
32
  IrVoiceV0,
32
33
  IrWorkflowStep,
@@ -649,15 +650,41 @@ describe("IrPipelineV0 (Section 21)", () => {
649
650
  void _bad;
650
651
  });
651
652
 
652
- test("vectorBackend is restricted to in-memory in v0", () => {
653
+ test("vectorBackend accepts every implemented backend id", () => {
654
+ const backends: IrVectorBackend[] = ["in-memory", "lance", "qdrant", "pinecone", "weaviate"];
655
+ for (const vectorBackend of backends) {
656
+ const retrieve: IrPipelineV0["retrieve"] = {
657
+ embedderModel: "x",
658
+ vectorBackend,
659
+ defaultK: 5,
660
+ };
661
+ expect(retrieve.vectorBackend).toBe(vectorBackend);
662
+ }
663
+ });
664
+
665
+ test("vectorBackend still rejects an unknown backend id", () => {
653
666
  const _bad: IrPipelineV0["retrieve"] = {
654
667
  embedderModel: "x",
655
- // @ts-expect-error — qdrant/pinecone/lance are roadmap, not yet in v0
656
- vectorBackend: "qdrant",
668
+ // @ts-expect-error — faiss is not an implemented vector backend
669
+ vectorBackend: "faiss",
657
670
  defaultK: 5,
658
671
  };
659
672
  void _bad;
660
673
  });
674
+
675
+ test("retrieve carries optional url/collection/apiKey for remote backends", () => {
676
+ const retrieve: IrPipelineV0["retrieve"] = {
677
+ embedderModel: "x",
678
+ vectorBackend: "qdrant",
679
+ defaultK: 5,
680
+ url: "https://qdrant.example",
681
+ collection: "docs",
682
+ apiKey: { kind: "env", name: "QDRANT_API_KEY" },
683
+ };
684
+ expect(retrieve.url).toBe("https://qdrant.example");
685
+ expect(retrieve.collection).toBe("docs");
686
+ expect(retrieve.apiKey).toEqual({ kind: "env", name: "QDRANT_API_KEY" });
687
+ });
661
688
  });
662
689
 
663
690
  describe("IrCrewV0 (Section 22)", () => {
package/src/index.ts CHANGED
@@ -114,6 +114,44 @@ export type IrFailureTaxonomyEntry = {
114
114
 
115
115
  export type IrFailureTaxonomy = readonly IrFailureTaxonomyEntry[];
116
116
 
117
+ /**
118
+ * Pillar 3 (FR-004) — per-target security fabric configuration the
119
+ * compiler lowers from the spec's `security` block. Today it carries the
120
+ * intent-gate's judge selection; `egressPolicy` is reserved for the
121
+ * sink-side fabric (FR-002/006) and intentionally not modelled here.
122
+ *
123
+ * `justification.judge` selects which `JustificationJudge` the runtime
124
+ * wires for `requireJustification: true` tools — `"rule-based"` (the
125
+ * deterministic default, `ruleBasedJustificationJudge`) or `"claude"`
126
+ * (the model-backed `@crewhaus/justification-judge-claude`). `model` is
127
+ * the judge model id when `judge: "claude"`; the consumer defaults it to
128
+ * a haiku-class model when omitted. Optional + spread-in at lower-time so
129
+ * the field is absent when the spec omits the block (same convention as
130
+ * `failureTaxonomy`).
131
+ */
132
+ export type IrSecurity = {
133
+ readonly justification?: {
134
+ readonly judge: "rule-based" | "claude";
135
+ readonly model?: string;
136
+ };
137
+ /**
138
+ * Pillar 3 sink-side fabric (FR-006) — the egress-matching strategy.
139
+ * `"substring"` is the behavior-preserving `SubstringEgressMatcher`
140
+ * (`MIN_MATCH_LENGTH`); `"semantic"` selects the optional embedding-backed
141
+ * `@crewhaus/egress-matcher-semantic`. Lowered from
142
+ * `spec.security.egressMatcher`. Absent when the spec omits it, in which
143
+ * case the runtime stays on the substring default. Honoured on BOTH paths:
144
+ * the `crewhaus run` interpreter resolves it into
145
+ * `runChatLoop({ egressMatcher })`, and `@crewhaus/target-cli` emits the
146
+ * same matcher construction into the standalone compiled bundle. Only
147
+ * changes *how* lineage matches are detected — the per-origin/per-sink
148
+ * policy and the three audit outcomes (`egress-passed | egress-warned |
149
+ * egress-blocked`) are matcher-independent and live in `classifyEgress`,
150
+ * not here.
151
+ */
152
+ readonly egressMatcher?: "substring" | "semantic";
153
+ };
154
+
117
155
  /**
118
156
  * Track F (Section 57) — typed message schemas (Σ) for multi-agent
119
157
  * communication. Source: AgentFlow (arxiv 2604.20801). A typed graph
@@ -176,6 +214,10 @@ export type IrV0 = {
176
214
  readonly cli?: IrCliOptions;
177
215
  /** Section 55 (Track A) — named failure taxonomy. Optional. */
178
216
  readonly failureTaxonomy?: IrFailureTaxonomy;
217
+ /** Pillar 3 (FR-004) — security fabric config (intent-gate judge
218
+ * selection). Optional; absent when the spec omits the `security`
219
+ * block. */
220
+ readonly security?: IrSecurity;
179
221
  /** §47 cross-cutting blockchain subsystem (slice 0). All optional. */
180
222
  readonly chains?: readonly IrChainBinding[];
181
223
  readonly wallets?: readonly IrWalletBinding[];
@@ -314,6 +356,8 @@ export type IrContractBinding = {
314
356
  export type IrTransactionPolicy = {
315
357
  readonly defaultWriteApproval: "required" | "policy" | "none";
316
358
  readonly maxValueUsd?: number;
359
+ /** Oracle-free native-token spend ceiling (wei, decimal or 0x-hex string). */
360
+ readonly maxValueWei?: string;
317
361
  readonly allowedContracts: readonly string[];
318
362
  readonly simulationRequired: boolean;
319
363
  };
@@ -521,6 +565,16 @@ export type IrPipelineDocument = {
521
565
  readonly metadata?: Readonly<Record<string, unknown>>;
522
566
  };
523
567
 
568
+ /**
569
+ * Vector-store backend selector. Mirrors `VectorBackendId` from
570
+ * `@crewhaus/vector-store` — the canonical source of truth for which
571
+ * backends exist — but kept inline here (exactly as `IrBatchQueueAdapter`
572
+ * mirrors the `queue-protocol` adapter ids) so the runtime-agnostic IR
573
+ * keeps its zero runtime-package dependencies. Keep the two in sync when a
574
+ * backend is added or removed.
575
+ */
576
+ export type IrVectorBackend = "in-memory" | "lance" | "qdrant" | "pinecone" | "weaviate";
577
+
524
578
  export type IrPipelineV0 = {
525
579
  readonly version: 0;
526
580
  readonly name: string;
@@ -531,8 +585,21 @@ export type IrPipelineV0 = {
531
585
  };
532
586
  readonly retrieve: {
533
587
  readonly embedderModel: string;
534
- readonly vectorBackend: "in-memory";
588
+ readonly vectorBackend: IrVectorBackend;
535
589
  readonly defaultK: number;
590
+ /**
591
+ * Remote (qdrant/pinecone/weaviate) and file (lance) backends — the
592
+ * service base URL or, for lance, the on-disk index path. Omitted for
593
+ * `in-memory`. Required for the HTTP backends (enforced at spec parse).
594
+ */
595
+ readonly url?: string;
596
+ /** Remote/file backends — collection / table name. */
597
+ readonly collection?: string;
598
+ /**
599
+ * Remote backends — API key, lowered to an env-ref (`$VAR` →
600
+ * `process.env`) or a literal so real secrets stay out of the bundle.
601
+ */
602
+ readonly apiKey?: IrSecretRef;
536
603
  };
537
604
  readonly indexing: {
538
605
  readonly chunkStrategy: "fixed" | "semantic" | "markdown";
@@ -627,7 +694,7 @@ export type IrResearchV0 = {
627
694
  /** Absolute file:// roots the crawler may read from. Empty denies all file://. */
628
695
  readonly allowedFileRoots: readonly string[];
629
696
  /** Optional vector backend hint for future RAG-augmented research. */
630
- readonly vectorBackend?: "in-memory";
697
+ readonly vectorBackend?: IrVectorBackend;
631
698
  };
632
699
  readonly tools: readonly string[];
633
700
  readonly toolConfigs: IrToolConfigs;