@tealbrick/portal 0.3.0-rc.5 → 0.3.0-rc.6

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.
@@ -113,6 +113,8 @@ export interface NativeBridgeOptions<A extends NativeAccess = NativeAccess> {
113
113
  maxActiveTurns?: number;
114
114
  /** Structured operational log. Receives ids, names and status only. */
115
115
  log?: (event: Record<string, unknown>) => void;
116
+ /** Owner-only snapshot of this agent's Portal-granted apps (no credentials), served at /tealbrick/v1/capabilities. */
117
+ appCapabilities?: () => Promise<unknown>;
116
118
  }
117
119
  type Event = {
118
120
  type: string;
@@ -130,7 +130,21 @@ export async function createNativeBridge(options) {
130
130
  return;
131
131
  }
132
132
  if (req.method === 'GET' && url.pathname === '/tealbrick/v1/info') {
133
- json(res, 200, { harness: info.harness, protocol: info.protocol, name: options.name, ...(info.model ? { model: info.model } : {}), capabilities: info.capabilities, unsupported: info.unsupported });
133
+ json(res, 200, { harness: info.harness, protocol: info.protocol, name: options.name, ...(info.model ? { model: info.model } : {}), capabilities: [...info.capabilities, ...(options.appCapabilities ? ['app-capabilities'] : [])], unsupported: info.unsupported });
134
+ return;
135
+ }
136
+ if (req.method === 'GET' && url.pathname === '/tealbrick/v1/capabilities') {
137
+ if (!options.appCapabilities) {
138
+ json(res, 404, { error: 'app_capabilities_unsupported' });
139
+ return;
140
+ }
141
+ try {
142
+ json(res, 200, await options.appCapabilities());
143
+ }
144
+ catch (e) {
145
+ const m = e?.message;
146
+ json(res, 503, { error: typeof m === 'string' && /^[a-z][a-z0-9_]{0,80}$/.test(m) ? m : 'app_capabilities_unavailable' });
147
+ }
134
148
  return;
135
149
  }
136
150
  const match = /^\/eve\/v1\/session(?:\/([a-zA-Z0-9-]+))?(?:\/(stream|cancel|access))?$/.exec(url.pathname);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tealbrick/portal",
3
- "version": "0.3.0-rc.5",
3
+ "version": "0.3.0-rc.6",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [