@bluecopa/harness 1.0.0 → 2.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 (84) hide show
  1. package/README.md +212 -117
  2. package/dist/arc/index.d.ts +796 -0
  3. package/dist/arc/index.js +2863 -0
  4. package/dist/arc/index.js.map +1 -0
  5. package/dist/observability/otel.d.ts +36 -0
  6. package/dist/observability/otel.js +73 -0
  7. package/dist/observability/otel.js.map +1 -0
  8. package/dist/shared-types-DRxnerLT.d.ts +138 -0
  9. package/dist/skills/index.d.ts +67 -0
  10. package/dist/skills/index.js +282 -0
  11. package/dist/skills/index.js.map +1 -0
  12. package/package.json +26 -2
  13. package/AGENTS.md +0 -18
  14. package/docs/guides/observability.md +0 -32
  15. package/docs/guides/providers.md +0 -51
  16. package/docs/guides/skills.md +0 -25
  17. package/docs/security/skill-sandbox-threat-model.md +0 -20
  18. package/src/agent/create-agent.ts +0 -884
  19. package/src/agent/create-tools.ts +0 -33
  20. package/src/agent/step-executor.ts +0 -15
  21. package/src/agent/types.ts +0 -57
  22. package/src/context/llm-compaction-strategy.ts +0 -37
  23. package/src/context/prepare-step.ts +0 -65
  24. package/src/context/token-tracker.ts +0 -26
  25. package/src/extracted/manifest.json +0 -10
  26. package/src/extracted/prompts/compaction.md +0 -5
  27. package/src/extracted/prompts/system.md +0 -5
  28. package/src/extracted/tools.json +0 -82
  29. package/src/hooks/hook-runner.ts +0 -22
  30. package/src/hooks/tool-wrappers.ts +0 -64
  31. package/src/interfaces/compaction-strategy.ts +0 -18
  32. package/src/interfaces/hooks.ts +0 -24
  33. package/src/interfaces/sandbox-provider.ts +0 -29
  34. package/src/interfaces/session-store.ts +0 -48
  35. package/src/interfaces/tool-provider.ts +0 -70
  36. package/src/loop/bridge.ts +0 -363
  37. package/src/loop/context-store.ts +0 -207
  38. package/src/loop/lcm-tool-loop.ts +0 -163
  39. package/src/loop/vercel-agent-loop.ts +0 -279
  40. package/src/observability/context.ts +0 -17
  41. package/src/observability/metrics.ts +0 -27
  42. package/src/observability/otel.ts +0 -105
  43. package/src/observability/tracing.ts +0 -13
  44. package/src/optimization/agent-evaluator.ts +0 -40
  45. package/src/optimization/config-serializer.ts +0 -16
  46. package/src/optimization/optimization-runner.ts +0 -39
  47. package/src/optimization/trace-collector.ts +0 -33
  48. package/src/permissions/permission-manager.ts +0 -34
  49. package/src/providers/composite-tool-provider.ts +0 -72
  50. package/src/providers/control-plane-e2b-executor.ts +0 -218
  51. package/src/providers/e2b-tool-provider.ts +0 -68
  52. package/src/providers/local-tool-provider.ts +0 -190
  53. package/src/providers/skill-sandbox-provider.ts +0 -46
  54. package/src/sessions/file-session-store.ts +0 -61
  55. package/src/sessions/in-memory-session-store.ts +0 -39
  56. package/src/sessions/session-manager.ts +0 -44
  57. package/src/skills/skill-loader.ts +0 -52
  58. package/src/skills/skill-manager.ts +0 -175
  59. package/src/skills/skill-router.ts +0 -99
  60. package/src/skills/skill-types.ts +0 -26
  61. package/src/subagents/subagent-manager.ts +0 -22
  62. package/src/subagents/task-tool.ts +0 -13
  63. package/tests/integration/agent-loop-basic.spec.ts +0 -56
  64. package/tests/integration/agent-skill-default-from-sandbox.spec.ts +0 -66
  65. package/tests/integration/concurrency-single-turn.spec.ts +0 -35
  66. package/tests/integration/otel-metrics-emission.spec.ts +0 -62
  67. package/tests/integration/otel-trace-propagation.spec.ts +0 -48
  68. package/tests/integration/parity-benchmark.spec.ts +0 -45
  69. package/tests/integration/provider-local-smoke.spec.ts +0 -63
  70. package/tests/integration/session-resume.spec.ts +0 -30
  71. package/tests/integration/skill-install-rollback.spec.ts +0 -64
  72. package/tests/integration/skill-sandbox-file-blob.spec.ts +0 -54
  73. package/tests/integration/skills-progressive-disclosure.spec.ts +0 -61
  74. package/tests/integration/streaming-compaction-boundary.spec.ts +0 -43
  75. package/tests/integration/structured-messages-agent.spec.ts +0 -265
  76. package/tests/integration/subagent-isolation.spec.ts +0 -24
  77. package/tests/security/skill-sandbox-isolation.spec.ts +0 -51
  78. package/tests/unit/create-tools-schema-parity.spec.ts +0 -22
  79. package/tests/unit/extracted-manifest.spec.ts +0 -41
  80. package/tests/unit/interfaces-contract.spec.ts +0 -101
  81. package/tests/unit/structured-messages.spec.ts +0 -176
  82. package/tests/unit/token-tracker.spec.ts +0 -22
  83. package/tsconfig.json +0 -14
  84. package/vitest.config.ts +0 -7
package/package.json CHANGED
@@ -1,24 +1,48 @@
1
1
  {
2
2
  "name": "@bluecopa/harness",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "Provider-agnostic TypeScript agent framework",
5
5
  "license": "UNLICENSED",
6
+ "type": "module",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
11
+ "exports": {
12
+ "./arc": {
13
+ "types": "./dist/arc/index.d.ts",
14
+ "import": "./dist/arc/index.js"
15
+ },
16
+ "./skills": {
17
+ "types": "./dist/skills/index.d.ts",
18
+ "import": "./dist/skills/index.js"
19
+ },
20
+ "./observability": {
21
+ "types": "./dist/observability/otel.d.ts",
22
+ "import": "./dist/observability/otel.js"
23
+ },
24
+ "./package.json": "./package.json"
25
+ },
6
26
  "scripts": {
27
+ "build": "tsup",
28
+ "prepack": "pnpm run build",
7
29
  "test": "vitest run",
8
30
  "test:watch": "vitest"
9
31
  },
10
32
  "dependencies": {
11
33
  "@ai-sdk/anthropic": "^3.0.48",
12
34
  "ai": "^6.0.101",
35
+ "rxdb": "^15.39.0",
13
36
  "zod": "^4.1.11"
14
37
  },
15
38
  "devDependencies": {
16
39
  "@types/node": "^24.3.0",
40
+ "tsup": "^8.5.1",
17
41
  "typescript": "^5.9.2",
18
42
  "vitest": "^3.2.4"
19
43
  },
20
44
  "publishConfig": {
21
45
  "registry": "https://registry.npmjs.org/",
22
- "access": "restricted"
46
+ "access": "public"
23
47
  }
24
48
  }
package/AGENTS.md DELETED
@@ -1,18 +0,0 @@
1
- # AGENTS.md
2
-
3
- Guidance for agents working in `harness/`.
4
- Reference: https://agents.md/
5
-
6
- ## Scope
7
- `harness/` contains the TypeScript agent framework core.
8
-
9
- ## Rules
10
- - Keep API changes explicit and typed.
11
- - Maintain deterministic behavior in agent loop, compaction, and tool execution.
12
- - Preserve compatibility of extracted tool schemas unless intentionally versioned.
13
-
14
- ## Commands
15
- ```bash
16
- pnpm install
17
- pnpm test
18
- ```
@@ -1,32 +0,0 @@
1
- # Observability Guide
2
-
3
- Harness emits OpenTelemetry-style traces and metrics through `HarnessTelemetry`.
4
-
5
- ## Spans
6
- - `agent.run`
7
- - `agent.step`
8
- - `tool.call`
9
- - `context.compaction`
10
- - `skill.exec`
11
- - `subagent.run`
12
-
13
- ## Metrics
14
- - `agent_steps_total`
15
- - `tool_calls_total`
16
- - `tool_call_duration_ms`
17
- - `compactions_total`
18
- - `agent_errors_total`
19
-
20
- ## Correlation Fields
21
- Attach these fields to logs where available:
22
- - `trace_id`
23
- - `span_id`
24
- - `run_id`
25
- - `session_id`
26
-
27
- ## Disable Mode
28
- Create telemetry with disabled mode for zero-impact execution:
29
-
30
- ```ts
31
- const telemetry = new HarnessTelemetry(false);
32
- ```
@@ -1,51 +0,0 @@
1
- # Providers Guide
2
-
3
- ## ToolProvider
4
- Implement the `ToolProvider` interface to expose agent tools (`Bash`, `Read`, `Write`, `Edit`, `Glob`, `Grep`).
5
-
6
- Included foundations:
7
- - `LocalToolProvider`
8
- - `CompositeToolProvider`
9
- - `E2BToolProvider` (executor-backed adapter)
10
-
11
- ## SandboxProvider
12
- Use `SandboxProvider` for infrastructure actions (skill execution, setup/install tasks). Keep it separate from `ToolProvider`.
13
-
14
- Current sandbox file contract is binary-first:
15
-
16
- ```ts
17
- type SandboxFileBlob = {
18
- data: Uint8Array;
19
- mimeType?: string;
20
- filename?: string;
21
- };
22
-
23
- interface SandboxProvider {
24
- exec(command: string, options?: SandboxExecOptions): Promise<SandboxExecResult>;
25
- readSandboxFile(path: string): Promise<SandboxFileBlob>;
26
- writeSandboxFile(path: string, content: SandboxFileBlob): Promise<void>;
27
- }
28
- ```
29
-
30
- Use `mimeType`/`filename` for transport metadata (for example raw download endpoints). Keep file contents in `data` as bytes.
31
-
32
- ## Capability Routing
33
- `CompositeToolProvider` routes calls to the first provider that advertises each capability.
34
-
35
- ## Default Skill Sandbox
36
- `SkillManager` now defaults to the harness-provided `SkillSandboxProvider`:
37
-
38
- ```ts
39
- const skillManager = new SkillManager();
40
- ```
41
-
42
- Default provider env vars:
43
- - `SAMYX_BASE_URL` or `SANDBOX_BASE_URL`
44
- - `SAMYX_API_KEY` or `SANDBOX_API_KEY`
45
- - optional `SANDBOX_TEMPLATE` (default: `ubuntu-22.04`)
46
-
47
- You can still override with a custom provider:
48
-
49
- ```ts
50
- const skillManager = new SkillManager(customSandboxProvider);
51
- ```
@@ -1,25 +0,0 @@
1
- # Skills Guide
2
-
3
- ## Progressive Disclosure
4
- `SkillManager` stores only summary metadata for prompt injection and loads full `SKILL.md` instructions on invocation.
5
-
6
- ## Skill Routing
7
- `createAgent` uses a `SkillRouter` before invocation:
8
- - direct skill-name match (word boundary)
9
- - alias match (for example `excel -> xlsx`, `word -> docx`, `powerpoint -> pptx`)
10
- - Haiku model fallback for semantic matching
11
-
12
- Environment knobs:
13
- - `HARNESS_SKILL_ROUTER_MODEL` (default: `claude-3-5-haiku-latest`)
14
- - `HARNESS_SKILL_ROUTER_THRESHOLD` (default: `0.55`)
15
-
16
- ## Install Lifecycle
17
- Dependency install state transitions:
18
- - `installing`
19
- - `ready`
20
- - `degraded`
21
-
22
- If install fails, state becomes `degraded` and the error is surfaced.
23
-
24
- ## Security Baseline
25
- See `docs/security/skill-sandbox-threat-model.md` for path traversal and sandbox boundary rules.
@@ -1,20 +0,0 @@
1
- # Skill Sandbox Threat Model
2
-
3
- ## Scope
4
- This document defines the baseline security assumptions for skill execution in harness.
5
-
6
- ## Trust Boundaries
7
- - Skill scripts are untrusted input.
8
- - Sandbox runtime is the security boundary.
9
- - Host filesystem and host network are outside trust boundary.
10
-
11
- ## Controls
12
- - Deny host mounts by default.
13
- - Deny outbound network by default unless explicitly allowed.
14
- - Use tenant-scoped credentials and ephemeral filesystems.
15
- - Disallow path traversal (`..`) in skill paths.
16
-
17
- ## Required Tests
18
- - Sandbox escape attempt should fail.
19
- - Cross-tenant path access should fail.
20
- - Dependency install failures should degrade skill state and block execution until retry.