@on-mission/sdk 0.1.4 → 0.1.9

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 (54) hide show
  1. package/dist/chunk-N26TYEUP.js +50 -0
  2. package/dist/chunk-N26TYEUP.js.map +1 -0
  3. package/dist/debug-log-SHNBLZWL.js +9 -0
  4. package/dist/debug-log-SHNBLZWL.js.map +1 -0
  5. package/dist/index.d.ts +868 -18
  6. package/dist/index.js +15843 -11
  7. package/dist/index.js.map +1 -1
  8. package/package.json +1 -2
  9. package/dist/api.d.ts +0 -20
  10. package/dist/api.d.ts.map +0 -1
  11. package/dist/api.js +0 -39
  12. package/dist/api.js.map +0 -1
  13. package/dist/auth-failure-tracker.d.ts +0 -22
  14. package/dist/auth-failure-tracker.d.ts.map +0 -1
  15. package/dist/auth-failure-tracker.js +0 -31
  16. package/dist/auth-failure-tracker.js.map +0 -1
  17. package/dist/auth.d.ts +0 -65
  18. package/dist/auth.d.ts.map +0 -1
  19. package/dist/auth.js +0 -45
  20. package/dist/auth.js.map +0 -1
  21. package/dist/config.d.ts +0 -39
  22. package/dist/config.d.ts.map +0 -1
  23. package/dist/config.js +0 -28
  24. package/dist/config.js.map +0 -1
  25. package/dist/context.d.ts +0 -24
  26. package/dist/context.d.ts.map +0 -1
  27. package/dist/context.js +0 -22
  28. package/dist/context.js.map +0 -1
  29. package/dist/event-handler.d.ts +0 -16
  30. package/dist/event-handler.d.ts.map +0 -1
  31. package/dist/event-handler.js +0 -27
  32. package/dist/event-handler.js.map +0 -1
  33. package/dist/http-server.d.ts +0 -51
  34. package/dist/http-server.d.ts.map +0 -1
  35. package/dist/http-server.js +0 -163
  36. package/dist/http-server.js.map +0 -1
  37. package/dist/index.d.ts.map +0 -1
  38. package/dist/ingress.d.ts +0 -133
  39. package/dist/ingress.d.ts.map +0 -1
  40. package/dist/ingress.js +0 -89
  41. package/dist/ingress.js.map +0 -1
  42. package/dist/logging.d.ts +0 -63
  43. package/dist/logging.d.ts.map +0 -1
  44. package/dist/logging.js +0 -171
  45. package/dist/logging.js.map +0 -1
  46. package/dist/sdk.d.ts +0 -197
  47. package/dist/sdk.d.ts.map +0 -1
  48. package/dist/sdk.js +0 -435
  49. package/dist/sdk.js.map +0 -1
  50. package/dist/tool-registry.d.ts +0 -49
  51. package/dist/tool-registry.d.ts.map +0 -1
  52. package/dist/tool-registry.js +0 -37
  53. package/dist/tool-registry.js.map +0 -1
  54. package/dist/tsconfig.tsbuildinfo +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@on-mission/sdk",
3
- "version": "0.1.4",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -49,7 +49,6 @@
49
49
  "files": [
50
50
  "dist"
51
51
  ],
52
- "scripts": {},
53
52
  "dependencies": {
54
53
  "@trpc/client": "^11.1.2",
55
54
  "@trpc/server": "^11.1.2"
package/dist/api.d.ts DELETED
@@ -1,20 +0,0 @@
1
- /**
2
- * API Client
3
- *
4
- * Typed tRPC client for all SDK -> Mission gateway communication.
5
- * The public SDK surface stays the same (`mission.auth.get()`, etc.),
6
- * while transport details are centralized here.
7
- */
8
- import type { GatewayRouter } from '@mission/api/gateway';
9
- import { createTRPCProxyClient } from '@trpc/client';
10
- import type { SkillContext } from './context';
11
- type GatewayClient = ReturnType<typeof createTRPCProxyClient<GatewayRouter>>;
12
- export type ApiClient = {
13
- trpc: GatewayClient;
14
- baseUrl: string;
15
- setToken: (token: string) => void;
16
- getToken: () => string;
17
- };
18
- export declare const createApiClient: (ctx: SkillContext) => ApiClient;
19
- export {};
20
- //# sourceMappingURL=api.d.ts.map
package/dist/api.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAiB,MAAM,cAAc,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,aAAa,CAAC,CAAC,CAAA;AAE5E,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,aAAa,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,QAAQ,EAAE,MAAM,MAAM,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,KAAK,YAAY,KAAG,SA+BnD,CAAA"}
package/dist/api.js DELETED
@@ -1,39 +0,0 @@
1
- /**
2
- * API Client
3
- *
4
- * Typed tRPC client for all SDK -> Mission gateway communication.
5
- * The public SDK surface stays the same (`mission.auth.get()`, etc.),
6
- * while transport details are centralized here.
7
- */
8
- import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
9
- export const createApiClient = (ctx) => {
10
- const baseUrl = ctx.apiUrl.replace(/\/$/, '');
11
- let currentToken = ctx.skillToken;
12
- const trpc = createTRPCProxyClient({
13
- links: [
14
- httpBatchLink({
15
- url: `${baseUrl}/api/trpc`,
16
- headers() {
17
- const headers = {
18
- 'X-Mission-Installation-Id': ctx.installationId
19
- };
20
- if (currentToken) {
21
- headers.Authorization = `Bearer ${currentToken}`;
22
- }
23
- return headers;
24
- }
25
- })
26
- ]
27
- });
28
- return {
29
- trpc,
30
- baseUrl,
31
- setToken: (token) => {
32
- currentToken = token;
33
- },
34
- getToken: () => {
35
- return currentToken;
36
- }
37
- };
38
- };
39
- //# sourceMappingURL=api.js.map
package/dist/api.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAYnE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAiB,EAAa,EAAE;IAC9D,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IAC7C,IAAI,YAAY,GAAG,GAAG,CAAC,UAAU,CAAA;IAEjC,MAAM,IAAI,GAAG,qBAAqB,CAAgB;QAChD,KAAK,EAAE;YACL,aAAa,CAAC;gBACZ,GAAG,EAAE,GAAG,OAAO,WAAW;gBAC1B,OAAO;oBACL,MAAM,OAAO,GAA2B;wBACtC,2BAA2B,EAAE,GAAG,CAAC,cAAc;qBAChD,CAAA;oBACD,IAAI,YAAY,EAAE,CAAC;wBACjB,OAAO,CAAC,aAAa,GAAG,UAAU,YAAY,EAAE,CAAA;oBAClD,CAAC;oBACD,OAAO,OAAO,CAAA;gBAChB,CAAC;aACF,CAAC;SACH;KACF,CAAC,CAAA;IAEF,OAAO;QACL,IAAI;QACJ,OAAO;QACP,QAAQ,EAAE,CAAC,KAAa,EAAQ,EAAE;YAChC,YAAY,GAAG,KAAK,CAAA;QACtB,CAAC;QACD,QAAQ,EAAE,GAAW,EAAE;YACrB,OAAO,YAAY,CAAA;QACrB,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
@@ -1,22 +0,0 @@
1
- /**
2
- * Auth Failure Tracker
3
- *
4
- * Tracks consecutive UNAUTHORIZED responses across all authenticated
5
- * SDK operations (heartbeat, token refresh, log flush). After a
6
- * configurable threshold of consecutive failures, fires a callback
7
- * that the SDK uses to self-terminate via process.exit(1).
8
- *
9
- * This triggers Daytona's sandbox restart webhook, which runs the
10
- * existing sandboxRestartWorkflow to re-provision the skill with
11
- * a fresh JWT.
12
- *
13
- * Any successful authenticated call resets the counter to zero.
14
- */
15
- export declare const AUTH_FAILURE_THRESHOLD = 3;
16
- export type AuthFailureTracker = {
17
- recordFailure: () => void;
18
- recordSuccess: () => void;
19
- getFailureCount: () => number;
20
- };
21
- export declare const createAuthFailureTracker: (onThresholdReached: () => void) => AuthFailureTracker;
22
- //# sourceMappingURL=auth-failure-tracker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-failure-tracker.d.ts","sourceRoot":"","sources":["../src/auth-failure-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,sBAAsB,IAAI,CAAA;AAEvC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,aAAa,EAAE,MAAM,IAAI,CAAA;IACzB,aAAa,EAAE,MAAM,IAAI,CAAA;IACzB,eAAe,EAAE,MAAM,MAAM,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,wBAAwB,GACnC,oBAAoB,MAAM,IAAI,KAC7B,kBAeF,CAAA"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Auth Failure Tracker
3
- *
4
- * Tracks consecutive UNAUTHORIZED responses across all authenticated
5
- * SDK operations (heartbeat, token refresh, log flush). After a
6
- * configurable threshold of consecutive failures, fires a callback
7
- * that the SDK uses to self-terminate via process.exit(1).
8
- *
9
- * This triggers Daytona's sandbox restart webhook, which runs the
10
- * existing sandboxRestartWorkflow to re-provision the skill with
11
- * a fresh JWT.
12
- *
13
- * Any successful authenticated call resets the counter to zero.
14
- */
15
- export const AUTH_FAILURE_THRESHOLD = 3;
16
- export const createAuthFailureTracker = (onThresholdReached) => {
17
- const state = { consecutiveFailures: 0 };
18
- return {
19
- recordFailure: () => {
20
- state.consecutiveFailures += 1;
21
- if (state.consecutiveFailures >= AUTH_FAILURE_THRESHOLD) {
22
- onThresholdReached();
23
- }
24
- },
25
- recordSuccess: () => {
26
- state.consecutiveFailures = 0;
27
- },
28
- getFailureCount: () => state.consecutiveFailures
29
- };
30
- };
31
- //# sourceMappingURL=auth-failure-tracker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-failure-tracker.js","sourceRoot":"","sources":["../src/auth-failure-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAA;AAQvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,kBAA8B,EACV,EAAE;IACtB,MAAM,KAAK,GAAG,EAAE,mBAAmB,EAAE,CAAC,EAAE,CAAA;IAExC,OAAO;QACL,aAAa,EAAE,GAAG,EAAE;YAClB,KAAK,CAAC,mBAAmB,IAAI,CAAC,CAAA;YAC9B,IAAI,KAAK,CAAC,mBAAmB,IAAI,sBAAsB,EAAE,CAAC;gBACxD,kBAAkB,EAAE,CAAA;YACtB,CAAC;QACH,CAAC;QACD,aAAa,EAAE,GAAG,EAAE;YAClB,KAAK,CAAC,mBAAmB,GAAG,CAAC,CAAA;QAC/B,CAAC;QACD,eAAe,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,mBAAmB;KACjD,CAAA;AACH,CAAC,CAAA"}
package/dist/auth.d.ts DELETED
@@ -1,65 +0,0 @@
1
- /**
2
- * Auth Module
3
- *
4
- * Unified interface for all authentication credentials.
5
- * `mission.auth.get()` returns a single object containing:
6
- * - User-provided credentials (API keys, tokens, secrets from the connection form)
7
- * - OAuth token data (for managed auth providers like Google, Slack)
8
- *
9
- * Skill authors always call `auth.get()` regardless of auth type.
10
- *
11
- * For managed auth (Nango-backed), the SDK caches tokens and refreshes
12
- * transparently. See docs/technical/architecture/skills/authentication.md.
13
- *
14
- * For custom auth, credentials are collected via a connection form
15
- * defined in mission.json's `auth.credentials` schema.
16
- *
17
- * Transport: tRPC mutation/query via Mission gateway API.
18
- */
19
- import type { ApiClient } from './api';
20
- /**
21
- * OAuth credentials returned for managed auth providers.
22
- * The control plane handles token refresh (via Nango or equivalent).
23
- */
24
- export type OAuthCredentials = {
25
- /** The current access token string. */
26
- accessToken: string;
27
- /** When this token expires (ISO 8601 or epoch ms). */
28
- expiresAt: string | number;
29
- /** Scopes that were granted. */
30
- scopes: string[];
31
- /** The provider identifier (e.g. 'google', 'slack'). */
32
- provider: string;
33
- };
34
- /**
35
- * The unified auth response.
36
- *
37
- * For custom auth (Sentry, Twilio, etc.):
38
- * { credentials: { authToken: 'sntrys_...', organization: 'my-org' } }
39
- *
40
- * For managed OAuth (Gmail, Slack, etc.):
41
- * { credentials: {}, oauth: { accessToken: 'ya29...', ... } }
42
- *
43
- * For mixed (future: OAuth + user-provided extras):
44
- * { credentials: { webhookSecret: '...' }, oauth: { accessToken: '...', ... } }
45
- */
46
- export type AuthCredentials = {
47
- /** User-provided credential values from the connection form. */
48
- credentials: Record<string, string>;
49
- /** OAuth token data. Present when auth.type is "managed". */
50
- oauth?: OAuthCredentials;
51
- };
52
- export type AuthModule = {
53
- /**
54
- * Get all authentication data for this skill installation.
55
- *
56
- * Returns user-provided credentials (API keys, tokens from the
57
- * connection form) and, for managed OAuth providers, a current
58
- * access token that the SDK keeps refreshed.
59
- *
60
- * This is safe to call repeatedly — the SDK caches internally.
61
- */
62
- get: () => Promise<AuthCredentials>;
63
- };
64
- export declare function createAuthModule(api: ApiClient): AuthModule;
65
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAA;IACnB,sDAAsD;IACtD,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;IAC1B,gCAAgC;IAChC,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACnC,6DAA6D;IAC7D,KAAK,CAAC,EAAE,gBAAgB,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB;;;;;;;;OAQG;IACH,GAAG,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAA;CACpC,CAAA;AAID,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,GAAG,UAAU,CAyB3D"}
package/dist/auth.js DELETED
@@ -1,45 +0,0 @@
1
- /**
2
- * Auth Module
3
- *
4
- * Unified interface for all authentication credentials.
5
- * `mission.auth.get()` returns a single object containing:
6
- * - User-provided credentials (API keys, tokens, secrets from the connection form)
7
- * - OAuth token data (for managed auth providers like Google, Slack)
8
- *
9
- * Skill authors always call `auth.get()` regardless of auth type.
10
- *
11
- * For managed auth (Nango-backed), the SDK caches tokens and refreshes
12
- * transparently. See docs/technical/architecture/skills/authentication.md.
13
- *
14
- * For custom auth, credentials are collected via a connection form
15
- * defined in mission.json's `auth.credentials` schema.
16
- *
17
- * Transport: tRPC mutation/query via Mission gateway API.
18
- */
19
- // ─── Factory ─────────────────────────────────────────────────────────────────
20
- export function createAuthModule(api) {
21
- // Cache for managed OAuth tokens
22
- let cachedAuth = null;
23
- const CACHE_TTL_MS = 4 * 60 * 1000; // Refresh 4 min before typical 1h expiry
24
- function isCacheValid() {
25
- if (!cachedAuth)
26
- return false;
27
- // If there's no OAuth component, credentials are static — cache forever
28
- if (!cachedAuth.data.oauth)
29
- return true;
30
- // If there is OAuth, check if the token is still fresh
31
- const elapsed = Date.now() - cachedAuth.fetchedAt;
32
- return elapsed < CACHE_TTL_MS;
33
- }
34
- return {
35
- get: async () => {
36
- if (isCacheValid()) {
37
- return cachedAuth.data;
38
- }
39
- const auth = (await api.trpc.skill.getAuth.query({}));
40
- cachedAuth = { data: auth, fetchedAt: Date.now() };
41
- return auth;
42
- }
43
- };
44
- }
45
- //# sourceMappingURL=auth.js.map
package/dist/auth.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAqDH,gFAAgF;AAEhF,MAAM,UAAU,gBAAgB,CAAC,GAAc;IAC7C,iCAAiC;IACjC,IAAI,UAAU,GAAwD,IAAI,CAAA;IAC1E,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA,CAAC,yCAAyC;IAE5E,SAAS,YAAY;QACnB,IAAI,CAAC,UAAU;YAAE,OAAO,KAAK,CAAA;QAC7B,wEAAwE;QACxE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAA;QACvC,uDAAuD;QACvD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,SAAS,CAAA;QACjD,OAAO,OAAO,GAAG,YAAY,CAAA;IAC/B,CAAC;IAED,OAAO;QACL,GAAG,EAAE,KAAK,IAA8B,EAAE;YACxC,IAAI,YAAY,EAAE,EAAE,CAAC;gBACnB,OAAO,UAAW,CAAC,IAAI,CAAA;YACzB,CAAC;YAED,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAoB,CAAA;YACxE,UAAU,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAA;YAClD,OAAO,IAAI,CAAA;QACb,CAAC;KACF,CAAA;AACH,CAAC"}
package/dist/config.d.ts DELETED
@@ -1,39 +0,0 @@
1
- /**
2
- * Config Module
3
- *
4
- * Fetches per-installation configuration from the control plane.
5
- * Accepts optional defaults so skills always get a complete config
6
- * object without manual merging.
7
- *
8
- * The control plane stores config per Connection. Values are set
9
- * by the user in the App's settings UI (defined by configSchema in
10
- * mission.json). The SDK merges platform values over provided defaults
11
- * so the returned object is always complete.
12
- *
13
- * Transport: tRPC query via Mission gateway API.
14
- *
15
- * See docs/product/apps.md § App configuration state.
16
- */
17
- import type { ApiClient } from './api';
18
- export type ConfigModule = {
19
- /**
20
- * Fetch the full configuration object for this skill installation.
21
- *
22
- * If `defaults` are provided, the SDK merges platform-stored values
23
- * over them, so the result is always a complete `T` with no undefined
24
- * fields. Without defaults, returns whatever the platform has stored.
25
- *
26
- * @example
27
- * ```ts
28
- * const config = await mission.config.get<GmailConfig>({
29
- * watchLabels: ['INBOX'],
30
- * maxResults: 20,
31
- * signatureLine: ''
32
- * })
33
- * // config is guaranteed to have all three fields
34
- * ```
35
- */
36
- get: <T = Record<string, unknown>>(defaults?: Partial<T>) => Promise<T>;
37
- };
38
- export declare function createConfigModule(api: ApiClient): ConfigModule;
39
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,MAAM,YAAY,GAAG;IACzB;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;CACxE,CAAA;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,SAAS,GAAG,YAAY,CAgB/D"}
package/dist/config.js DELETED
@@ -1,28 +0,0 @@
1
- /**
2
- * Config Module
3
- *
4
- * Fetches per-installation configuration from the control plane.
5
- * Accepts optional defaults so skills always get a complete config
6
- * object without manual merging.
7
- *
8
- * The control plane stores config per Connection. Values are set
9
- * by the user in the App's settings UI (defined by configSchema in
10
- * mission.json). The SDK merges platform values over provided defaults
11
- * so the returned object is always complete.
12
- *
13
- * Transport: tRPC query via Mission gateway API.
14
- *
15
- * See docs/product/apps.md § App configuration state.
16
- */
17
- export function createConfigModule(api) {
18
- return {
19
- get: async (defaults) => {
20
- const platformValues = (await api.trpc.skill.getConfig.query({}));
21
- if (defaults) {
22
- return { ...defaults, ...platformValues };
23
- }
24
- return platformValues;
25
- }
26
- };
27
- }
28
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAyBH,MAAM,UAAU,kBAAkB,CAAC,GAAc;IAC/C,OAAO;QACL,GAAG,EAAE,KAAK,EACR,QAAqB,EACT,EAAE;YACd,MAAM,cAAc,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAC1D,EAAE,CACH,CAAe,CAAA;YAEhB,IAAI,QAAQ,EAAE,CAAC;gBACb,OAAO,EAAE,GAAG,QAAQ,EAAE,GAAG,cAAc,EAAO,CAAA;YAChD,CAAC;YAED,OAAO,cAAmB,CAAA;QAC5B,CAAC;KACF,CAAA;AACH,CAAC"}
package/dist/context.d.ts DELETED
@@ -1,24 +0,0 @@
1
- /**
2
- * Skill Context
3
- *
4
- * Bootstrapped from environment variables injected by the Mission control plane
5
- * when it starts the skill process inside the Daytona sandbox.
6
- *
7
- * See docs/technical/architecture/skills/architecture.md §4.5.
8
- */
9
- export type SkillContext = {
10
- /** Mission control plane API base URL. */
11
- apiUrl: string;
12
- /** JWT scoped to this skill installation (for outbound API calls). */
13
- skillToken: string;
14
- /** Stable identifier for this skill installation (per-workspace). */
15
- installationId: string;
16
- /** Port assigned by the control plane for this skill's HTTP server. */
17
- skillPort: number;
18
- };
19
- /**
20
- * Read skill context from process environment variables.
21
- * These are injected by the Mission control plane when starting the skill.
22
- */
23
- export declare function readContextFromEnv(): SkillContext;
24
- //# sourceMappingURL=context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,YAAY,GAAG;IACzB,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAA;IACd,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAA;IAClB,qEAAqE;IACrE,cAAc,EAAE,MAAM,CAAA;IACtB,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,CAQjD"}
package/dist/context.js DELETED
@@ -1,22 +0,0 @@
1
- /**
2
- * Skill Context
3
- *
4
- * Bootstrapped from environment variables injected by the Mission control plane
5
- * when it starts the skill process inside the Daytona sandbox.
6
- *
7
- * See docs/technical/architecture/skills/architecture.md §4.5.
8
- */
9
- /**
10
- * Read skill context from process environment variables.
11
- * These are injected by the Mission control plane when starting the skill.
12
- */
13
- export function readContextFromEnv() {
14
- const portStr = process.env.MISSION_SKILL_PORT;
15
- return {
16
- apiUrl: process.env.MISSION_API_URL ?? 'http://localhost:8665',
17
- skillToken: process.env.MISSION_SKILL_TOKEN ?? '',
18
- installationId: process.env.MISSION_INSTALLATION_ID ?? '',
19
- skillPort: portStr ? Number.parseInt(portStr, 10) : 3000
20
- };
21
- }
22
- //# sourceMappingURL=context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAA;IAC9C,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,uBAAuB;QAC9D,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,EAAE;QACjD,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,EAAE;QACzD,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI;KACzD,CAAA;AACH,CAAC"}
@@ -1,16 +0,0 @@
1
- export type SkillEvent = {
2
- eventType: string;
3
- payload: Record<string, unknown>;
4
- platform: string;
5
- tenantId: string;
6
- };
7
- export type EventHandler = (event: SkillEvent) => Promise<void> | void;
8
- export type EventHandlerRegistry = {
9
- on: (eventName: string, handler: EventHandler) => void;
10
- dispatch: (event: SkillEvent) => Promise<{
11
- handled: boolean;
12
- }>;
13
- hasHandlers: () => boolean;
14
- };
15
- export declare const createEventHandlerRegistry: () => EventHandlerRegistry;
16
- //# sourceMappingURL=event-handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-handler.d.ts","sourceRoot":"","sources":["../src/event-handler.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAEtE,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;IACtD,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;IAC9D,WAAW,EAAE,MAAM,OAAO,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,0BAA0B,QAAO,oBAgC7C,CAAA"}
@@ -1,27 +0,0 @@
1
- export const createEventHandlerRegistry = () => {
2
- const handlers = new Map();
3
- return {
4
- on: (eventName, handler) => {
5
- const existing = handlers.get(eventName) ?? [];
6
- handlers.set(eventName, [...existing, handler]);
7
- },
8
- dispatch: async (event) => {
9
- const specific = handlers.get(event.eventType) ?? [];
10
- const wildcard = handlers.get('*') ?? [];
11
- const all = [...specific, ...wildcard];
12
- if (all.length === 0)
13
- return { handled: false };
14
- for (const handler of all) {
15
- try {
16
- await handler(event);
17
- }
18
- catch (error) {
19
- console.error(`[Events] Handler for '${event.eventType}' failed:`, error);
20
- }
21
- }
22
- return { handled: true };
23
- },
24
- hasHandlers: () => handlers.size > 0
25
- };
26
- };
27
- //# sourceMappingURL=event-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-handler.js","sourceRoot":"","sources":["../src/event-handler.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAyB,EAAE;IACnE,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAA;IAElD,OAAO;QACL,EAAE,EAAE,CAAC,SAAiB,EAAE,OAAqB,EAAQ,EAAE;YACrD,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;YAC9C,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,GAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAA;QACjD,CAAC;QAED,QAAQ,EAAE,KAAK,EAAE,KAAiB,EAAiC,EAAE;YACnE,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;YACpD,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;YACxC,MAAM,GAAG,GAAG,CAAC,GAAG,QAAQ,EAAE,GAAG,QAAQ,CAAC,CAAA;YAEtC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;YAE/C,KAAK,MAAM,OAAO,IAAI,GAAG,EAAE,CAAC;gBAC1B,IAAI,CAAC;oBACH,MAAM,OAAO,CAAC,KAAK,CAAC,CAAA;gBACtB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,KAAK,CACX,yBAAyB,KAAK,CAAC,SAAS,WAAW,EACnD,KAAK,CACN,CAAA;gBACH,CAAC;YACH,CAAC;YAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;QAC1B,CAAC;QAED,WAAW,EAAE,GAAY,EAAE,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC;KAC9C,CAAA;AACH,CAAC,CAAA"}
@@ -1,51 +0,0 @@
1
- /**
2
- * HTTP Server
3
- *
4
- * Internal HTTP server that runs inside the skill's Daytona sandbox.
5
- * This is the inbound entrypoint for all traffic to the skill:
6
- *
7
- * Mission API → Daytona Preview URL → this server:
8
- * POST /_mission/tools/:toolName — tool call dispatch
9
- * GET /_mission/health — health check
10
- * GET /_mission/ping — keep-alive ping (resets Daytona auto-stop)
11
- *
12
- * External services → Daytona Signed Preview URL → this server:
13
- * POST /{ingressPath} — webhook delivery
14
- * GET /{ingressPath} (ws upgrade) — WebSocket stream (e.g., Twilio media)
15
- *
16
- * The server is started by mission.connect() and stopped during graceful shutdown.
17
- * Skill authors never interact with it directly — they register tool handlers
18
- * and ingress handlers through the SDK, and this server routes to them.
19
- *
20
- * See docs/technical/architecture/skills/architecture.md §4.1.
21
- * See docs/technical/architecture/skills/sandbox-runtime.md §2-3.
22
- */
23
- import * as http from 'node:http';
24
- export type RouteHandler = (req: ParsedRequest) => Promise<{
25
- status: number;
26
- headers?: Record<string, string>;
27
- body?: string;
28
- }>;
29
- export type ParsedRequest = {
30
- method: string;
31
- path: string;
32
- headers: Record<string, string>;
33
- body: string;
34
- query: Record<string, string>;
35
- /** The matched route parameter, e.g., the tool name from /_mission/tools/:name */
36
- params: Record<string, string>;
37
- };
38
- export type SkillHttpServer = {
39
- /** Start listening on the given port. */
40
- start: (port: number) => Promise<void>;
41
- /** Stop the server gracefully. */
42
- stop: () => Promise<void>;
43
- /** Register a route handler. Supports simple patterns like /_mission/tools/:name */
44
- route: (method: string, pattern: string, handler: RouteHandler) => void;
45
- /** The underlying Node HTTP server (for WebSocket upgrades if needed). */
46
- server: http.Server | null;
47
- /** The port the server is listening on. */
48
- port: number;
49
- };
50
- export declare function createHttpServer(): SkillHttpServer;
51
- //# sourceMappingURL=http-server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http-server.d.ts","sourceRoot":"","sources":["../src/http-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAIjC,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC;IACzD,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAC,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,yCAAyC;IACzC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC,kCAAkC;IAClC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,oFAAoF;IACpF,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;IACvE,0EAA0E;IAC1E,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;IAC1B,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAmED,wBAAgB,gBAAgB,IAAI,eAAe,CAwGlD"}