@behavior-os/sdk 0.0.0-stage → 2.2.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.
@@ -0,0 +1,4 @@
1
+
2
+ > @behavior-os/sdk@2.2.0 build C:\www\behavior-os\packages\sdk
3
+ > tsc -p tsconfig.build.json
4
+
@@ -0,0 +1,15 @@
1
+
2
+ > @behavior-os/sdk@2.1.0 test C:\www\behavior-os\packages\sdk
3
+ > vitest run
4
+
5
+
6
+  RUN  v4.1.12 C:/www/behavior-os/packages/sdk
7
+
8
+ ✓ tests/sdk-integration.test.ts (5 tests) 36ms
9
+ ✓ tests/sdk.test.ts (10 tests) 57ms
10
+
11
+  Test Files  2 passed (2)
12
+  Tests  15 passed (15)
13
+  Start at  14:01:56
14
+  Duration  6.55s (transform 7.67s, setup 0ms, import 10.27s, tests 93ms, environment 1ms)
15
+
@@ -0,0 +1,4 @@
1
+
2
+ > @behavior-os/sdk@2.1.0 typecheck C:\www\behavior-os\packages\sdk
3
+ > tsc --noEmit -p tsconfig.json
4
+
package/CHANGELOG.md ADDED
@@ -0,0 +1,57 @@
1
+ # @behavior-os/sdk
2
+
3
+ ## 2.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 885f016: fix: unify MCP protocol advancement steps with plugin host
8
+
9
+ The MCP server now advances `bos_list_dna` (step 2) and `bos_get_state` (step 3)
10
+ protocol steps, matching the plugin host's behavior. Previously, MCP callers
11
+ stalled at step 1 after `bos_select_dna` because only `bos_start_mission` advanced
12
+ the protocol in MCP.
13
+
14
+ Also completes the SDK lifecycle gap (added `completeMission`, `failMission`,
15
+ `cancelMission`, `listMissions`, `requiredChecks`/`verificationMode` on
16
+ `createMission`) and fixes the CLI `autonomous` command to close dry-run missions.
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [885f016]
21
+ - @behavior-os/core@2.2.0
22
+ - @behavior-os/schemas@2.2.0
23
+
24
+ ## 2.1.0
25
+
26
+ ### Minor Changes
27
+
28
+ - c95526d: Transparent execution on Windows and an asynchronous audit engine:
29
+
30
+ - `AuditEngine.run/runReal/runStageReal` are now async so hosts can await them
31
+ (MCP server, plugin, SDK, CLI and examples all updated). Callers that used
32
+ the result synchronously must await — hence the minor bumps.
33
+ - Every process spawn in the governed paths sets `windowsHide: true` and uses
34
+ `shell: true` with a single-string command (Node DEP0190-safe), so governed
35
+ execution no longer flashes CMD windows; `pnpm` invocations get the shell
36
+ treatment required by Windows `.cmd` shims.
37
+ - Audit stages run sequentially under contention (parallel tsc produced false
38
+ failures), and the plugin tool handlers await their audit calls, too.
39
+ - New UX gate: `pnpm verify:windows` runs `scripts/win-window-probe.mjs`
40
+ against the spawn topology that leaked windows before and fails (exit 1)
41
+ when any new visible console window appears, reporting pid/name
42
+ attribution. It is part of `verify:all` and documented in the AGENTS.md
43
+ verification ladder.
44
+ - Examples are covered from the root ladder and `verify:opencode` batches
45
+ `git check-ignore` into a single hidden spawn.
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies [2fe6d18]
50
+ - Updated dependencies [2fe6d18]
51
+ - Updated dependencies [2fe6d18]
52
+ - Updated dependencies [c95526d]
53
+ - Updated dependencies [c95526d]
54
+ - Updated dependencies [c95526d]
55
+ - Updated dependencies [2fe6d18]
56
+ - @behavior-os/core@2.1.0
57
+ - @behavior-os/schemas@2.0.1
@@ -0,0 +1,95 @@
1
+ import { type BehaviorOSConfig, type MissionTransitionResult } from '@behavior-os/core';
2
+ import type { AuditReport, DNA, GovernanceDecision, LearningEvent, Mission, MissionPriority, MissionStatus, MissionType } from '@behavior-os/schemas';
3
+ export type { BehaviorOSConfig, MissionTransitionResult } from '@behavior-os/core';
4
+ export { BehaviorOS } from '@behavior-os/core';
5
+ export type { Agent, AuditReport, DNA, GovernanceDecision, LearningEvent, Mission, MissionPriority, MissionStatus, MissionType, } from '@behavior-os/schemas';
6
+ export declare class BehaviorOSSDK {
7
+ private bos;
8
+ constructor(config?: BehaviorOSConfig);
9
+ loadDNA(dna: DNA): Promise<void>;
10
+ getDNA(): DNA | null;
11
+ evaluateGovernance(action: string, context: {
12
+ agent: string;
13
+ scope?: string;
14
+ [key: string]: unknown;
15
+ }): GovernanceDecision;
16
+ checkQuality(metrics: Record<string, number>): {
17
+ passed: boolean;
18
+ details: unknown;
19
+ };
20
+ runAudit(options: {
21
+ missionId: string;
22
+ agentId?: string;
23
+ stages?: string[];
24
+ simulate?: boolean;
25
+ }): Promise<AuditReport>;
26
+ createMission(options: {
27
+ title: string;
28
+ description?: string;
29
+ type: string;
30
+ priority: string;
31
+ dnaPattern?: string;
32
+ createdBy?: string;
33
+ tags?: string[];
34
+ /** Gates that must each have passing evidence before completion. */
35
+ requiredChecks?: string[];
36
+ /** `executed` requires real, provenance-stamped evidence for every gate. */
37
+ verificationMode?: 'any' | 'executed';
38
+ }): Mission;
39
+ startMission(missionId: string): Mission | null;
40
+ completeMission(missionId: string, options?: {
41
+ expectedVersion?: number;
42
+ actor?: string;
43
+ evidence?: Array<{
44
+ gate: string;
45
+ status: 'passed' | 'failed' | 'skipped';
46
+ source: string;
47
+ detail?: string;
48
+ simulated?: boolean;
49
+ provenance?: 'executed' | 'reported' | 'simulated';
50
+ executionId?: string;
51
+ }>;
52
+ }): Mission | null;
53
+ failMission(missionId: string, reason?: string): Mission | null;
54
+ cancelMission(missionId: string): MissionTransitionResult;
55
+ listMissions(limit?: number, filters?: {
56
+ status?: MissionStatus;
57
+ type?: MissionType;
58
+ priority?: MissionPriority;
59
+ }): Mission[];
60
+ recordLearning(options: {
61
+ type: string;
62
+ source: string;
63
+ content: string;
64
+ impact: string;
65
+ relatedMission?: string;
66
+ }): LearningEvent;
67
+ getInsights(limit?: number): LearningEvent[];
68
+ getStatus(): {
69
+ engine: boolean;
70
+ dna: string | null;
71
+ missions: number;
72
+ agents: number;
73
+ state: import("@behavior-os/schemas").AgentState;
74
+ config: {
75
+ governance: "strict" | "moderate" | "lenient";
76
+ qualityEnabled: boolean;
77
+ auditEnabled: boolean;
78
+ learningEnabled: boolean;
79
+ };
80
+ store: boolean | null;
81
+ storeError: string | null;
82
+ };
83
+ getState(): {
84
+ currentStep: number;
85
+ selectedDna: string | null;
86
+ agentId: string | null;
87
+ persona: string | null;
88
+ activeMission: string | null;
89
+ stepHistory: Record<string, unknown>[];
90
+ createdAt: string;
91
+ updatedAt: string;
92
+ };
93
+ }
94
+ export default BehaviorOSSDK;
95
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,KAAK,EACV,WAAW,EACX,GAAG,EACH,kBAAkB,EAClB,aAAa,EACb,OAAO,EACP,eAAe,EACf,aAAa,EACb,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EACV,KAAK,EACL,WAAW,EACX,GAAG,EACH,kBAAkB,EAClB,aAAa,EACb,OAAO,EACP,eAAe,EACf,aAAa,EACb,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,aAAa;IACxB,OAAO,CAAC,GAAG,CAAa;gBAEZ,MAAM,GAAE,gBAAqB;IAKnC,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAItC,MAAM,IAAI,GAAG,GAAG,IAAI;IAKpB,kBAAkB,CAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GACjE,kBAAkB;IAKrB,YAAY,CAA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C,EAAE,MAAM,CAAC;SACtB,CAAC,CAAC;KACC,GACL,OAAO,GAAG,IAAI;IAIjB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI;IAI/D,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,uBAAuB;IAIzD,YAAY,CACV,KAAK,SAAK,EACV,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,aAAa,CAAC;QAAC,IAAI,CAAC,EAAE,WAAW,CAAC;QAAC,QAAQ,CAAC,EAAE,eAAe,CAAA;KAAO,GACvF,OAAO,EAAE;IAKZ,cAAc,CAAC,OAAO,EAAE;QACtB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GAAG,aAAa;IAIjB,WAAW,CAAC,KAAK,SAAK,GAAG,aAAa,EAAE;IAKxC,SAAS;;;;;;;;;;;;;;;IAIT,QAAQ;;;;;;;;;;CAGT;AAED,eAAe,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,62 @@
1
+ import { BehaviorOS } from '@behavior-os/core';
2
+ export { BehaviorOS } from '@behavior-os/core';
3
+ export class BehaviorOSSDK {
4
+ bos;
5
+ constructor(config = {}) {
6
+ this.bos = new BehaviorOS(config);
7
+ }
8
+ // DNA Management
9
+ async loadDNA(dna) {
10
+ await this.bos.loadDNA(dna);
11
+ }
12
+ getDNA() {
13
+ return this.bos.getDNA();
14
+ }
15
+ // Governance
16
+ evaluateGovernance(action, context) {
17
+ return this.bos.evaluateGovernance(action, context);
18
+ }
19
+ // Quality
20
+ checkQuality(metrics) {
21
+ return this.bos.checkQuality(metrics);
22
+ }
23
+ // Audit
24
+ async runAudit(options) {
25
+ return this.bos.runAudit(options);
26
+ }
27
+ // Missions
28
+ createMission(options) {
29
+ return this.bos.createMission(options);
30
+ }
31
+ startMission(missionId) {
32
+ return this.bos.startMission(missionId);
33
+ }
34
+ completeMission(missionId, options = {}) {
35
+ return this.bos.completeMission(missionId, options);
36
+ }
37
+ failMission(missionId, reason) {
38
+ return this.bos.failMission(missionId, reason);
39
+ }
40
+ cancelMission(missionId) {
41
+ return this.bos.cancelMission(missionId);
42
+ }
43
+ listMissions(limit = 50, filters = {}) {
44
+ return this.bos.listMissions(limit, filters);
45
+ }
46
+ // Learning
47
+ recordLearning(options) {
48
+ return this.bos.recordLearning(options);
49
+ }
50
+ getInsights(limit = 10) {
51
+ return this.bos.getInsights(limit);
52
+ }
53
+ // Status
54
+ getStatus() {
55
+ return this.bos.getStatus();
56
+ }
57
+ getState() {
58
+ return this.bos.getState();
59
+ }
60
+ }
61
+ export default BehaviorOSSDK;
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAuD,MAAM,mBAAmB,CAAC;AAapG,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAa/C,MAAM,OAAO,aAAa;IAChB,GAAG,CAAa;IAExB,YAAY,SAA2B,EAAE;QACvC,IAAI,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAED,iBAAiB;IACjB,KAAK,CAAC,OAAO,CAAC,GAAQ;QACpB,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IAC3B,CAAC;IAED,aAAa;IACb,kBAAkB,CAChB,MAAc,EACd,OAAkE;QAElE,OAAO,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IAED,UAAU;IACV,YA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EAAE,CAAC;IAC9B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;CACF;AAED,eAAe,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,28 @@
1
1
  {
2
2
  "name": "@behavior-os/sdk",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "2.2.0",
4
+ "description": "High-level TypeScript SDK for Behavior-OS",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "scripts": {
15
+ "build": "tsc -p tsconfig.build.json",
16
+ "test": "vitest run",
17
+ "typecheck": "tsc --noEmit -p tsconfig.json",
18
+ "clean": "node ../../scripts/clean.mjs"
19
+ },
20
+ "dependencies": {
21
+ "@behavior-os/core": "workspace:*",
22
+ "@behavior-os/schemas": "workspace:*"
23
+ },
24
+ "devDependencies": {
25
+ "typescript": "~5.9.3",
26
+ "vitest": "^4.1.11"
27
+ }
28
+ }
package/src/index.ts ADDED
@@ -0,0 +1,146 @@
1
+ import { BehaviorOS, type BehaviorOSConfig, type MissionTransitionResult } from '@behavior-os/core';
2
+ import type {
3
+ AuditReport,
4
+ DNA,
5
+ GovernanceDecision,
6
+ LearningEvent,
7
+ Mission,
8
+ MissionPriority,
9
+ MissionStatus,
10
+ MissionType,
11
+ } from '@behavior-os/schemas';
12
+
13
+ export type { BehaviorOSConfig, MissionTransitionResult } from '@behavior-os/core';
14
+ export { BehaviorOS } from '@behavior-os/core';
15
+ export type {
16
+ Agent,
17
+ AuditReport,
18
+ DNA,
19
+ GovernanceDecision,
20
+ LearningEvent,
21
+ Mission,
22
+ MissionPriority,
23
+ MissionStatus,
24
+ MissionType,
25
+ } from '@behavior-os/schemas';
26
+
27
+ export class BehaviorOSSDK {
28
+ private bos: BehaviorOS;
29
+
30
+ constructor(config: BehaviorOSConfig = {}) {
31
+ this.bos = new BehaviorOS(config);
32
+ }
33
+
34
+ // DNA Management
35
+ async loadDNA(dna: DNA): Promise<void> {
36
+ await this.bos.loadDNA(dna);
37
+ }
38
+
39
+ getDNA(): DNA | null {
40
+ return this.bos.getDNA();
41
+ }
42
+
43
+ // Governance
44
+ evaluateGovernance(
45
+ action: string,
46
+ context: { agent: string; scope?: string; [key: string]: unknown },
47
+ ): GovernanceDecision {
48
+ return this.bos.evaluateGovernance(action, context);
49
+ }
50
+
51
+ // Quality
52
+ checkQuality(metrics: Record<string, number>): { passed: boolean; details: unknown } {
53
+ return this.bos.checkQuality(metrics);
54
+ }
55
+
56
+ // Audit
57
+ async runAudit(options: {
58
+ missionId: string;
59
+ agentId?: string;
60
+ stages?: string[];
61
+ simulate?: boolean;
62
+ }): Promise<AuditReport> {
63
+ return this.bos.runAudit(options);
64
+ }
65
+
66
+ // Missions
67
+ createMission(options: {
68
+ title: string;
69
+ description?: string;
70
+ type: string;
71
+ priority: string;
72
+ dnaPattern?: string;
73
+ createdBy?: string;
74
+ tags?: string[];
75
+ /** Gates that must each have passing evidence before completion. */
76
+ requiredChecks?: string[];
77
+ /** `executed` requires real, provenance-stamped evidence for every gate. */
78
+ verificationMode?: 'any' | 'executed';
79
+ }): Mission {
80
+ return this.bos.createMission(options);
81
+ }
82
+
83
+ startMission(missionId: string): Mission | null {
84
+ return this.bos.startMission(missionId);
85
+ }
86
+
87
+ completeMission(
88
+ missionId: string,
89
+ options: {
90
+ expectedVersion?: number;
91
+ actor?: string;
92
+ evidence?: Array<{
93
+ gate: string;
94
+ status: 'passed' | 'failed' | 'skipped';
95
+ source: string;
96
+ detail?: string;
97
+ simulated?: boolean;
98
+ provenance?: 'executed' | 'reported' | 'simulated';
99
+ executionId?: string;
100
+ }>;
101
+ } = {},
102
+ ): Mission | null {
103
+ return this.bos.completeMission(missionId, options);
104
+ }
105
+
106
+ failMission(missionId: string, reason?: string): Mission | null {
107
+ return this.bos.failMission(missionId, reason);
108
+ }
109
+
110
+ cancelMission(missionId: string): MissionTransitionResult {
111
+ return this.bos.cancelMission(missionId);
112
+ }
113
+
114
+ listMissions(
115
+ limit = 50,
116
+ filters: { status?: MissionStatus; type?: MissionType; priority?: MissionPriority } = {},
117
+ ): Mission[] {
118
+ return this.bos.listMissions(limit, filters);
119
+ }
120
+
121
+ // Learning
122
+ recordLearning(options: {
123
+ type: string;
124
+ source: string;
125
+ content: string;
126
+ impact: string;
127
+ relatedMission?: string;
128
+ }): LearningEvent {
129
+ return this.bos.recordLearning(options);
130
+ }
131
+
132
+ getInsights(limit = 10): LearningEvent[] {
133
+ return this.bos.getInsights(limit);
134
+ }
135
+
136
+ // Status
137
+ getStatus() {
138
+ return this.bos.getStatus();
139
+ }
140
+
141
+ getState() {
142
+ return this.bos.getState();
143
+ }
144
+ }
145
+
146
+ export default BehaviorOSSDK;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sdk-integration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-integration.test.d.ts","sourceRoot":"","sources":["sdk-integration.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,67 @@
1
+ import { beforeEach, describe, expect, it } from 'vitest';
2
+ import { BehaviorOSSDK } from '../src/index.js';
3
+
4
+ describe('BehaviorOSSDK Integration', () => {
5
+ let sdk;
6
+ beforeEach(() => {
7
+ sdk = new BehaviorOSSDK();
8
+ });
9
+ it('should create and manage missions through SDK', () => {
10
+ const mission = sdk.createMission({
11
+ title: 'SDK Test Mission',
12
+ type: 'feature',
13
+ priority: 'high',
14
+ dnaPattern: 'enterprise-governance',
15
+ });
16
+ expect(mission.id).toBeDefined();
17
+ expect(mission.title).toBe('SDK Test Mission');
18
+ const started = sdk.startMission(mission.id);
19
+ expect(started?.status).toBe('active');
20
+ });
21
+ it('should evaluate governance through SDK', async () => {
22
+ const dna = {
23
+ name: 'Test DNA',
24
+ version: '1.0.0',
25
+ description: 'Test',
26
+ personas: [],
27
+ governance: [],
28
+ quality: [],
29
+ };
30
+ await sdk.loadDNA(dna);
31
+ const decision = sdk.evaluateGovernance('test-action', {
32
+ agent: 'sdk-agent',
33
+ context: {},
34
+ });
35
+ expect(decision.action).toBe('test-action');
36
+ expect(decision.verdict).toBeDefined();
37
+ });
38
+ it('should record and retrieve learning through SDK', () => {
39
+ sdk.recordLearning({
40
+ type: 'insight',
41
+ source: 'sdk-test',
42
+ content: 'SDK learning test',
43
+ impact: 'high',
44
+ });
45
+ const insights = sdk.getInsights(10);
46
+ expect(insights.length).toBeGreaterThan(0);
47
+ });
48
+ it('should get status and state through SDK', () => {
49
+ const status = sdk.getStatus();
50
+ expect(status.engine).toBe(true);
51
+ const state = sdk.getState();
52
+ expect(state).toBeDefined();
53
+ });
54
+ it('should load DNA through SDK', async () => {
55
+ const dna = {
56
+ name: 'SDK DNA',
57
+ version: '1.0.0',
58
+ description: 'SDK test DNA',
59
+ personas: [],
60
+ governance: [],
61
+ quality: [],
62
+ };
63
+ await sdk.loadDNA(dna);
64
+ expect(sdk.getDNA()?.name).toBe('SDK DNA');
65
+ });
66
+ });
67
+ //# sourceMappingURL=sdk-integration.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-integration.test.js","sourceRoot":"","sources":["sdk-integration.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,IAAI,GAAkB,CAAC;IAEvB,UAAU,CAAC,GAAG,EAAE;QACd,GAAG,GAAG,IAAI,aAAa,EAAE,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,OA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EAAE,MAAM;SACf,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACrC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,EAAE,CAAC;QAC/B,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEjC,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC7B,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,GAAG,GAAQ;YACf,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,EAAE;YACd,OAAO,EAAE,EAAE;SACZ,CAAC;QAEF,MAAM,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACvB,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,80 @@
1
+ import type { DNA } from '@behavior-os/schemas';
2
+ import { beforeEach, describe, expect, it } from 'vitest';
3
+ import { BehaviorOSSDK } from '../src/index.js';
4
+
5
+ describe('BehaviorOSSDK Integration', () => {
6
+ let sdk: BehaviorOSSDK;
7
+
8
+ beforeEach(() => {
9
+ sdk = new BehaviorOSSDK();
10
+ });
11
+
12
+ it('should create and manage missions through SDK', () => {
13
+ const mission = sdk.createMission({
14
+ title: 'SDK Test Mission',
15
+ type: 'feature',
16
+ priority: 'high',
17
+ dnaPattern: 'enterprise-governance',
18
+ });
19
+
20
+ expect(mission.id).toBeDefined();
21
+ expect(mission.title).toBe('SDK Test Mission');
22
+
23
+ const started = sdk.startMission(mission.id);
24
+ expect(started?.status).toBe('active');
25
+ });
26
+
27
+ it('should evaluate governance through SDK', async () => {
28
+ const dna: DNA = {
29
+ name: 'Test DNA',
30
+ version: '1.0.0',
31
+ description: 'Test',
32
+ personas: [],
33
+ governance: [],
34
+ quality: [],
35
+ };
36
+ await sdk.loadDNA(dna);
37
+
38
+ const decision = sdk.evaluateGovernance('test-action', {
39
+ agent: 'sdk-agent',
40
+ context: {},
41
+ });
42
+
43
+ expect(decision.action).toBe('test-action');
44
+ expect(decision.verdict).toBeDefined();
45
+ });
46
+
47
+ it('should record and retrieve learning through SDK', () => {
48
+ sdk.recordLearning({
49
+ type: 'insight',
50
+ source: 'sdk-test',
51
+ content: 'SDK learning test',
52
+ impact: 'high',
53
+ });
54
+
55
+ const insights = sdk.getInsights(10);
56
+ expect(insights.length).toBeGreaterThan(0);
57
+ });
58
+
59
+ it('should get status and state through SDK', () => {
60
+ const status = sdk.getStatus();
61
+ expect(status.engine).toBe(true);
62
+
63
+ const state = sdk.getState();
64
+ expect(state).toBeDefined();
65
+ });
66
+
67
+ it('should load DNA through SDK', async () => {
68
+ const dna: DNA = {
69
+ name: 'SDK DNA',
70
+ version: '1.0.0',
71
+ description: 'SDK test DNA',
72
+ personas: [],
73
+ governance: [],
74
+ quality: [],
75
+ };
76
+
77
+ await sdk.loadDNA(dna);
78
+ expect(sdk.getDNA()?.name).toBe('SDK DNA');
79
+ });
80
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sdk.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.test.d.ts","sourceRoot":"","sources":["sdk.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,75 @@
1
+ import { beforeEach, describe, expect, it } from 'vitest';
2
+ import { BehaviorOSSDK } from '../src/index.js';
3
+
4
+ describe('BehaviorOSSDK', () => {
5
+ let sdk;
6
+ beforeEach(() => {
7
+ sdk = new BehaviorOSSDK();
8
+ });
9
+ it('should initialize with default config', () => {
10
+ const status = sdk.getStatus();
11
+ expect(status.engine).toBe(true);
12
+ expect(status.dna).toBeNull();
13
+ });
14
+ it('should load DNA pattern', async () => {
15
+ const dna = {
16
+ name: 'Test DNA',
17
+ version: '1.0.0',
18
+ description: 'Test',
19
+ personas: [],
20
+ governance: [],
21
+ quality: [],
22
+ };
23
+ await sdk.loadDNA(dna);
24
+ expect(sdk.getDNA()).toEqual(dna);
25
+ });
26
+ it('should evaluate governance with DNA loaded', async () => {
27
+ const dna = {
28
+ name: 'Test DNA',
29
+ version: '1.0.0',
30
+ description: 'Test',
31
+ personas: [],
32
+ governance: [],
33
+ quality: [],
34
+ };
35
+ await sdk.loadDNA(dna);
36
+ const decision = sdk.evaluateGovernance('test-action', {
37
+ agent: 'agent-1',
38
+ context: {},
39
+ });
40
+ expect(decision.action).toBe('test-action');
41
+ expect(decision.verdict).toBeDefined();
42
+ expect(decision.timestamp).toBeDefined();
43
+ });
44
+ it('should create mission', () => {
45
+ const mission = sdk.createMission({
46
+ title: 'Test Mission',
47
+ type: 'feature',
48
+ priority: 'high',
49
+ });
50
+ expect(mission.id).toBeDefined();
51
+ expect(mission.title).toBe('Test Mission');
52
+ expect(mission.status).toBe('pending');
53
+ });
54
+ it('should record learning', () => {
55
+ const event = sdk.recordLearning({
56
+ type: 'insight',
57
+ source: 'test',
58
+ content: 'Test insight',
59
+ impact: 'medium',
60
+ });
61
+ expect(event.id).toBeDefined();
62
+ expect(event.content).toBe('Test insight');
63
+ });
64
+ it('should get insights after recording', () => {
65
+ sdk.recordLearning({
66
+ type: 'insight',
67
+ source: 'test',
68
+ content: 'Test insight',
69
+ impact: 'high',
70
+ });
71
+ const insights = sdk.getInsights(10);
72
+ expect(insights.length).toB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AE,CAAC;QAC/B,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,GAAG,CAAC,cAAc,CAAC;YACjB,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,cAAc;YACvB,MAAM,EAAE,MAAM;SACf,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACrC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,159 @@
1
+ import type { DNA } from '@behavior-os/schemas';
2
+ import { beforeEach, describe, expect, it } from 'vitest';
3
+ import { BehaviorOSSDK } from '../src/index.js';
4
+
5
+ describe('BehaviorOSSDK', () => {
6
+ let sdk: BehaviorOSSDK;
7
+
8
+ beforeEach(() => {
9
+ sdk = new BehaviorOSSDK();
10
+ });
11
+
12
+ it('should initialize with default config', () => {
13
+ const status = sdk.getStatus();
14
+ expect(status.engine).toBe(true);
15
+ expect(status.dna).toBeNull();
16
+ });
17
+
18
+ it('should load DNA pattern', async () => {
19
+ const dna: DNA = {
20
+ name: 'Test DNA',
21
+ version: '1.0.0',
22
+ description: 'Test',
23
+ personas: [],
24
+ governance: [],
25
+ quality: [],
26
+ };
27
+
28
+ await sdk.loadDNA(dna);
29
+ expect(sdk.getDNA()).toEqual(dna);
30
+ });
31
+
32
+ it('should evaluate governance with DNA loaded', async () => {
33
+ const dna: DNA = {
34
+ name: 'Test DNA',
35
+ version: '1.0.0',
36
+ description: 'Test',
37
+ personas: [],
38
+ governance: [],
39
+ quality: [],
40
+ };
41
+ await sdk.loadDNA(dna);
42
+
43
+ const decision = sdk.evaluateGovernance('test-action', {
44
+ agent: 'agent-1',
45
+ context: {},
46
+ });
47
+
48
+ expect(decision.action).toBe('test-action');
49
+ expect(decision.verdict).toBeDefined();
50
+ expect(decision.timestamp).toBeDefined();
51
+ });
52
+
53
+ it('should create mission', () => {
54
+ const mission = sdk.createMission({
55
+ title: 'Test Mission',
56
+ type: 'feature',
57
+ priority: 'high',
58
+ });
59
+
60
+ expect(mission.id).toBeDefined();
61
+ expect(mission.title).toBe('Test Mission');
62
+ expect(mission.status).toBe('pending');
63
+ });
64
+
65
+ it('should record learning', () => {
66
+ const event = sdk.recordLearning({
67
+ type: 'insight',
68
+ source: 'test',
69
+ content: 'Test insight',
70
+ impact: 'medium',
71
+ });
72
+
73
+ expect(event.id).toBeDefined();
74
+ expect(event.content).toBe('Test insight');
75
+ });
76
+
77
+ it('should get insights after recording', () => {
78
+ sdk.recordLearning({
79
+ type: 'insight',
80
+ source: 'test',
81
+ content: 'Test insight',
82
+ impact: 'high',
83
+ });
84
+
85
+ const insights = sdk.getInsights(10);
86
+ expect(insights.length).toBeGreaterThan(0);
87
+ });
88
+
89
+ it('should create mission with requiredChecks', () => {
90
+ const mission = sdk.createMission({
91
+ title: 'Test Mission',
92
+ type: 'feature',
93
+ priority: 'high',
94
+ requiredChecks: ['governance', 'audit'],
95
+ });
96
+
97
+ expect(mission.id).toBeDefined();
98
+ expect(mission.title).toBe('Test Mission');
99
+ expect(mission.status).toBe('pending');
100
+ });
101
+
102
+ it('should start, complete, and cancel missions via SDK', () => {
103
+ const mission = sdk.createMission({
104
+ title: 'Lifecycle Mission',
105
+ type: 'feature',
106
+ priority: 'high',
107
+ requiredChecks: ['governance'],
108
+ });
109
+
110
+ // Start -> active
111
+ const started = sdk.startMission(mission.id);
112
+ expect(started).not.toBeNull();
113
+ expect(started?.status).toBe('active');
114
+
115
+ // Complete with evidence
116
+ const completed = sdk.completeMission(mission.id, {
117
+ evidence: [{ gate: 'governance', status: 'passed', source: 'test' }],
118
+ });
119
+ expect(completed).not.toBeNull();
120
+ expect(completed?.status).toBe('completed');
121
+
122
+ // Cancel a new mission
123
+ const cancelTarget = sdk.createMission({
124
+ title: 'Cancel Mission',
125
+ type: 'refactor',
126
+ priority: 'medium',
127
+ });
128
+ const result = sdk.cancelMission(cancelTarget.id);
129
+ expect(result.ok).toBe(true);
130
+ expect(result.mission?.status).toBe('cancelled');
131
+ });
132
+
133
+ it('should list missions with filters', () => {
134
+ sdk.createMission({ title: 'Feature A', type: 'feature', priority: 'high' });
135
+ sdk.createMission({ title: 'Bug B', type: 'bugfix', priority: 'low' });
136
+
137
+ const all = sdk.listMissions();
138
+ expect(all.length).toBeGreaterThanOrEqual(2);
139
+
140
+ const features = sdk.listMissions(50, { type: 'feature' });
141
+ expect(features.every((m) => m.type === 'feature')).toBe(true);
142
+
143
+ const highPriority = sdk.listMissions(50, { priority: 'high' });
144
+ expect(highPriority.every((m) => m.priority === 'high')).toBe(true);
145
+ });
146
+
147
+ it('should fail a mission with reason', () => {
148
+ const mission = sdk.createMission({
149
+ title: 'Fail Mission',
150
+ type: 'incident',
151
+ priority: 'critical',
152
+ });
153
+
154
+ sdk.startMission(mission.id);
155
+ const failed = sdk.failMission(mission.id, 'Test failure reason');
156
+ expect(failed).not.toBeNull();
157
+ expect(failed?.status).toBe('failed');
158
+ });
159
+ });
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": false,
5
+ "outDir": "./dist",
6
+ "rootDir": "./src",
7
+ "declaration": true,
8
+ "declarationMap": true
9
+ },
10
+ "include": ["src/**/*"],
11
+ "exclude": ["node_modules", "dist", "tests"]
12
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": true,
5
+ "declaration": false,
6
+ "declarationMap": false,
7
+ "types": ["node"]
8
+ },
9
+ "include": ["src/**/*", "tests/**/*", "vitest.config.ts"],
10
+ "exclude": ["node_modules", "dist"]
11
+ }
@@ -0,0 +1,3 @@
1
+ declare const _default: import('vite').UserConfig;
2
+ export default _default;
3
+ //# sourceMappingURL=vitest.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["vitest.config.ts"],"names":[],"mappings":";AAGA,wBAYG"}
@@ -0,0 +1,16 @@
1
+ import path from 'node:path';
2
+ import { defineConfig } from 'vitest/config';
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ environment: 'node',
7
+ include: ['tests/**/*.test.ts'],
8
+ },
9
+ resolve: {
10
+ alias: {
11
+ '@behavior-os/core': path.resolve(__dirname, '../core/src/index.ts'),
12
+ '@behavior-os/schemas': path.resolve(__dirname, '../schemas/src/index.ts'),
13
+ },
14
+ },
15
+ });
16
+ //# sourceMappingURL=vitest.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.config.js","sourceRoot":"","sources":["vitest.config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAe,YAAY,CAAC;IAC1B,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,MAAM;QACnB,OAAO,EAAE,CAAC,oBAAoB,CAAC;KAChC;IACD,OAAO,EAAE;QACP,KAAK,EAAE;YACL,mBAAmB,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,sBAAsB,CAAC;YACpE,sBAAsB,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,yBAAyB,CAAC;SAC3E;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import path from 'node:path';
2
+ import { defineConfig } from 'vitest/config';
3
+
4
+ export default defineConfig({
5
+ test: {
6
+ globals: true,
7
+ environment: 'node',
8
+ include: ['tests/**/*.test.ts'],
9
+ },
10
+ resolve: {
11
+ alias: {
12
+ '@behavior-os/core': path.resolve(__dirname, '../core/src/index.ts'),
13
+ '@behavior-os/schemas': path.resolve(__dirname, '../schemas/src/index.ts'),
14
+ },
15
+ },
16
+ });
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.