@toznysecure/teambots-sdk 0.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.
- package/README.md +156 -0
- package/dist/client.d.ts +38 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +129 -0
- package/dist/currents/intentSchemas.d.ts +19 -0
- package/dist/currents/intentSchemas.d.ts.map +1 -0
- package/dist/currents/intentSchemas.js +122 -0
- package/dist/currents/skillMap.d.ts +8 -0
- package/dist/currents/skillMap.d.ts.map +1 -0
- package/dist/currents/skillMap.js +41 -0
- package/dist/errors.d.ts +10 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +65 -0
- package/dist/helpers/capabilities.d.ts +11 -0
- package/dist/helpers/capabilities.d.ts.map +1 -0
- package/dist/helpers/capabilities.js +27 -0
- package/dist/helpers/partnerContext.d.ts +31 -0
- package/dist/helpers/partnerContext.d.ts.map +1 -0
- package/dist/helpers/partnerContext.js +27 -0
- package/dist/helpers/validateToolIntent.d.ts +14 -0
- package/dist/helpers/validateToolIntent.d.ts.map +1 -0
- package/dist/helpers/validateToolIntent.js +31 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/types.d.ts +215 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/package.json +35 -0
package/README.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# @toz/teambots-sdk
|
|
2
|
+
|
|
3
|
+
TypeScript client and **integration contract** for partner apps (Currents, DotClinic, …).
|
|
4
|
+
|
|
5
|
+
**Plan:** `docs/plans/integration-sdk-hardening-plan.md`
|
|
6
|
+
**API reference:** `docs/sdk/INTEGRATION_SDK.md`
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
cd sdk && npm install && npm run build
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Monorepo consumer:
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{ "dependencies": { "@toz/teambots-sdk": "file:../sdk" } }
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import {
|
|
24
|
+
TeamBotsClient,
|
|
25
|
+
CURRENTS_SKILL_CAPABILITY_MAP,
|
|
26
|
+
buildCapabilitiesFromManifest,
|
|
27
|
+
buildPartnerAppContext,
|
|
28
|
+
validateToolIntent,
|
|
29
|
+
} from '@toz/teambots-sdk';
|
|
30
|
+
|
|
31
|
+
const client = new TeamBotsClient({
|
|
32
|
+
baseUrl: 'https://api.teambots.ai/api',
|
|
33
|
+
integrationKey: process.env.TEAMBOTS_INTEGRATION_KEY!,
|
|
34
|
+
appId: 'currents',
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const { manifest } = await client.connectAgent({
|
|
38
|
+
agentEmail: 'maya@tozlabs.teambots.ai',
|
|
39
|
+
appTenantId: companyUuid,
|
|
40
|
+
adminEmail: 'sponsor@toz.com',
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const capabilities = buildCapabilitiesFromManifest(manifest, CURRENTS_SKILL_CAPABILITY_MAP);
|
|
44
|
+
|
|
45
|
+
await client.registerManifestWebhook({
|
|
46
|
+
appTenantId: companyUuid,
|
|
47
|
+
webhookUrl: 'https://app.example.com/webhooks/teambots/manifest-updated',
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const reply = await client.channelChat({
|
|
51
|
+
agentId: manifest.agentId,
|
|
52
|
+
appTenantId: companyUuid,
|
|
53
|
+
messages: [{ role: 'user', content: 'Create a task for sprint review' }],
|
|
54
|
+
appContext: buildPartnerAppContext({
|
|
55
|
+
appName: 'Currents',
|
|
56
|
+
manifestSkills: manifest.skills,
|
|
57
|
+
skillCapabilityMap: CURRENTS_SKILL_CAPABILITY_MAP,
|
|
58
|
+
}),
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
for (const intent of reply.toolIntents) {
|
|
62
|
+
const check = validateToolIntent(intent, manifest, CURRENTS_SKILL_CAPABILITY_MAP, capabilities);
|
|
63
|
+
if (!check.valid) continue;
|
|
64
|
+
// dispatch locally…
|
|
65
|
+
await client.reportToolExecution({
|
|
66
|
+
agentId: manifest.agentId,
|
|
67
|
+
appTenantId: companyUuid,
|
|
68
|
+
skillId: intent.skillId,
|
|
69
|
+
action: intent.action,
|
|
70
|
+
success: true,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Exports
|
|
76
|
+
|
|
77
|
+
| Export | Purpose |
|
|
78
|
+
|--------|---------|
|
|
79
|
+
| `TeamBotsClient` | HTTP client (connect, manifest, chat, audit, webhook) |
|
|
80
|
+
| `CURRENTS_SKILL_CAPABILITY_MAP` | Canonical 30-skill map — **do not copy** |
|
|
81
|
+
| `buildCapabilitiesFromManifest` | Replace-all capability mirror |
|
|
82
|
+
| `validateToolIntent` | Governance gate before local execute |
|
|
83
|
+
| `buildPartnerAppContext` | Required `appContext.partner` payload |
|
|
84
|
+
| `getIntentSchema` / `validateIntentData` | Intent `data` schemas |
|
|
85
|
+
| `INTEGRATION_ERRORS` | Error catalog + remediation |
|
|
86
|
+
|
|
87
|
+
## Version
|
|
88
|
+
|
|
89
|
+
Package version `0.2.0` — echoed on `IntegrationManifest.sdkVersion` from TeamBots API.
|
|
90
|
+
|
|
91
|
+
## Publishing to npm (automatic)
|
|
92
|
+
|
|
93
|
+
This package publishes to **npmjs.com** when you push a git tag. No manual `npm publish` on your laptop unless you want to.
|
|
94
|
+
|
|
95
|
+
### One-time setup
|
|
96
|
+
|
|
97
|
+
1. **Create the SDK repo on GitHub**
|
|
98
|
+
Move everything under `sdk/` to the new repo root (including `sdk/.github` → `.github` at repo root).
|
|
99
|
+
|
|
100
|
+
2. **npm org for `@toz` scope**
|
|
101
|
+
Log in at [npmjs.com](https://www.npmjs.com). Ensure your account (or team) owns the `@toz` scope. Scoped packages need `--access public` on first publish (the workflow already passes this).
|
|
102
|
+
|
|
103
|
+
3. **Create an npm automation token**
|
|
104
|
+
- npm → Account → **Access Tokens** → **Generate New Token**
|
|
105
|
+
- Type: **Automation** (for CI; does not expire on 2FA session)
|
|
106
|
+
- Permissions: publish for `@toz` (or full publish if your org requires it)
|
|
107
|
+
- Copy the token once — you will not see it again.
|
|
108
|
+
|
|
109
|
+
4. **Add the token to GitHub**
|
|
110
|
+
- SDK repo → **Settings** → **Secrets and variables** → **Actions**
|
|
111
|
+
- **New repository secret**
|
|
112
|
+
- Name: `NPM_TOKEN`
|
|
113
|
+
- Value: paste the npm automation token
|
|
114
|
+
|
|
115
|
+
5. **Update `repository.url` in `package.json`**
|
|
116
|
+
Replace `YOUR_ORG/teambots-sdk` with your real GitHub org/repo.
|
|
117
|
+
|
|
118
|
+
6. **First publish (one time, from your machine)** — only if `@toz/teambots-sdk` does not exist on npm yet:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npm login
|
|
122
|
+
npm ci && npm run build
|
|
123
|
+
npm publish --access public
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
After the first publish, CI handles all later releases.
|
|
127
|
+
|
|
128
|
+
### Every release (automatic)
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# From SDK repo root
|
|
132
|
+
chmod +x scripts/release.sh
|
|
133
|
+
./scripts/release.sh 0.2.1
|
|
134
|
+
|
|
135
|
+
git push origin main
|
|
136
|
+
git push origin v0.2.1
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
What happens:
|
|
140
|
+
|
|
141
|
+
1. `release.sh` updates `package.json` and `src/version.ts` to the same version.
|
|
142
|
+
2. It commits and creates tag `v0.2.1`.
|
|
143
|
+
3. Pushing the tag triggers `.github/workflows/publish.yml`.
|
|
144
|
+
4. GitHub Actions builds the SDK and runs `npm publish` using `NPM_TOKEN`.
|
|
145
|
+
|
|
146
|
+
Install in other repos:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
npm install @toz/teambots-sdk@^0.2.1
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Rules
|
|
153
|
+
|
|
154
|
+
- Tag must match `package.json`: tag `v0.2.1` → version `0.2.1`.
|
|
155
|
+
- `src/version.ts` `SDK_VERSION` must match `package.json` (CI checks this).
|
|
156
|
+
- Never re-publish the same version to npm — bump the version for every release.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AgentConnectionResult, AgentLookup, ChannelChatResult, ConnectAgentInput, ConnectOrgInput, CurrentsChatInput, DotClinicTestResult, IntegrationApp, IntegrationManifest, OrgConnection, RegisterManifestWebhookInput, SyncMemoryInput, SyncMemoryResult, TeamBotsClientOptions, ToolExecutionAuditInput } from './types';
|
|
2
|
+
export declare class TeamBotsApiError extends Error {
|
|
3
|
+
status: number;
|
|
4
|
+
constructor(message: string, status: number);
|
|
5
|
+
}
|
|
6
|
+
export declare class TeamBotsClient {
|
|
7
|
+
private baseUrl;
|
|
8
|
+
private integrationKey;
|
|
9
|
+
private appId;
|
|
10
|
+
private fetchImpl;
|
|
11
|
+
constructor(options: TeamBotsClientOptions);
|
|
12
|
+
private integrationHeaders;
|
|
13
|
+
private request;
|
|
14
|
+
listApps(): Promise<IntegrationApp[]>;
|
|
15
|
+
connectOrg(input: ConnectOrgInput): Promise<OrgConnection>;
|
|
16
|
+
lookupAgent(email: string, appTenantId?: string): Promise<AgentLookup>;
|
|
17
|
+
connectAgent(input: ConnectAgentInput): Promise<AgentConnectionResult>;
|
|
18
|
+
getManifest(agentId: string, opts?: {
|
|
19
|
+
organizationId?: string;
|
|
20
|
+
appTenantId?: string;
|
|
21
|
+
}): Promise<IntegrationManifest>;
|
|
22
|
+
syncMemory(agentId: string, input: SyncMemoryInput, opts?: {
|
|
23
|
+
organizationId?: string;
|
|
24
|
+
appTenantId?: string;
|
|
25
|
+
}): Promise<SyncMemoryResult>;
|
|
26
|
+
currentsChat(input: CurrentsChatInput): Promise<ChannelChatResult>;
|
|
27
|
+
/** Alias for app-specific channel routes (Currents today; DotClinic future). */
|
|
28
|
+
channelChat(input: CurrentsChatInput): Promise<ChannelChatResult>;
|
|
29
|
+
reportToolExecution(input: ToolExecutionAuditInput): Promise<{
|
|
30
|
+
recorded: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
registerManifestWebhook(input: RegisterManifestWebhookInput): Promise<{
|
|
33
|
+
registered: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
/** Human-auth endpoint — requires Bearer or x-user-id on fetchImpl override. */
|
|
36
|
+
testDotClinic(practice: string, userHeaders?: Record<string, string>): Promise<DotClinicTestResult>;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,4BAA4B,EAC5B,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AASjB,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,MAAM,EAAE,MAAM,CAAC;gBAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAK5C;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAe;gBAEpB,OAAO,EAAE,qBAAqB;IAO1C,OAAO,CAAC,kBAAkB;YAQZ,OAAO;IAsBf,QAAQ,IAAI,OAAO,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"__esModule", { value: true });
|
|
3
|
+
exports.TeamBotsClient = exports.TeamBotsApiError = void 0;
|
|
4
|
+
const errors_1 = require("./errors");
|
|
5
|
+
class TeamBotsApiError extends Error {
|
|
6
|
+
status;
|
|
7
|
+
constructor(message, status) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = 'TeamBotsApiError';
|
|
10
|
+
this.status = status;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.TeamBotsApiError = TeamBotsApiError;
|
|
14
|
+
class TeamBotsClient {
|
|
15
|
+
baseUrl;
|
|
16
|
+
integrationKey;
|
|
17
|
+
appId;
|
|
18
|
+
fetchImpl;
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.baseUrl = options.baseUrl.replace(/\/$/, '');
|
|
21
|
+
this.integrationKey = options.integrationKey;
|
|
22
|
+
this.appId = options.appId;
|
|
23
|
+
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
24
|
+
}
|
|
25
|
+
integrationHeaders() {
|
|
26
|
+
return {
|
|
27
|
+
'Content-Type': 'application/json',
|
|
28
|
+
'x-integration-key': this.integrationKey,
|
|
29
|
+
'x-app-id': this.appId,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
async request(path, init = {}) {
|
|
33
|
+
const headers = new Headers(init.headers);
|
|
34
|
+
for (const [key, value] of Object.entries(this.integrationHeaders())) {
|
|
35
|
+
if (!headers.has(key))
|
|
36
|
+
headers.set(key, value);
|
|
37
|
+
}
|
|
38
|
+
const response = await this.fetchImpl(`${this.baseUrl}${path}`, {
|
|
39
|
+
...init,
|
|
40
|
+
headers,
|
|
41
|
+
});
|
|
42
|
+
const text = await response.text();
|
|
43
|
+
const body = text ? JSON.parse(text) : null;
|
|
44
|
+
if (!response.ok || !body?.success) {
|
|
45
|
+
const info = (0, errors_1.integrationErrorForStatus)(response.status, body?.error);
|
|
46
|
+
throw new TeamBotsApiError(info.message, response.status);
|
|
47
|
+
}
|
|
48
|
+
return body.data;
|
|
49
|
+
}
|
|
50
|
+
async listApps() {
|
|
51
|
+
return this.request('/integrations/apps');
|
|
52
|
+
}
|
|
53
|
+
async connectOrg(input) {
|
|
54
|
+
return this.request('/integrations/orgs/connect', {
|
|
55
|
+
method: 'POST',
|
|
56
|
+
body: JSON.stringify(input),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
async lookupAgent(email, appTenantId) {
|
|
60
|
+
const params = new URLSearchParams({ email });
|
|
61
|
+
if (appTenantId)
|
|
62
|
+
params.set('appTenantId', appTenantId);
|
|
63
|
+
return this.request(`/integrations/agents/lookup?${params}`);
|
|
64
|
+
}
|
|
65
|
+
async connectAgent(input) {
|
|
66
|
+
return this.request('/integrations/agents/connect', {
|
|
67
|
+
method: 'POST',
|
|
68
|
+
body: JSON.stringify(input),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async getManifest(agentId, opts) {
|
|
72
|
+
const params = new URLSearchParams();
|
|
73
|
+
if (opts?.organizationId)
|
|
74
|
+
params.set('organizationId', opts.organizationId);
|
|
75
|
+
if (opts?.appTenantId)
|
|
76
|
+
params.set('appTenantId', opts.appTenantId);
|
|
77
|
+
const qs = params.toString() ? `?${params}` : '';
|
|
78
|
+
return this.request(`/integrations/agents/${agentId}/manifest${qs}`);
|
|
79
|
+
}
|
|
80
|
+
async syncMemory(agentId, input, opts) {
|
|
81
|
+
const params = new URLSearchParams();
|
|
82
|
+
if (opts?.organizationId)
|
|
83
|
+
params.set('organizationId', opts.organizationId);
|
|
84
|
+
if (opts?.appTenantId)
|
|
85
|
+
params.set('appTenantId', opts.appTenantId);
|
|
86
|
+
const qs = params.toString() ? `?${params}` : '';
|
|
87
|
+
return this.request(`/integrations/agents/${agentId}/memories/sync${qs}`, {
|
|
88
|
+
method: 'POST',
|
|
89
|
+
body: JSON.stringify(input),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
async currentsChat(input) {
|
|
93
|
+
return this.request('/integrations/channels/currents/chat', {
|
|
94
|
+
method: 'POST',
|
|
95
|
+
body: JSON.stringify(input),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/** Alias for app-specific channel routes (Currents today; DotClinic future). */
|
|
99
|
+
async channelChat(input) {
|
|
100
|
+
return this.currentsChat(input);
|
|
101
|
+
}
|
|
102
|
+
async reportToolExecution(input) {
|
|
103
|
+
return this.request('/integrations/audit/tool-execution', {
|
|
104
|
+
method: 'POST',
|
|
105
|
+
body: JSON.stringify(input),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
async registerManifestWebhook(input) {
|
|
109
|
+
return this.request('/integrations/webhooks/manifest', {
|
|
110
|
+
method: 'POST',
|
|
111
|
+
body: JSON.stringify(input),
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/** Human-auth endpoint — requires Bearer or x-user-id on fetchImpl override. */
|
|
115
|
+
async testDotClinic(practice, userHeaders = {}) {
|
|
116
|
+
const headers = { ...this.integrationHeaders(), ...userHeaders };
|
|
117
|
+
const response = await this.fetchImpl(`${this.baseUrl}/integrations/dotclinic/test`, {
|
|
118
|
+
method: 'POST',
|
|
119
|
+
headers,
|
|
120
|
+
body: JSON.stringify({ practice }),
|
|
121
|
+
});
|
|
122
|
+
const body = await response.json();
|
|
123
|
+
if (!response.ok) {
|
|
124
|
+
throw new TeamBotsApiError(body?.error || 'DotClinic test failed', response.status);
|
|
125
|
+
}
|
|
126
|
+
return body.data;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.TeamBotsClient = TeamBotsClient;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type JsonSchema = {
|
|
2
|
+
type?: string | string[];
|
|
3
|
+
properties?: Record<string, JsonSchema>;
|
|
4
|
+
required?: string[];
|
|
5
|
+
enum?: unknown[];
|
|
6
|
+
description?: string;
|
|
7
|
+
additionalProperties?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const CURRENTS_INTENT_SCHEMAS: Record<string, JsonSchema>;
|
|
10
|
+
/** Resolve JSON Schema for a TeamBots skill id via capability map. */
|
|
11
|
+
export declare function getIntentSchema(skillId: string): JsonSchema | undefined;
|
|
12
|
+
/** Resolve JSON Schema by partner capability / dispatchTool action name. */
|
|
13
|
+
export declare function getIntentSchemaByAction(action: string): JsonSchema | undefined;
|
|
14
|
+
/** Minimal required-field check (not full JSON Schema validation). */
|
|
15
|
+
export declare function validateIntentData(action: string, data: Record<string, unknown> | undefined): {
|
|
16
|
+
valid: boolean;
|
|
17
|
+
missing?: string[];
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=intentSchemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intentSchemas.d.ts","sourceRoot":"","sources":["../../src/currents/intentSchemas.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAKF,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAqF9D,CAAC;AAEF,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAIvE;AAED,4EAA4E;AAC5E,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAE9E;AAED,sEAAsE;AACtE,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACxC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CASxC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CURRENTS_INTENT_SCHEMAS = void 0;
|
|
4
|
+
exports.getIntentSchema = getIntentSchema;
|
|
5
|
+
exports.getIntentSchemaByAction = getIntentSchemaByAction;
|
|
6
|
+
exports.validateIntentData = validateIntentData;
|
|
7
|
+
/**
|
|
8
|
+
* JSON Schema (draft-07 subset) for Currents tool intent `data` payloads.
|
|
9
|
+
* @see docs/integrations/CURRENTS_CAPABILITY_MAP.md
|
|
10
|
+
*/
|
|
11
|
+
const skillMap_1 = require("./skillMap");
|
|
12
|
+
const PRIORITY = { type: 'string', enum: ['low', 'medium', 'high', 'critical'] };
|
|
13
|
+
const CARD_TYPE = { type: 'string', enum: ['task', 'idea'] };
|
|
14
|
+
exports.CURRENTS_INTENT_SCHEMAS = {
|
|
15
|
+
create_cards: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
required: ['title'],
|
|
18
|
+
properties: {
|
|
19
|
+
title: { type: 'string', description: 'Card title' },
|
|
20
|
+
description: { type: 'string' },
|
|
21
|
+
type: CARD_TYPE,
|
|
22
|
+
project_id: { type: 'string' },
|
|
23
|
+
assignee_id: { type: 'string' },
|
|
24
|
+
assignee_name: { type: 'string', description: '"you" | "me" | display name' },
|
|
25
|
+
priority: PRIORITY,
|
|
26
|
+
due_date: { type: 'string', description: 'ISO date YYYY-MM-DD' },
|
|
27
|
+
status: { type: 'string' },
|
|
28
|
+
team_id: { type: 'string' },
|
|
29
|
+
team_name: { type: 'string' },
|
|
30
|
+
sprint_id: { type: 'string' },
|
|
31
|
+
sprint_name: { type: 'string' },
|
|
32
|
+
roadmap_id: { type: 'string' },
|
|
33
|
+
parent_id: { type: 'string' },
|
|
34
|
+
},
|
|
35
|
+
additionalProperties: true,
|
|
36
|
+
},
|
|
37
|
+
update_cards: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: {
|
|
40
|
+
cardId: { type: 'string' },
|
|
41
|
+
id: { type: 'string' },
|
|
42
|
+
title: { type: 'string' },
|
|
43
|
+
description: { type: 'string' },
|
|
44
|
+
type: CARD_TYPE,
|
|
45
|
+
assignee_id: { type: 'string' },
|
|
46
|
+
assignee_name: { type: 'string' },
|
|
47
|
+
priority: PRIORITY,
|
|
48
|
+
due_date: { type: 'string' },
|
|
49
|
+
status: { type: 'string' },
|
|
50
|
+
team_id: { type: 'string' },
|
|
51
|
+
team_name: { type: 'string' },
|
|
52
|
+
sprint_id: { type: 'string' },
|
|
53
|
+
sprint_name: { type: 'string' },
|
|
54
|
+
roadmap_id: { type: 'string' },
|
|
55
|
+
url: { type: 'string', description: 'attach_artifact' },
|
|
56
|
+
},
|
|
57
|
+
additionalProperties: true,
|
|
58
|
+
},
|
|
59
|
+
delete_cards: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
properties: {
|
|
62
|
+
cardId: { type: 'string' },
|
|
63
|
+
id: { type: 'string' },
|
|
64
|
+
title: { type: 'string' },
|
|
65
|
+
},
|
|
66
|
+
additionalProperties: true,
|
|
67
|
+
},
|
|
68
|
+
search_cards: {
|
|
69
|
+
type: 'object',
|
|
70
|
+
properties: {
|
|
71
|
+
title: { type: 'string' },
|
|
72
|
+
type: CARD_TYPE,
|
|
73
|
+
query: { type: 'string' },
|
|
74
|
+
},
|
|
75
|
+
additionalProperties: true,
|
|
76
|
+
},
|
|
77
|
+
create_sprints: {
|
|
78
|
+
type: 'object',
|
|
79
|
+
required: ['name'],
|
|
80
|
+
properties: {
|
|
81
|
+
name: { type: 'string' },
|
|
82
|
+
description: { type: 'string' },
|
|
83
|
+
status: { type: 'string' },
|
|
84
|
+
start_date: { type: 'string' },
|
|
85
|
+
end_date: { type: 'string' },
|
|
86
|
+
project_id: { type: 'string' },
|
|
87
|
+
project_name: { type: 'string' },
|
|
88
|
+
},
|
|
89
|
+
additionalProperties: true,
|
|
90
|
+
},
|
|
91
|
+
link_card_to_sprint_by_name: {
|
|
92
|
+
type: 'object',
|
|
93
|
+
properties: {
|
|
94
|
+
card_title: { type: 'string' },
|
|
95
|
+
sprint_name: { type: 'string' },
|
|
96
|
+
},
|
|
97
|
+
additionalProperties: true,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
/** Resolve JSON Schema for a TeamBots skill id via capability map. */
|
|
101
|
+
function getIntentSchema(skillId) {
|
|
102
|
+
const action = skillMap_1.CURRENTS_SKILL_CAPABILITY_MAP[skillId];
|
|
103
|
+
if (!action)
|
|
104
|
+
return undefined;
|
|
105
|
+
return exports.CURRENTS_INTENT_SCHEMAS[action];
|
|
106
|
+
}
|
|
107
|
+
/** Resolve JSON Schema by partner capability / dispatchTool action name. */
|
|
108
|
+
function getIntentSchemaByAction(action) {
|
|
109
|
+
return exports.CURRENTS_INTENT_SCHEMAS[action];
|
|
110
|
+
}
|
|
111
|
+
/** Minimal required-field check (not full JSON Schema validation). */
|
|
112
|
+
function validateIntentData(action, data) {
|
|
113
|
+
const schema = exports.CURRENTS_INTENT_SCHEMAS[action];
|
|
114
|
+
if (!schema?.required?.length)
|
|
115
|
+
return { valid: true };
|
|
116
|
+
const payload = data ?? {};
|
|
117
|
+
const missing = schema.required.filter((key) => {
|
|
118
|
+
const v = payload[key];
|
|
119
|
+
return v === undefined || v === null || v === '';
|
|
120
|
+
});
|
|
121
|
+
return missing.length === 0 ? { valid: true } : { valid: false, missing };
|
|
122
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical Currents skill id → capability key (dispatchTool name).
|
|
3
|
+
* Single source of truth — import from @toz/teambots-sdk; do not copy.
|
|
4
|
+
* @see docs/integrations/CURRENTS_CAPABILITY_MAP.md
|
|
5
|
+
*/
|
|
6
|
+
export declare const CURRENTS_SKILL_CAPABILITY_MAP: Record<string, string>;
|
|
7
|
+
export declare const CURRENTS_FEDERABLE_SKILL_IDS: string[];
|
|
8
|
+
//# sourceMappingURL=skillMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skillMap.d.ts","sourceRoot":"","sources":["../../src/currents/skillMap.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA+BhE,CAAC;AAEF,eAAO,MAAM,4BAA4B,UAA6C,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CURRENTS_FEDERABLE_SKILL_IDS = exports.CURRENTS_SKILL_CAPABILITY_MAP = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Canonical Currents skill id → capability key (dispatchTool name).
|
|
6
|
+
* Single source of truth — import from @toz/teambots-sdk; do not copy.
|
|
7
|
+
* @see docs/integrations/CURRENTS_CAPABILITY_MAP.md
|
|
8
|
+
*/
|
|
9
|
+
exports.CURRENTS_SKILL_CAPABILITY_MAP = {
|
|
10
|
+
'currents.create_task': 'create_cards',
|
|
11
|
+
'currents.update_task': 'update_cards',
|
|
12
|
+
'currents.delete_task': 'delete_cards',
|
|
13
|
+
'currents.post_status': 'update_cards',
|
|
14
|
+
'currents.attach_artifact': 'update_cards',
|
|
15
|
+
'currents.request_approval': 'update_cards',
|
|
16
|
+
'currents.search_tasks': 'search_cards',
|
|
17
|
+
'currents.create_sprint': 'create_sprints',
|
|
18
|
+
'currents.update_sprint': 'update_sprints',
|
|
19
|
+
'currents.delete_sprint': 'delete_sprints',
|
|
20
|
+
'currents.search_sprints': 'search_sprints',
|
|
21
|
+
'currents.create_roadmap': 'create_roadmaps',
|
|
22
|
+
'currents.update_roadmap': 'update_roadmaps',
|
|
23
|
+
'currents.delete_roadmap': 'delete_roadmaps',
|
|
24
|
+
'currents.search_roadmaps': 'search_roadmaps',
|
|
25
|
+
'currents.create_requirement': 'create_requirements',
|
|
26
|
+
'currents.update_requirement': 'update_requirements',
|
|
27
|
+
'currents.delete_requirement': 'delete_requirements',
|
|
28
|
+
'currents.search_requirements': 'search_requirements',
|
|
29
|
+
'currents.create_project': 'create_projects',
|
|
30
|
+
'currents.update_project': 'update_projects',
|
|
31
|
+
'currents.delete_project': 'delete_projects',
|
|
32
|
+
'currents.create_plan': 'create_plans',
|
|
33
|
+
'currents.update_plan': 'update_plans',
|
|
34
|
+
'currents.delete_plan': 'delete_plans',
|
|
35
|
+
'currents.search_teams': 'search_teams',
|
|
36
|
+
'currents.search_users': 'search_users',
|
|
37
|
+
'currents.share_item': 'share_item',
|
|
38
|
+
'currents.link_github_issue': 'link_github_issue',
|
|
39
|
+
'currents.link_card_to_sprint': 'link_card_to_sprint_by_name',
|
|
40
|
+
};
|
|
41
|
+
exports.CURRENTS_FEDERABLE_SKILL_IDS = Object.keys(exports.CURRENTS_SKILL_CAPABILITY_MAP);
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Partner-facing integration error catalog with remediation hints. */
|
|
2
|
+
export interface IntegrationErrorInfo {
|
|
3
|
+
httpStatus: number;
|
|
4
|
+
code: string;
|
|
5
|
+
message: string;
|
|
6
|
+
remediation: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const INTEGRATION_ERRORS: Record<string, IntegrationErrorInfo>;
|
|
9
|
+
export declare function integrationErrorForStatus(status: number, fallbackMessage?: string): IntegrationErrorInfo;
|
|
10
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAiDnE,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,oBAAoB,CASxG"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.INTEGRATION_ERRORS = void 0;
|
|
4
|
+
exports.integrationErrorForStatus = integrationErrorForStatus;
|
|
5
|
+
exports.INTEGRATION_ERRORS = {
|
|
6
|
+
AUTH_MISSING_KEY: {
|
|
7
|
+
httpStatus: 401,
|
|
8
|
+
code: 'AUTH_MISSING_KEY',
|
|
9
|
+
message: 'Missing or invalid x-integration-key',
|
|
10
|
+
remediation: 'Generate an org-scoped key in TeamBots → Integrations and set x-integration-key + x-app-id headers.',
|
|
11
|
+
},
|
|
12
|
+
AUTH_FORBIDDEN_ORG: {
|
|
13
|
+
httpStatus: 403,
|
|
14
|
+
code: 'AUTH_FORBIDDEN_ORG',
|
|
15
|
+
message: 'Integration key cannot access this organization',
|
|
16
|
+
remediation: 'Use a key scoped to the same TeamBots org as the agent or tenant.',
|
|
17
|
+
},
|
|
18
|
+
ORG_NOT_CONNECTED: {
|
|
19
|
+
httpStatus: 404,
|
|
20
|
+
code: 'ORG_NOT_CONNECTED',
|
|
21
|
+
message: 'App tenant is not connected to a TeamBots organization',
|
|
22
|
+
remediation: 'Call POST /integrations/orgs/connect with teambotsOrgId and appTenantId.',
|
|
23
|
+
},
|
|
24
|
+
AGENT_NOT_FOUND: {
|
|
25
|
+
httpStatus: 404,
|
|
26
|
+
code: 'AGENT_NOT_FOUND',
|
|
27
|
+
message: 'Agent not found for email or id',
|
|
28
|
+
remediation: 'Verify agent email, org connection, and that the agent status is active or paused.',
|
|
29
|
+
},
|
|
30
|
+
AGENT_NOT_CONNECTED: {
|
|
31
|
+
httpStatus: 409,
|
|
32
|
+
code: 'AGENT_NOT_CONNECTED',
|
|
33
|
+
message: 'Agent is not connected to this partner app',
|
|
34
|
+
remediation: 'Call POST /integrations/agents/connect before manifest or chat requests.',
|
|
35
|
+
},
|
|
36
|
+
DOMAIN_NOT_VERIFIED: {
|
|
37
|
+
httpStatus: 409,
|
|
38
|
+
code: 'DOMAIN_NOT_VERIFIED',
|
|
39
|
+
message: 'Admin email domain is not verified for org connection',
|
|
40
|
+
remediation: 'Add the admin email domain to verifiedDomains on org connect.',
|
|
41
|
+
},
|
|
42
|
+
BUDGET_EXCEEDED: {
|
|
43
|
+
httpStatus: 402,
|
|
44
|
+
code: 'BUDGET_EXCEEDED',
|
|
45
|
+
message: 'Agent or org LLM budget exceeded',
|
|
46
|
+
remediation: 'Increase agent budget in TeamBots or wait for billing period reset.',
|
|
47
|
+
},
|
|
48
|
+
MANIFEST_STALE: {
|
|
49
|
+
httpStatus: 409,
|
|
50
|
+
code: 'MANIFEST_STALE',
|
|
51
|
+
message: 'Local capabilities do not match manifest runtimeConfigVersion',
|
|
52
|
+
remediation: 'Refresh manifest from TeamBots or handle manifest-updated webhook.',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
function integrationErrorForStatus(status, fallbackMessage) {
|
|
56
|
+
const match = Object.values(exports.INTEGRATION_ERRORS).find((e) => e.httpStatus === status);
|
|
57
|
+
if (match)
|
|
58
|
+
return match;
|
|
59
|
+
return {
|
|
60
|
+
httpStatus: status,
|
|
61
|
+
code: 'UNKNOWN',
|
|
62
|
+
message: fallbackMessage ?? `Request failed (${status})`,
|
|
63
|
+
remediation: 'Check TeamBots API logs and docs/sdk/INTEGRATION_SDK.md error catalog.',
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IntegrationManifest, ManifestSkill } from '../types';
|
|
2
|
+
export type CapabilityMirror = Record<string, boolean>;
|
|
3
|
+
/**
|
|
4
|
+
* Build a full capability mirror from manifest — **replace-all**, never merge.
|
|
5
|
+
* Every key in skillCapabilityMap gets true/false based on manifest.skills[].
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildCapabilitiesFromManifest(manifest: IntegrationManifest, skillCapabilityMap: Record<string, string>): CapabilityMirror;
|
|
8
|
+
export declare function manifestSkillIds(manifest: IntegrationManifest): Set<string>;
|
|
9
|
+
export declare function manifestCapabilityKeys(manifest: IntegrationManifest): Set<string>;
|
|
10
|
+
export declare function findManifestSkill(manifest: IntegrationManifest, skillId: string): ManifestSkill | undefined;
|
|
11
|
+
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../src/helpers/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAc,MAAM,UAAU,CAAC;AAE/E,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEvD;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,mBAAmB,EAC7B,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACzC,gBAAgB,CAUlB;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,GAAG,CAAC,MAAM,CAAC,CAE3E;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,GAAG,CAAC,MAAM,CAAC,CAIjF;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAE3G"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildCapabilitiesFromManifest = buildCapabilitiesFromManifest;
|
|
4
|
+
exports.manifestSkillIds = manifestSkillIds;
|
|
5
|
+
exports.manifestCapabilityKeys = manifestCapabilityKeys;
|
|
6
|
+
exports.findManifestSkill = findManifestSkill;
|
|
7
|
+
/**
|
|
8
|
+
* Build a full capability mirror from manifest — **replace-all**, never merge.
|
|
9
|
+
* Every key in skillCapabilityMap gets true/false based on manifest.skills[].
|
|
10
|
+
*/
|
|
11
|
+
function buildCapabilitiesFromManifest(manifest, skillCapabilityMap) {
|
|
12
|
+
const enabled = new Set(manifest.skills.map((s) => s.appCapabilityKey ?? skillCapabilityMap[s.id]).filter(Boolean));
|
|
13
|
+
const mirror = {};
|
|
14
|
+
for (const capabilityKey of Object.values(skillCapabilityMap)) {
|
|
15
|
+
mirror[capabilityKey] = enabled.has(capabilityKey);
|
|
16
|
+
}
|
|
17
|
+
return mirror;
|
|
18
|
+
}
|
|
19
|
+
function manifestSkillIds(manifest) {
|
|
20
|
+
return new Set(manifest.skills.map((s) => s.id));
|
|
21
|
+
}
|
|
22
|
+
function manifestCapabilityKeys(manifest) {
|
|
23
|
+
return new Set(manifest.skills.map((s) => s.appCapabilityKey).filter((k) => Boolean(k)));
|
|
24
|
+
}
|
|
25
|
+
function findManifestSkill(manifest, skillId) {
|
|
26
|
+
return manifest.skills.find((s) => s.id === skillId);
|
|
27
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface PartnerSkillContext {
|
|
2
|
+
skillId: string;
|
|
3
|
+
capabilityKey: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PartnerAppContext {
|
|
7
|
+
app: string;
|
|
8
|
+
enabledCapabilityKeys: string[];
|
|
9
|
+
enabledSkills: PartnerSkillContext[];
|
|
10
|
+
senderId?: string;
|
|
11
|
+
senderDisplayName?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Build appContext.partner payload for channel chat (required for federated agents).
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildPartnerAppContext(input: {
|
|
17
|
+
appName: string;
|
|
18
|
+
manifestSkills: Array<{
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
appCapabilityKey?: string;
|
|
22
|
+
}>;
|
|
23
|
+
skillCapabilityMap: Record<string, string>;
|
|
24
|
+
senderId?: string;
|
|
25
|
+
senderDisplayName?: string;
|
|
26
|
+
}): {
|
|
27
|
+
partner: PartnerAppContext;
|
|
28
|
+
};
|
|
29
|
+
/** Merge partner context into an existing appContext object. */
|
|
30
|
+
export declare function withPartnerAppContext(appContext: Record<string, unknown> | undefined, partner: PartnerAppContext): Record<string, unknown>;
|
|
31
|
+
//# sourceMappingURL=partnerContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partnerContext.d.ts","sourceRoot":"","sources":["../../src/helpers/partnerContext.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,aAAa,EAAE,mBAAmB,EAAE,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/E,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GAAG;IAAE,OAAO,EAAE,iBAAiB,CAAA;CAAE,CAgBjC;AAED,gEAAgE;AAChE,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,OAAO,EAAE,iBAAiB,GACzB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildPartnerAppContext = buildPartnerAppContext;
|
|
4
|
+
exports.withPartnerAppContext = withPartnerAppContext;
|
|
5
|
+
/**
|
|
6
|
+
* Build appContext.partner payload for channel chat (required for federated agents).
|
|
7
|
+
*/
|
|
8
|
+
function buildPartnerAppContext(input) {
|
|
9
|
+
const enabledSkills = input.manifestSkills.map((s) => ({
|
|
10
|
+
skillId: s.id,
|
|
11
|
+
capabilityKey: s.appCapabilityKey ?? input.skillCapabilityMap[s.id] ?? s.id,
|
|
12
|
+
label: s.name,
|
|
13
|
+
}));
|
|
14
|
+
return {
|
|
15
|
+
partner: {
|
|
16
|
+
app: input.appName,
|
|
17
|
+
enabledCapabilityKeys: enabledSkills.map((s) => s.capabilityKey),
|
|
18
|
+
enabledSkills,
|
|
19
|
+
senderId: input.senderId,
|
|
20
|
+
senderDisplayName: input.senderDisplayName,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** Merge partner context into an existing appContext object. */
|
|
25
|
+
function withPartnerAppContext(appContext, partner) {
|
|
26
|
+
return { ...appContext, partner };
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IntegrationManifest, ToolIntent } from '../types';
|
|
2
|
+
export interface ValidateToolIntentResult {
|
|
3
|
+
valid: boolean;
|
|
4
|
+
reason?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Validate a tool intent against manifest governance rules.
|
|
8
|
+
*
|
|
9
|
+
* - skillId must appear in manifest.skills[]
|
|
10
|
+
* - action must match manifest skill appCapabilityKey (or skillCapabilityMap fallback)
|
|
11
|
+
* - optional localCapabilities gate (partner-side mirror)
|
|
12
|
+
*/
|
|
13
|
+
export declare function validateToolIntent(intent: ToolIntent, manifest: IntegrationManifest, skillCapabilityMap: Record<string, string>, localCapabilities?: Record<string, boolean>): ValidateToolIntentResult;
|
|
14
|
+
//# sourceMappingURL=validateToolIntent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateToolIntent.d.ts","sourceRoot":"","sources":["../../src/helpers/validateToolIntent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGhE,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,mBAAmB,EAC7B,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1C,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC1C,wBAAwB,CAuB1B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateToolIntent = validateToolIntent;
|
|
4
|
+
const capabilities_1 = require("./capabilities");
|
|
5
|
+
/**
|
|
6
|
+
* Validate a tool intent against manifest governance rules.
|
|
7
|
+
*
|
|
8
|
+
* - skillId must appear in manifest.skills[]
|
|
9
|
+
* - action must match manifest skill appCapabilityKey (or skillCapabilityMap fallback)
|
|
10
|
+
* - optional localCapabilities gate (partner-side mirror)
|
|
11
|
+
*/
|
|
12
|
+
function validateToolIntent(intent, manifest, skillCapabilityMap, localCapabilities) {
|
|
13
|
+
const skill = (0, capabilities_1.findManifestSkill)(manifest, intent.skillId);
|
|
14
|
+
if (!skill) {
|
|
15
|
+
return { valid: false, reason: `Skill "${intent.skillId}" is not in manifest` };
|
|
16
|
+
}
|
|
17
|
+
const expectedAction = skill.appCapabilityKey ?? skillCapabilityMap[intent.skillId];
|
|
18
|
+
if (!expectedAction) {
|
|
19
|
+
return { valid: false, reason: `No capability mapping for skill "${intent.skillId}"` };
|
|
20
|
+
}
|
|
21
|
+
if (intent.action !== expectedAction) {
|
|
22
|
+
return {
|
|
23
|
+
valid: false,
|
|
24
|
+
reason: `action "${intent.action}" does not match expected "${expectedAction}" for skill "${intent.skillId}"`,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (localCapabilities && localCapabilities[expectedAction] === false) {
|
|
28
|
+
return { valid: false, reason: `Capability "${expectedAction}" is disabled locally` };
|
|
29
|
+
}
|
|
30
|
+
return { valid: true };
|
|
31
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { SDK_VERSION } from './version';
|
|
2
|
+
export { TeamBotsClient, TeamBotsApiError } from './client';
|
|
3
|
+
export type { TeamBotsClientOptions, ConnectOrgInput, ConnectAgentInput, CurrentsChatInput, IntegrationApp, AgentLookup, IntegrationManifest, ManifestSkill, ManifestLlmRouting, ManifestSponsorNotificationCategory, ManifestSponsorNotifications, AgentConnectionResult, ChannelChatResult, ToolIntent, OrgConnection, DotClinicTestResult, ToolExecutionAuditInput, ManifestUpdatedWebhookPayload, RegisterManifestWebhookInput, SyncMemoryInput, SyncMemoryResult, } from './types';
|
|
4
|
+
export { CURRENTS_SKILL_CAPABILITY_MAP, CURRENTS_FEDERABLE_SKILL_IDS, } from './currents/skillMap';
|
|
5
|
+
export { CURRENTS_INTENT_SCHEMAS, getIntentSchema, getIntentSchemaByAction, validateIntentData, } from './currents/intentSchemas';
|
|
6
|
+
export type { JsonSchema } from './currents/intentSchemas';
|
|
7
|
+
export { buildCapabilitiesFromManifest, manifestSkillIds, manifestCapabilityKeys, findManifestSkill, } from './helpers/capabilities';
|
|
8
|
+
export type { CapabilityMirror } from './helpers/capabilities';
|
|
9
|
+
export { validateToolIntent } from './helpers/validateToolIntent';
|
|
10
|
+
export type { ValidateToolIntentResult } from './helpers/validateToolIntent';
|
|
11
|
+
export { buildPartnerAppContext, withPartnerAppContext, } from './helpers/partnerContext';
|
|
12
|
+
export type { PartnerAppContext, PartnerSkillContext } from './helpers/partnerContext';
|
|
13
|
+
export { INTEGRATION_ERRORS, integrationErrorForStatus } from './errors';
|
|
14
|
+
export type { IntegrationErrorInfo } from './errors';
|
|
15
|
+
/** @deprecated Use TeamBotsClient — alias for docs that say createIntegrationClient */
|
|
16
|
+
export declare function createIntegrationClient(options: import('./types').TeamBotsClientOptions): TeamBotsClient;
|
|
17
|
+
import { TeamBotsClient } from './client';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5D,YAAY,EACV,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,mCAAmC,EACnC,4BAA4B,EAC5B,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,6BAA6B,EAC7B,4BAA4B,EAC5B,eAAe,EACf,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EACL,6BAA6B,EAC7B,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,YAAY,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAE7E,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEvF,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACzE,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD,uFAAuF;AACvF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,SAAS,EAAE,qBAAqB,GAAG,cAAc,CAExG;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.integrationErrorForStatus = exports.INTEGRATION_ERRORS = exports.withPartnerAppContext = exports.buildPartnerAppContext = exports.validateToolIntent = exports.findManifestSkill = exports.manifestCapabilityKeys = exports.manifestSkillIds = exports.buildCapabilitiesFromManifest = exports.validateIntentData = exports.getIntentSchemaByAction = exports.getIntentSchema = exports.CURRENTS_INTENT_SCHEMAS = exports.CURRENTS_FEDERABLE_SKILL_IDS = exports.CURRENTS_SKILL_CAPABILITY_MAP = exports.TeamBotsApiError = exports.TeamBotsClient = exports.SDK_VERSION = void 0;
|
|
4
|
+
exports.createIntegrationClient = createIntegrationClient;
|
|
5
|
+
var version_1 = require("./version");
|
|
6
|
+
Object.defineProperty(exports, "SDK_VERSION", { enumerable: true, get: function () { return version_1.SDK_VERSION; } });
|
|
7
|
+
var client_1 = require("./client");
|
|
8
|
+
Object.defineProperty(exports, "TeamBotsClient", { enumerable: true, get: function () { return client_1.TeamBotsClient; } });
|
|
9
|
+
Object.defineProperty(exports, "TeamBotsApiError", { enumerable: true, get: function () { return client_1.TeamBotsApiError; } });
|
|
10
|
+
var skillMap_1 = require("./currents/skillMap");
|
|
11
|
+
Object.defineProperty(exports, "CURRENTS_SKILL_CAPABILITY_MAP", { enumerable: true, get: function () { return skillMap_1.CURRENTS_SKILL_CAPABILITY_MAP; } });
|
|
12
|
+
Object.defineProperty(exports, "CURRENTS_FEDERABLE_SKILL_IDS", { enumerable: true, get: function () { return skillMap_1.CURRENTS_FEDERABLE_SKILL_IDS; } });
|
|
13
|
+
var intentSchemas_1 = require("./currents/intentSchemas");
|
|
14
|
+
Object.defineProperty(exports, "CURRENTS_INTENT_SCHEMAS", { enumerable: true, get: function () { return intentSchemas_1.CURRENTS_INTENT_SCHEMAS; } });
|
|
15
|
+
Object.defineProperty(exports, "getIntentSchema", { enumerable: true, get: function () { return intentSchemas_1.getIntentSchema; } });
|
|
16
|
+
Object.defineProperty(exports, "getIntentSchemaByAction", { enumerable: true, get: function () { return intentSchemas_1.getIntentSchemaByAction; } });
|
|
17
|
+
Object.defineProperty(exports, "validateIntentData", { enumerable: true, get: function () { return intentSchemas_1.validateIntentData; } });
|
|
18
|
+
var capabilities_1 = require("./helpers/capabilities");
|
|
19
|
+
Object.defineProperty(exports, "buildCapabilitiesFromManifest", { enumerable: true, get: function () { return capabilities_1.buildCapabilitiesFromManifest; } });
|
|
20
|
+
Object.defineProperty(exports, "manifestSkillIds", { enumerable: true, get: function () { return capabilities_1.manifestSkillIds; } });
|
|
21
|
+
Object.defineProperty(exports, "manifestCapabilityKeys", { enumerable: true, get: function () { return capabilities_1.manifestCapabilityKeys; } });
|
|
22
|
+
Object.defineProperty(exports, "findManifestSkill", { enumerable: true, get: function () { return capabilities_1.findManifestSkill; } });
|
|
23
|
+
var validateToolIntent_1 = require("./helpers/validateToolIntent");
|
|
24
|
+
Object.defineProperty(exports, "validateToolIntent", { enumerable: true, get: function () { return validateToolIntent_1.validateToolIntent; } });
|
|
25
|
+
var partnerContext_1 = require("./helpers/partnerContext");
|
|
26
|
+
Object.defineProperty(exports, "buildPartnerAppContext", { enumerable: true, get: function () { return partnerContext_1.buildPartnerAppContext; } });
|
|
27
|
+
Object.defineProperty(exports, "withPartnerAppContext", { enumerable: true, get: function () { return partnerContext_1.withPartnerAppContext; } });
|
|
28
|
+
var errors_1 = require("./errors");
|
|
29
|
+
Object.defineProperty(exports, "INTEGRATION_ERRORS", { enumerable: true, get: function () { return errors_1.INTEGRATION_ERRORS; } });
|
|
30
|
+
Object.defineProperty(exports, "integrationErrorForStatus", { enumerable: true, get: function () { return errors_1.integrationErrorForStatus; } });
|
|
31
|
+
/** @deprecated Use TeamBotsClient — alias for docs that say createIntegrationClient */
|
|
32
|
+
function createIntegrationClient(options) {
|
|
33
|
+
return new client_2.TeamBotsClient(options);
|
|
34
|
+
}
|
|
35
|
+
const client_2 = require("./client");
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
export interface TeamBotsClientOptions {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
integrationKey: string;
|
|
4
|
+
appId: string;
|
|
5
|
+
fetchImpl?: typeof fetch;
|
|
6
|
+
}
|
|
7
|
+
export interface IntegrationApp {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
docsUrl?: string;
|
|
12
|
+
active: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface OrgConnection {
|
|
15
|
+
id: string;
|
|
16
|
+
organizationId: string;
|
|
17
|
+
appId: string;
|
|
18
|
+
appTenantId: string;
|
|
19
|
+
status: string;
|
|
20
|
+
verifiedDomains: string[];
|
|
21
|
+
connectedAt?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface AgentLookup {
|
|
24
|
+
agentId: string;
|
|
25
|
+
name: string;
|
|
26
|
+
emailIdentity: string;
|
|
27
|
+
status: string;
|
|
28
|
+
organizationId: string;
|
|
29
|
+
organizationSlug: string;
|
|
30
|
+
organizationName: string;
|
|
31
|
+
humanSponsor: string;
|
|
32
|
+
avatar: {
|
|
33
|
+
initials: string;
|
|
34
|
+
tint: string;
|
|
35
|
+
imageUrl?: string;
|
|
36
|
+
};
|
|
37
|
+
jobTitle: string;
|
|
38
|
+
department: string;
|
|
39
|
+
jobFunction: string;
|
|
40
|
+
starterProfileSlug: string;
|
|
41
|
+
profileName?: string;
|
|
42
|
+
jobDescription?: string;
|
|
43
|
+
canConnect: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface ManifestSkill {
|
|
46
|
+
id: string;
|
|
47
|
+
name: string;
|
|
48
|
+
toolId: string;
|
|
49
|
+
risk: string;
|
|
50
|
+
requiresApproval: boolean;
|
|
51
|
+
appCapabilityKey?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface ManifestLlmRouting {
|
|
54
|
+
provider: 'teambots_gateway';
|
|
55
|
+
gatewayMode: 'mock' | 'live';
|
|
56
|
+
channelActivityType: 'channel_message';
|
|
57
|
+
}
|
|
58
|
+
export interface ManifestSponsorNotificationCategory {
|
|
59
|
+
id: string;
|
|
60
|
+
label: string;
|
|
61
|
+
description: string;
|
|
62
|
+
defaultChannels: {
|
|
63
|
+
inApp: boolean;
|
|
64
|
+
email: boolean;
|
|
65
|
+
};
|
|
66
|
+
mirrorInPartnerUi: boolean;
|
|
67
|
+
partnerAlertPriority: 'low' | 'normal' | 'high';
|
|
68
|
+
}
|
|
69
|
+
export interface ManifestSponsorNotifications {
|
|
70
|
+
preferencesUrl: string;
|
|
71
|
+
leadSponsorUserId?: string;
|
|
72
|
+
categories: ManifestSponsorNotificationCategory[];
|
|
73
|
+
}
|
|
74
|
+
export interface IntegrationManifest {
|
|
75
|
+
agentId: string;
|
|
76
|
+
name: string;
|
|
77
|
+
emailIdentity: string;
|
|
78
|
+
status: string;
|
|
79
|
+
organizationId: string;
|
|
80
|
+
organizationSlug: string;
|
|
81
|
+
organizationName: string;
|
|
82
|
+
humanSponsor: string;
|
|
83
|
+
avatar: {
|
|
84
|
+
initials: string;
|
|
85
|
+
tint: string;
|
|
86
|
+
imageUrl?: string;
|
|
87
|
+
};
|
|
88
|
+
jobTitle: string;
|
|
89
|
+
department: string;
|
|
90
|
+
jobFunction: string;
|
|
91
|
+
starterProfileSlug: string;
|
|
92
|
+
profileName?: string;
|
|
93
|
+
jobDescription?: string;
|
|
94
|
+
/** Brain used for partner in-app DM (channel_message activity). */
|
|
95
|
+
defaultBrainId: string;
|
|
96
|
+
defaultBrainDisplayName: string;
|
|
97
|
+
llmRouting: ManifestLlmRouting;
|
|
98
|
+
skills: ManifestSkill[];
|
|
99
|
+
enabledToolIds: string[];
|
|
100
|
+
enabledMcpServerIds: string[];
|
|
101
|
+
runtimeConfigVersion: number;
|
|
102
|
+
/** Monotonic connection sync counter (increments on skill/brain changes). */
|
|
103
|
+
manifestVersion?: number;
|
|
104
|
+
/** ISO timestamp of last manifest sync (partner refresh or connect). */
|
|
105
|
+
lastSyncAt?: string;
|
|
106
|
+
/** Published @toz/teambots-sdk version when manifest was built. */
|
|
107
|
+
sdkVersion?: string;
|
|
108
|
+
/** Where partner channel chat inference runs — gateway fallback when desktop is stopped. */
|
|
109
|
+
partnerAgentRoutingMode?: 'teambots_gateway' | 'openclaw_runtime';
|
|
110
|
+
/** Kasm connect URL when cloud desktop is live — partners open beside channel chat. */
|
|
111
|
+
desktopSessionUrl?: string;
|
|
112
|
+
/** Sponsor notification categories — partners may mirror alerts for users who live in their app. */
|
|
113
|
+
sponsorNotifications?: ManifestSponsorNotifications;
|
|
114
|
+
connectionStatus?: string;
|
|
115
|
+
connectedAt?: string;
|
|
116
|
+
appLocalAgentId?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface AgentConnectionResult {
|
|
119
|
+
connection: {
|
|
120
|
+
id: string;
|
|
121
|
+
agentId: string;
|
|
122
|
+
appId: string;
|
|
123
|
+
appLocalAgentId?: string;
|
|
124
|
+
status: string;
|
|
125
|
+
connectedAt?: string;
|
|
126
|
+
};
|
|
127
|
+
manifest: IntegrationManifest;
|
|
128
|
+
}
|
|
129
|
+
export interface ToolIntent {
|
|
130
|
+
skillId: string;
|
|
131
|
+
action: string;
|
|
132
|
+
data?: Record<string, unknown>;
|
|
133
|
+
}
|
|
134
|
+
export interface ChannelChatResult {
|
|
135
|
+
content: string;
|
|
136
|
+
brainId: string;
|
|
137
|
+
brainDisplayName: string;
|
|
138
|
+
gatewayMode: 'mock' | 'live';
|
|
139
|
+
usage: {
|
|
140
|
+
inputTokens: number;
|
|
141
|
+
outputTokens: number;
|
|
142
|
+
costUsd: number;
|
|
143
|
+
};
|
|
144
|
+
toolIntents: ToolIntent[];
|
|
145
|
+
}
|
|
146
|
+
export interface ConnectOrgInput {
|
|
147
|
+
teambotsOrgId: string;
|
|
148
|
+
appTenantId: string;
|
|
149
|
+
adminEmail: string;
|
|
150
|
+
verifiedDomains?: string[];
|
|
151
|
+
}
|
|
152
|
+
export interface ConnectAgentInput {
|
|
153
|
+
agentEmail: string;
|
|
154
|
+
appTenantId: string;
|
|
155
|
+
adminEmail: string;
|
|
156
|
+
appLocalAgentId?: string;
|
|
157
|
+
}
|
|
158
|
+
export interface CurrentsChatInput {
|
|
159
|
+
agentId: string;
|
|
160
|
+
appTenantId: string;
|
|
161
|
+
messages: Array<{
|
|
162
|
+
role: string;
|
|
163
|
+
content: string;
|
|
164
|
+
}>;
|
|
165
|
+
activityType?: string;
|
|
166
|
+
appContext?: Record<string, unknown>;
|
|
167
|
+
}
|
|
168
|
+
export interface DotClinicTestResult {
|
|
169
|
+
reachable: boolean;
|
|
170
|
+
practice: string;
|
|
171
|
+
agentContext: unknown;
|
|
172
|
+
contextError: string | null;
|
|
173
|
+
}
|
|
174
|
+
export interface ToolExecutionAuditInput {
|
|
175
|
+
agentId: string;
|
|
176
|
+
appTenantId: string;
|
|
177
|
+
skillId: string;
|
|
178
|
+
action: string;
|
|
179
|
+
success: boolean;
|
|
180
|
+
message?: string;
|
|
181
|
+
data?: Record<string, unknown>;
|
|
182
|
+
}
|
|
183
|
+
export interface ManifestUpdatedWebhookPayload {
|
|
184
|
+
event: 'manifest.updated';
|
|
185
|
+
agentId: string;
|
|
186
|
+
appTenantId: string;
|
|
187
|
+
appId: string;
|
|
188
|
+
runtimeConfigVersion: number;
|
|
189
|
+
manifestVersion: number;
|
|
190
|
+
occurredAt: string;
|
|
191
|
+
}
|
|
192
|
+
export interface RegisterManifestWebhookInput {
|
|
193
|
+
appTenantId: string;
|
|
194
|
+
webhookUrl: string;
|
|
195
|
+
}
|
|
196
|
+
export type PartnerMemorySyncTarget = 'memory' | 'training' | 'custom';
|
|
197
|
+
export interface SyncMemoryInput {
|
|
198
|
+
target?: PartnerMemorySyncTarget;
|
|
199
|
+
/** Training slot when target=training: ORG, ROLE, etc. */
|
|
200
|
+
slot?: string;
|
|
201
|
+
/** Custom slug when target=custom */
|
|
202
|
+
customSlug?: string;
|
|
203
|
+
type?: string;
|
|
204
|
+
title: string;
|
|
205
|
+
content: string;
|
|
206
|
+
scope?: 'local' | 'org';
|
|
207
|
+
approved?: boolean;
|
|
208
|
+
approvedByName?: string;
|
|
209
|
+
appendToTraining?: boolean;
|
|
210
|
+
}
|
|
211
|
+
export interface SyncMemoryResult {
|
|
212
|
+
target: PartnerMemorySyncTarget;
|
|
213
|
+
result: unknown;
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB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AAAA,wEAAwE;AACxE,eAAO,MAAM,WAAW,UAAU,CAAC"}
|
package/dist/version.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@toznysecure/teambots-sdk",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "TeamBots Integration SDK — connect hired agents to partner apps",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/tozny/teambots-sdk.git"
|
|
8
|
+
},
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public",
|
|
11
|
+
"registry": "https://registry.npmjs.org"
|
|
12
|
+
},
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"require": "./dist/index.js",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./currents/skillMap": {
|
|
22
|
+
"types": "./dist/currents/skillMap.d.ts",
|
|
23
|
+
"require": "./dist/currents/skillMap.js",
|
|
24
|
+
"import": "./dist/currents/skillMap.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": ["dist"],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc",
|
|
30
|
+
"prepublishOnly": "npm run build"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"typescript": "^5.6.3"
|
|
34
|
+
}
|
|
35
|
+
}
|