@tangle-network/create-agent-app 0.61.3 → 0.62.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/create-agent-app",
3
- "version": "0.61.3",
3
+ "version": "0.62.0",
4
4
  "description": "Create a tested Tangle agent application with either a tool loop or a complete chat interface.",
5
5
  "keywords": [
6
6
  "tangle",
@@ -83,7 +83,7 @@ Discovery: **Does the customized agent hold its contract?**
83
83
  then `pnpm dev` to exercise `/chat` for real.
84
84
 
85
85
  Before exposing `/chat`, pass a trusted server-side `HeadlessAuth.authenticate`
86
- resolver to `createWorker`; the default handler refuses work. The resolver must
86
+ resolver to `createHeadlessWorker`; the default handler refuses work. The resolver must
87
87
  validate the session/key, choose the authorized workspace, and enforce budgets.
88
88
  Public discovery intentionally reports this skeleton as not ready. Do not
89
89
  change that claim until the configured product's client flow is proved.
@@ -45,7 +45,7 @@ grounded in real records, never fabricated. See `AGENTS.md` for the full contrac
45
45
  Public `/agent-setup.md`, `/llms.txt` and `/.well-known/tangle-agent.json` describe
46
46
  this skeleton's readiness truthfully. The default `/chat` fails closed with
47
47
  503 `auth.not_configured`. Install a trusted `HeadlessAuth.authenticate`
48
- resolver through `createWorker` before enabling it. Never derive identity from
48
+ resolver through `createHeadlessWorker` before enabling it. Never derive identity from
49
49
  request-body userId/workspaceId. Update the public contract only after proving
50
50
  real authentication, authorization, spending and results. Use the default chat
51
51
  template for the assembled local-key operator API and browser owner setup.
@@ -21,18 +21,18 @@
21
21
  "@tangle-network/agent-app": "__AGENT_APP_VERSION__"
22
22
  },
23
23
  "peerDependencies": {
24
- "@tangle-network/agent-eval": "0.220.1",
24
+ "@tangle-network/agent-eval": "0.220.2",
25
25
  "@tangle-network/agent-integrations": "0.75.4",
26
26
  "@tangle-network/agent-interface": "5.7.0",
27
- "@tangle-network/agent-runtime": "0.343.4"
27
+ "@tangle-network/agent-runtime": "0.344.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@tangle-network/agent-eval": "0.220.1",
30
+ "@tangle-network/agent-eval": "0.220.2",
31
31
  "@tangle-network/agent-integrations": "0.75.4",
32
32
  "@tangle-network/agent-interface": "5.7.0",
33
33
  "@tangle-network/agent-knowledge": "22.0.13",
34
- "@tangle-network/agent-runtime": "0.343.4",
35
- "@tangle-network/sandbox": "0.64.14",
34
+ "@tangle-network/agent-runtime": "0.344.0",
35
+ "@tangle-network/sandbox": "0.64.19",
36
36
  "@types/node": "^22.20.1",
37
37
  "typescript": "^7.0.2",
38
38
  "viem": "^2.0.0",
@@ -109,5 +109,3 @@ export const config = defineAgentApp({
109
109
  // MODEL — omit to resolve from env (TANGLE_API_KEY) at boot via
110
110
  // resolveTangleModelConfig. Pin here only if you need a fixed model.
111
111
  })
112
-
113
- export type Config = typeof config
@@ -1,7 +1,7 @@
1
1
  import { createAgentSurfaceHandler, renderAgentSetupSkill, type AgentSurfaceConfig } from '@tangle-network/agent-app/agent-surfaces'
2
2
 
3
3
  /** The headless skeleton must not advertise customer readiness before auth exists. */
4
- export function agentSurfaces(origin: string) {
4
+ export function headlessAgentSurfaces(origin: string) {
5
5
  const product: AgentSurfaceConfig = {
6
6
  id: '__PACKAGE_NAME__', name: '__PROJECT_NAME__', origin,
7
7
  summary: 'A headless tool-loop development skeleton. External-agent operation is disabled until the product installs trusted authentication and workspace authorization.',
@@ -15,7 +15,7 @@
15
15
  * proposals stay proposals.
16
16
  */
17
17
 
18
- import { agentSurfaces } from './agent-surfaces'
18
+ import { headlessAgentSurfaces } from './agent-surfaces'
19
19
  import { config } from '../agent.config'
20
20
  import { createAgentApp, type AppBindings } from './agent-app'
21
21
  import {
@@ -72,9 +72,9 @@ function buildSystemPrompt(): string {
72
72
  export interface HeadlessAuth {
73
73
  authenticate(request: Request, env: AppBindings): Promise<AppToolContext | null>
74
74
  }
75
- export function createWorker(auth?: HeadlessAuth) { return {
75
+ export function createHeadlessWorker(auth?: HeadlessAuth) { return {
76
76
  async fetch(request: Request, env: AppBindings): Promise<Response> {
77
- const surface = agentSurfaces(new URL(request.url).origin).handle(request)
77
+ const surface = headlessAgentSurfaces(new URL(request.url).origin).handle(request)
78
78
  if (surface) return surface
79
79
  const url = new URL(request.url)
80
80
  if (url.pathname !== '/chat' || request.method !== 'POST') {
@@ -124,4 +124,4 @@ export function createWorker(auth?: HeadlessAuth) { return {
124
124
  },
125
125
  } }
126
126
 
127
- export default createWorker()
127
+ export default createHeadlessWorker()
@@ -24,8 +24,8 @@
24
24
  "@tangle-network/agent-app": "__AGENT_APP_VERSION__",
25
25
  "@tangle-network/agent-gateway": "0.11.4",
26
26
  "@tangle-network/agent-interface": "5.7.0",
27
- "@tangle-network/agent-runtime": "0.343.4",
28
- "@tangle-network/sandbox": "0.64.14",
27
+ "@tangle-network/agent-runtime": "0.344.0",
28
+ "@tangle-network/sandbox": "0.64.19",
29
29
  "better-auth": "^1.7.2",
30
30
  "drizzle-orm": "^0.45.2",
31
31
  "hono": "^4.13.5",
@@ -40,11 +40,11 @@
40
40
  "nanostores": "1.5.4"
41
41
  },
42
42
  "peerDependencies": {
43
- "@tangle-network/agent-eval": "0.220.1",
43
+ "@tangle-network/agent-eval": "0.220.2",
44
44
  "@tangle-network/agent-integrations": "0.75.4"
45
45
  },
46
46
  "devDependencies": {
47
- "@tangle-network/agent-eval": "0.220.1",
47
+ "@tangle-network/agent-eval": "0.220.2",
48
48
  "@tangle-network/agent-integrations": "0.75.4",
49
49
  "@tangle-network/agent-knowledge": "22.0.13",
50
50
  "@cloudflare/workers-types": "^5.20260827.1",
@@ -89,5 +89,3 @@ export const config = {
89
89
  maxOutputTokens: number
90
90
  }
91
91
  }
92
-
93
- export type Config = typeof config
@@ -3,7 +3,7 @@ import { operatorOpenApi } from './openapi'
3
3
  import { config } from '../agent.config'
4
4
 
5
5
  /** Public customer docs, separate from the repository's coding-agent AGENTS.md. */
6
- export function agentSurfaces(origin: string, runEnabled = false) {
6
+ export function chatAgentSurfaces(origin: string, runEnabled = false) {
7
7
  const api = `${origin}/api/operator/v1`
8
8
  const product: AgentSurfaceConfig = {
9
9
  id: '__PACKAGE_NAME__', name: config.name, origin,
@@ -5,8 +5,11 @@ import { TurnStreamDO as SharedTurnStreamDO, TURN_STREAM_STORAGE_KEYS, type Dura
5
5
  * the actual backend execution. Elapsed time alone never proves it stopped.
6
6
  * Auth, atomic admission, fencing and release remain owned by the shared DO.
7
7
  */
8
- export class TurnStreamDO extends SharedTurnStreamDO {
8
+ export class DetachedTurnStreamDO extends SharedTurnStreamDO {
9
9
  protected override async loadActiveLock(): Promise<DurableTurnLock | null> {
10
10
  return await this.state.storage.get<DurableTurnLock>(TURN_STREAM_STORAGE_KEYS.lock) ?? null
11
11
  }
12
12
  }
13
+
14
+ // Preserve the generated Worker binding and its integration entrypoint.
15
+ export { DetachedTurnStreamDO as TurnStreamDO }
@@ -19,9 +19,9 @@
19
19
  * POST /v1/agents/:slug/chat/completions OpenAI-compatible API
20
20
  */
21
21
 
22
- export { TurnStreamDO } from './turn-lock'
22
+ export { DetachedTurnStreamDO as TurnStreamDO } from './turn-lock'
23
23
 
24
- import { agentSurfaces } from './agent-surfaces'
24
+ import { chatAgentSurfaces } from './agent-surfaces'
25
25
  import { createArtifactIndex } from './files'
26
26
  import type { peekWorkspaceSandbox } from '@tangle-network/agent-app/sandbox'
27
27
  import { config } from '../agent.config'
@@ -67,7 +67,7 @@ const defaultAssembly: WorkerAssembly = {
67
67
  }
68
68
 
69
69
  /** Build the Worker around one app assembly. Tests inject the real app with a test database. */
70
- export function createWorker(assembly: WorkerAssembly = defaultAssembly): ExportedHandler<AppEnv> {
70
+ export function createChatWorker(assembly: WorkerAssembly = defaultAssembly): ExportedHandler<AppEnv> {
71
71
  // Reuse the database-backed chat assembly within one Worker environment.
72
72
  // Build the gateway per request so its background work binds to that
73
73
  // request's ExecutionContext. Durable stores remain authoritative.
@@ -85,7 +85,7 @@ export function createWorker(assembly: WorkerAssembly = defaultAssembly): Export
85
85
  return {
86
86
  async fetch(request: Request, rawEnv: AppEnv, ctx: ExecutionContext): Promise<Response> {
87
87
  const env = withLimitAlarms(rawEnv)
88
- const surfaces = agentSurfaces(new URL(env.BETTER_AUTH_URL).origin, env.OPERATOR_RUN_ENABLED === 'true')
88
+ const surfaces = chatAgentSurfaces(new URL(env.BETTER_AUTH_URL).origin, env.OPERATOR_RUN_ENABLED === 'true')
89
89
  const surface = surfaces.handle(request)
90
90
  if (surface) return surface
91
91
  const url = new URL(request.url)
@@ -151,4 +151,4 @@ export function createWorker(assembly: WorkerAssembly = defaultAssembly): Export
151
151
  }
152
152
  }
153
153
 
154
- export default createWorker()
154
+ export default createChatWorker()
@@ -51,7 +51,7 @@ import type { AppEnv } from '../src/env'
51
51
  import { buildGatewayApp, type GatewayAppOptions } from '../src/gateway'
52
52
  import { appSlug } from '../src/sandbox'
53
53
  import { ARTIFACT_ROOT } from '../src/files'
54
- import { createWorker, type WorkerAssembly } from '../src/worker'
54
+ import { createChatWorker as createWorker, type WorkerAssembly } from '../src/worker'
55
55
 
56
56
  const BASE = 'http://localhost:8787'
57
57
  const MODEL = 'test/model-1'
@@ -1,20 +0,0 @@
1
- import { describe, expect, it } from 'vitest'
2
- import worker, { createWorker } from '../src/worker'
3
- import type { AppBindings } from '../src/agent-app'
4
-
5
- const env = {} as AppBindings
6
-
7
- describe('headless external-agent boundary', () => {
8
- it('serves discovery without credentials but never trusts request-body identity', async () => {
9
- const manifest = await worker.fetch(new Request('https://product.example/.well-known/tangle-agent.json'), env)
10
- expect(manifest.status).toBe(200)
11
- expect((await manifest.json() as { ready: boolean }).ready).toBe(false)
12
- const response = await worker.fetch(new Request('https://product.example/chat', {
13
- method: 'POST', headers: { 'content-type': 'application/json' },
14
- body: JSON.stringify({ message: 'run', userId: 'owner', workspaceId: 'other-owner' }),
15
- }), env)
16
- expect(response.status).toBe(503)
17
- const denied = createWorker({ authenticate: async () => null })
18
- expect((await denied.fetch(new Request('https://product.example/chat', { method: 'POST', body: '{}' }), env)).status).toBe(401)
19
- })
20
- })