@filepad/agent-access-sdk 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Filepad
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,190 @@
1
+ # @filepad/agent-access-sdk
2
+
3
+ Official SDK for connecting external AI agents to Filepad workspaces via **Agent Access**.
4
+
5
+ ## What is Agent Access?
6
+
7
+ Agent Access is Filepad's scoped API for external agents. It lets an outside agent:
8
+
9
+ - Read workspace context (folders, files, skills, search)
10
+ - Read visible workspace signals
11
+ - Read and propose updates to the agent's own home profile
12
+ - Create safe artifacts under `artifacts/`
13
+ - Propose reviewable edits to allowed files
14
+ - Report activity events
15
+ - Receive addressed mailbox notifications from Filepad
16
+
17
+ Agent Access **does not** let external agents directly mutate active workspace files, approve their own proposals, or execute automations.
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ npm install @filepad/agent-access-sdk
23
+ ```
24
+
25
+ Requires Node.js 18+.
26
+
27
+ ## Quick Start
28
+
29
+ ```typescript
30
+ import { FilepadAgentClient } from '@filepad/agent-access-sdk';
31
+
32
+ const client = new FilepadAgentClient({
33
+ baseUrl: 'https://app.filepad.ai/api',
34
+ workspaceId: 'ws_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
35
+ keyId: 'ik_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
36
+ secret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
37
+ });
38
+
39
+ // Verify credentials
40
+ const { scopes } = await client.verifyCredentials();
41
+ console.log('Granted scopes:', scopes);
42
+
43
+ // Read environment
44
+ const env = await client.getEnvironment();
45
+ console.log('Folders:', env.folders.map(f => f.name));
46
+
47
+ // Search workspace
48
+ const search = await client.search('quarterly report', { type: 'keyword', limit: 5 });
49
+ console.log('Results:', search.results.length);
50
+
51
+ // Create artifact
52
+ const { artifact } = await client.createArtifact({
53
+ title: 'Agent Report',
54
+ text: '# Summary\n\nGenerated by external agent.',
55
+ });
56
+ console.log('Artifact:', artifact.id);
57
+
58
+ // Emit event
59
+ const { eventId } = await client.createEvent({
60
+ eventType: 'agent.task.completed',
61
+ payload: { artifactId: artifact.id },
62
+ });
63
+ console.log('Event:', eventId);
64
+
65
+ // Query visible signals
66
+ const signals = await client.getSignals({ status: 'suggested', limit: 10 });
67
+ console.log('Signals:', signals.signals.length);
68
+ if (signals.signals[0]) {
69
+ const signal = await client.getSignal(signals.signals[0].id);
70
+ console.log('Signal:', signal.findingTypeKey, signal.status);
71
+ }
72
+
73
+ // Read Filepad callbacks addressed to this integration
74
+ const mailbox = await client.getMailbox({ unreadOnly: true, limit: 20 });
75
+ console.log('Unread mailbox items:', mailbox.items.length);
76
+ if (mailbox.items.length > 0) {
77
+ await client.ackMailbox(mailbox.items.map(item => item.id));
78
+ }
79
+
80
+ // Read this key's agent home profile
81
+ const profile = await client.getAgentProfile();
82
+ console.log('Agent profile key:', profile.keyId);
83
+ ```
84
+
85
+ ## Authentication
86
+
87
+ Every request is signed with HMAC-SHA256 using your Agent Access key.
88
+
89
+ Create a key in Filepad:
90
+ 1. Open a workspace
91
+ 2. Go to **Settings → Agent Access**
92
+ 3. Click **Create Key**
93
+ 4. Copy the **Key ID** and **Secret** (shown once)
94
+
95
+ The SDK handles signing automatically. You only need to provide `keyId` and `secret` to the client.
96
+
97
+ ## API Reference
98
+
99
+ ### `FilepadAgentClient`
100
+
101
+ #### `verifyCredentials()`
102
+ Returns the integration key id, integration id, workspace id, and granted scopes.
103
+
104
+ #### `getEnvironment()`
105
+ Returns workspace folders and their status.
106
+
107
+ #### `getFileTree()`
108
+ Returns all visible files and folders.
109
+
110
+ #### `getFile(fileNodeId)`
111
+ Reads a file by its node id.
112
+
113
+ #### `getPrompts()` / `getMcpPrompts()` / `getMcpResources()`
114
+ Discover skills and resources.
115
+
116
+ #### `search(query, options?)`
117
+ Search indexed workspace context.
118
+
119
+ #### `createArtifact(params)`
120
+ Create a note artifact under `artifacts/`.
121
+
122
+ #### `proposeEdit(params)`
123
+ Propose a reviewable edit to an allowed file.
124
+
125
+ #### `createEvent(params)`
126
+ Emit an activity event.
127
+
128
+ #### `createSignal(params)`
129
+ Create a signal (requires `signals:write` scope).
130
+
131
+ #### `getSignals(filters?)`
132
+ Query visible workspace signals by type, severity, status, limit, or cursor. Requires `env:read`.
133
+
134
+ #### `getSignal(signalId)`
135
+ Read one visible workspace signal by id. Requires `env:read`.
136
+
137
+ #### `getMailbox(options?)`
138
+ Read Filepad mailbox notifications addressed to this integration. Requires `notifications:read`.
139
+
140
+ #### `ackMailbox(ids)`
141
+ Acknowledge processed mailbox notification ids. Requires `notifications:read`.
142
+
143
+ #### `getAgentProfile(options?)`
144
+ Read this integration's agent home profile files under `agents/integrations/{keyId}/`. Requires `env:read`.
145
+
146
+ #### `updateAgentProfile(params)`
147
+ Propose an append or replacement update to one profile file. Requires `env:read` and `files:propose`; the change waits for human review.
148
+
149
+ ### Error Handling
150
+
151
+ The SDK throws typed errors:
152
+
153
+ - `AuthenticationError` — invalid signature or expired key
154
+ - `ForbiddenScopeError` — missing required scope
155
+ - `NotFoundError` — file or resource not found
156
+ - `RateLimitError` — too many requests
157
+ - `ProposalPathError` — proposal target is not allowed
158
+ - `StaleVersionError` — base version changed during proposal
159
+
160
+ All errors extend `FilepadAgentError` with `code`, `message`, and `status` properties.
161
+
162
+ ```typescript
163
+ import { FilepadAgentError, AuthenticationError } from '@filepad/agent-access-sdk';
164
+
165
+ try {
166
+ await client.getFile('fn_...');
167
+ } catch (err) {
168
+ if (err instanceof AuthenticationError) {
169
+ console.error('Check your key id and secret');
170
+ } else if (err instanceof FilepadAgentError) {
171
+ console.error(err.code, err.message);
172
+ }
173
+ }
174
+ ```
175
+
176
+ ## Scope Reference
177
+
178
+ | Scope | What it allows |
179
+ |-------|----------------|
180
+ | `env:read` | Read folders, file tree, file content, search, skill prompts, MCP resources, and visible signals |
181
+ | `artifacts:write` | Create note artifacts under `artifacts/` |
182
+ | `files:propose` | Create reviewable edit proposals for allowed files |
183
+ | `memory:read` | Read memory entries |
184
+ | `events.write` | Write agent activity events |
185
+ | `signals:write` | Create signals for automation triggers |
186
+ | `notifications:read` | Read and acknowledge Filepad mailbox notifications addressed to this integration |
187
+
188
+ ## License
189
+
190
+ MIT
package/SECURITY.md ADDED
@@ -0,0 +1,23 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Security fixes are provided for the latest published `0.x` release of `@filepad/agent-access-sdk`.
6
+
7
+ ## Reporting a Vulnerability
8
+
9
+ Email security reports to `security@filepad.ai`.
10
+
11
+ Please include:
12
+
13
+ - package name and version
14
+ - affected API surface
15
+ - reproduction steps
16
+ - expected impact
17
+
18
+ Do not open a public issue for vulnerabilities involving authentication, request signing, secrets, or workspace data exposure.
19
+
20
+ ## Secret Handling
21
+
22
+ Agent Access secrets are bearer-equivalent credentials. They are shown once in Filepad and should be stored only in the target agent runtime or secret manager. Rotate a key if the secret is copied into chat, logs, screenshots, or source control.
23
+
package/dist/auth.d.ts ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Serialize a request body into the canonical string representation.
3
+ * - undefined/null → ''
4
+ * - string → used as-is
5
+ * - object → JSON.stringify with standard compact formatting
6
+ */
7
+ export declare function serializeBody(body: unknown): string;
8
+ /**
9
+ * Compute SHA-256 hex digest of a string.
10
+ */
11
+ export declare function sha256Hex(data: string): string;
12
+ /**
13
+ * Build the canonical signing string.
14
+ */
15
+ export declare function buildCanonicalString(params: {
16
+ method: string;
17
+ pathWithQuery: string;
18
+ timestampSeconds: string;
19
+ nonce: string;
20
+ rawBody: string;
21
+ }): string;
22
+ /**
23
+ * Sign a Filepad Agent Access request.
24
+ *
25
+ * @param keyId The integration key id (ik_...)
26
+ * @param secret The plaintext secret
27
+ * @param method HTTP method in any case
28
+ * @param pathWithQuery Full path including query string, exactly as sent
29
+ * @param body Optional request body
30
+ * @returns Headers and raw body to send
31
+ */
32
+ export declare function signRequest(keyId: string, secret: string, method: string, pathWithQuery: string, body?: unknown): {
33
+ headers: Record<string, string>;
34
+ rawBody: string;
35
+ };
36
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAInD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,MAAM,CAST;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,EAAE,OAAO,GACb;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CA2BtD"}
package/dist/auth.js ADDED
@@ -0,0 +1,71 @@
1
+ // FILE MEMO: HMAC-SHA256 request signing for Filepad Agent Access.
2
+ // Canonical string: METHOD\npathWithQuery\ntimestampSeconds\nnonce\nsha256(rawBody)
3
+ import { createHash, createHmac, randomUUID } from 'node:crypto';
4
+ /**
5
+ * Serialize a request body into the canonical string representation.
6
+ * - undefined/null → ''
7
+ * - string → used as-is
8
+ * - object → JSON.stringify with standard compact formatting
9
+ */
10
+ export function serializeBody(body) {
11
+ if (body === undefined || body === null)
12
+ return '';
13
+ if (typeof body === 'string')
14
+ return body;
15
+ return JSON.stringify(body);
16
+ }
17
+ /**
18
+ * Compute SHA-256 hex digest of a string.
19
+ */
20
+ export function sha256Hex(data) {
21
+ return createHash('sha256').update(Buffer.from(data, 'utf8')).digest('hex');
22
+ }
23
+ /**
24
+ * Build the canonical signing string.
25
+ */
26
+ export function buildCanonicalString(params) {
27
+ const bodyHash = sha256Hex(params.rawBody);
28
+ return [
29
+ params.method.toUpperCase(),
30
+ params.pathWithQuery,
31
+ params.timestampSeconds,
32
+ params.nonce,
33
+ bodyHash,
34
+ ].join('\n');
35
+ }
36
+ /**
37
+ * Sign a Filepad Agent Access request.
38
+ *
39
+ * @param keyId The integration key id (ik_...)
40
+ * @param secret The plaintext secret
41
+ * @param method HTTP method in any case
42
+ * @param pathWithQuery Full path including query string, exactly as sent
43
+ * @param body Optional request body
44
+ * @returns Headers and raw body to send
45
+ */
46
+ export function signRequest(keyId, secret, method, pathWithQuery, body) {
47
+ const timestamp = Math.floor(Date.now() / 1000).toString();
48
+ const nonce = randomUUID();
49
+ const rawBody = serializeBody(body);
50
+ const canonical = buildCanonicalString({
51
+ method,
52
+ pathWithQuery,
53
+ timestampSeconds: timestamp,
54
+ nonce,
55
+ rawBody,
56
+ });
57
+ const signature = createHmac('sha256', secret)
58
+ .update(canonical, 'utf8')
59
+ .digest('base64');
60
+ return {
61
+ rawBody,
62
+ headers: {
63
+ 'content-type': 'application/json',
64
+ 'x-integration-key-id': keyId,
65
+ 'x-integration-timestamp': timestamp,
66
+ 'x-integration-nonce': nonce,
67
+ 'x-integration-signature': signature,
68
+ },
69
+ };
70
+ }
71
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,oFAAoF;AAEpF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,IAAa;IACzC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IACnD,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAMpC;IACC,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3C,OAAO;QACL,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE;QAC3B,MAAM,CAAC,aAAa;QACpB,MAAM,CAAC,gBAAgB;QACvB,MAAM,CAAC,KAAK;QACZ,QAAQ;KACT,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CACzB,KAAa,EACb,MAAc,EACd,MAAc,EACd,aAAqB,EACrB,IAAc;IAEd,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3D,MAAM,KAAK,GAAG,UAAU,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IAEpC,MAAM,SAAS,GAAG,oBAAoB,CAAC;QACrC,MAAM;QACN,aAAa;QACb,gBAAgB,EAAE,SAAS;QAC3B,KAAK;QACL,OAAO;KACR,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC;SAC3C,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC;SACzB,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEpB,OAAO;QACL,OAAO;QACP,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,sBAAsB,EAAE,KAAK;YAC7B,yBAAyB,EAAE,SAAS;YACpC,qBAAqB,EAAE,KAAK;YAC5B,yBAAyB,EAAE,SAAS;SACrC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,56 @@
1
+ import type { FilepadAgentClientConfig, GetAgentApiCapabilitiesResponse, GetAgentApiEnvironmentResponse, GetAgentApiFileTreeResponse, GetAgentApiPromptsResponse, GetMcpPromptsResponse, GetMcpResourcesResponse, SearchAgentApiWorkspaceResponse, GetAgentApiFileResponse, CreateAgentApiArtifactRequest, CreateAgentApiArtifactResponse, CreateAgentApiEventRequest, CreateAgentApiEventResponse, CreateAgentApiSignalRequest, CreateAgentApiSignalResponse, AgentSignal, AgentSignalSeverity, AgentSignalStatus, ListAgentSignalsResponse, ListAgentMailboxResponse, AckAgentMailboxResponse, AgentProfile, AgentProfileField, UpdateAgentProfileRequest, UpdateAgentProfileResponse } from './types.js';
2
+ import { McpAdapter } from './mcp.js';
3
+ export declare class FilepadAgentClient {
4
+ private readonly http;
5
+ private readonly workspaceId;
6
+ readonly mcp: McpAdapter;
7
+ constructor(config: FilepadAgentClientConfig);
8
+ /** Verify credentials by calling capabilities. Returns agent identity and granted scopes. */
9
+ verifyCredentials(): Promise<GetAgentApiCapabilitiesResponse>;
10
+ getCapabilities(): Promise<GetAgentApiCapabilitiesResponse>;
11
+ getEnvironment(): Promise<GetAgentApiEnvironmentResponse>;
12
+ getFileTree(): Promise<GetAgentApiFileTreeResponse>;
13
+ getPrompts(): Promise<GetAgentApiPromptsResponse>;
14
+ getMcpPrompts(): Promise<GetMcpPromptsResponse>;
15
+ getMcpResources(): Promise<GetMcpResourcesResponse>;
16
+ getFile(fileNodeId: string): Promise<GetAgentApiFileResponse>;
17
+ getMailbox(options?: {
18
+ limit?: number;
19
+ unreadOnly?: boolean;
20
+ cursor?: string;
21
+ }): Promise<ListAgentMailboxResponse>;
22
+ getSignals(filters?: {
23
+ findingTypeKey?: string | undefined;
24
+ severity?: AgentSignalSeverity | undefined;
25
+ status?: AgentSignalStatus | undefined;
26
+ limit?: number | undefined;
27
+ cursor?: string | undefined;
28
+ }): Promise<ListAgentSignalsResponse>;
29
+ getSignal(signalId: string): Promise<AgentSignal>;
30
+ getAgentProfile(options?: {
31
+ fields?: AgentProfileField[] | undefined;
32
+ }): Promise<AgentProfile>;
33
+ search(query: string, options?: {
34
+ type?: 'semantic' | 'keyword' | 'hybrid';
35
+ limit?: number;
36
+ }): Promise<SearchAgentApiWorkspaceResponse>;
37
+ createArtifact(params: CreateAgentApiArtifactRequest): Promise<CreateAgentApiArtifactResponse>;
38
+ createEvent(params: Omit<CreateAgentApiEventRequest, 'occurredAt' | 'idempotencyKey'> & Partial<Pick<CreateAgentApiEventRequest, 'occurredAt' | 'idempotencyKey'>>): Promise<CreateAgentApiEventResponse>;
39
+ createSignal(params: Omit<CreateAgentApiSignalRequest, 'idempotencyKey'> & Partial<Pick<CreateAgentApiSignalRequest, 'idempotencyKey'>>): Promise<CreateAgentApiSignalResponse>;
40
+ ackMailbox(ids: string[]): Promise<AckAgentMailboxResponse>;
41
+ updateAgentProfile(params: UpdateAgentProfileRequest): Promise<UpdateAgentProfileResponse>;
42
+ proposeEdit(params: {
43
+ fileNodeId: string;
44
+ baseVersionId: string;
45
+ summary: string;
46
+ newText: string;
47
+ baseTextSha256?: string;
48
+ instruction?: string;
49
+ toolName?: string;
50
+ }): Promise<{
51
+ proposalId: string;
52
+ artifactId: string;
53
+ baseVersionId: string;
54
+ }>;
55
+ }
56
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,wBAAwB,EAExB,+BAA+B,EAC/B,8BAA8B,EAC9B,2BAA2B,EAC3B,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EAEvB,+BAA+B,EAC/B,uBAAuB,EACvB,6BAA6B,EAC7B,8BAA8B,EAC9B,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,4BAA4B,EAC5B,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,YAAY,EACZ,iBAAiB,EAEjB,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AA0BtC,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAyB;IAC9C,OAAO,CAAC,QA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ed helpers.
2
+ import { FilepadAgentHttpClient } from './endpoints.js';
3
+ import { McpAdapter } from './mcp.js';
4
+ const AGENT_PROFILE_FIELDS = [
5
+ 'identity',
6
+ 'learnings',
7
+ 'goals',
8
+ 'timeline',
9
+ ];
10
+ function fileNameForProfileField(field) {
11
+ return `${field}.md`;
12
+ }
13
+ function appendAgentProfileEntry(existingText, content) {
14
+ const trimmedContent = content.trim();
15
+ if (!trimmedContent)
16
+ return existingText;
17
+ const entry = [`## ${new Date().toISOString()}`, '', trimmedContent, ''].join('\n');
18
+ const headingMatch = existingText.match(/^(# .+\n)/);
19
+ if (!headingMatch || headingMatch.index !== 0) {
20
+ return `${entry}\n${existingText}`.trimEnd() + '\n';
21
+ }
22
+ const heading = headingMatch[1] ?? '';
23
+ const rest = existingText.slice(heading.length).trimStart();
24
+ return `${heading}\n${entry}${rest}`.trimEnd() + '\n';
25
+ }
26
+ export class FilepadAgentClient {
27
+ http;
28
+ workspaceId;
29
+ mcp;
30
+ constructor(config) {
31
+ this.http = new FilepadAgentHttpClient(config);
32
+ this.workspaceId = config.workspaceId;
33
+ this.mcp = new McpAdapter(this);
34
+ }
35
+ // ── Validation ──
36
+ /** Verify credentials by calling capabilities. Returns agent identity and granted scopes. */
37
+ async verifyCredentials() {
38
+ return this.http.get('/agent-api/v1/capabilities');
39
+ }
40
+ // ── Read ──
41
+ async getCapabilities() {
42
+ return this.http.get('/agent-api/v1/capabilities');
43
+ }
44
+ async getEnvironment() {
45
+ return this.http.get(`/agent-api/v1/workspaces/${encodeURIComponent(this.workspaceId)}/environment`);
46
+ }
47
+ async getFileTree() {
48
+ return this.http.get(`/agent-api/v1/workspaces/${encodeURIComponent(this.workspaceId)}/file-tree`);
49
+ }
50
+ async getPrompts() {
51
+ return this.http.get(`/agent-api/v1/workspaces/${encodeURIComponent(this.workspaceId)}/prompts`);
52
+ }
53
+ async getMcpPrompts() {
54
+ return this.http.get(`/mcp/v1/workspaces/${encodeURIComponent(this.workspaceId)}/prompts`);
55
+ }
56
+ async getMcpResources() {
57
+ return this.http.get(`/mcp/v1/workspaces/${encodeURIComponent(this.workspaceId)}/resources`);
58
+ }
59
+ async getFile(fileNodeId) {
60
+ return this.http.get(`/agent-api/v1/workspaces/${encodeURIComponent(this.workspaceId)}/files/${encodeURIComponent(fileNodeId)}`);
61
+ }
62
+ async getMailbox(options) {
63
+ const params = new URLSearchParams();
64
+ if (options?.limit)
65
+ params.set('limit', String(options.limit));
66
+ if (options?.unreadOnly !== undefined) {
67
+ params.set('unreadOnly', String(options.unreadOnly));
68
+ }
69
+ if (options?.cursor)
70
+ params.set('cursor', options.cursor);
71
+ const query = params.toString();
72
+ return this.http.get(`/agent-api/v1/workspaces/${encodeURIComponent(this.workspaceId)}/mailbox${query ? `?${query}` : ''}`);
73
+ }
74
+ async getSignals(filters) {
75
+ const params = new URLSearchParams();
76
+ if (filters?.findingTypeKey) {
77
+ params.set('findingTypeKey', filters.findingTypeKey);
78
+ }
79
+ if (filters?.severity)
80
+ params.set('severity', filters.severity);
81
+ if (filters?.status)
82
+ params.set('status', filters.status);
83
+ if (filters?.limit)
84
+ params.set('limit', String(filters.limit));
85
+ if (filters?.cursor)
86
+ params.set('cursor', filters.cursor);
87
+ const query = params.toString();
88
+ return this.http.get(`/agent-api/v1/workspaces/${encodeURIComponent(this.workspaceId)}/signals${query ? `?${query}` : ''}`);
89
+ }
90
+ async getSignal(signalId) {
91
+ return this.http.get(`/agent-api/v1/workspaces/${encodeURIComponent(this.workspaceId)}/signals/${encodeURIComponent(signalId)}`);
92
+ }
93
+ async getAgentProfile(options) {
94
+ const capabilities = await this.getCapabilities();
95
+ const requestedFields = options?.fields ?? [...AGENT_PROFILE_FIELDS];
96
+ const tree = await this.getFileTree();
97
+ const pathById = new Map();
98
+ for (const node of tree.nodes) {
99
+ if (node.parentId === null) {
100
+ pathById.set(node.id, node.name);
101
+ continue;
102
+ }
103
+ const parentPath = pathById.get(node.parentId);
104
+ if (parentPath)
105
+ pathById.set(node.id, `${parentPath}/${node.name}`);
106
+ }
107
+ const files = {};
108
+ for (const field of requestedFields) {
109
+ const expectedPath = `agents/integrations/${capabilities.agent.keyId}/${fileNameForProfileField(field)}`;
110
+ const node = tree.nodes.find((candidate) => pathById.get(candidate.id) === expectedPath);
111
+ if (!node)
112
+ continue;
113
+ const file = await this.getFile(node.id);
114
+ files[field] = {
115
+ field,
116
+ path: expectedPath,
117
+ fileNodeId: node.id,
118
+ artifactId: file.artifact?.id ?? null,
119
+ baseVersionId: file.latestVersion?.id ?? null,
120
+ text: file.content.kind === 'inlineText'
121
+ ? (file.content.text ?? '')
122
+ : '',
123
+ };
124
+ }
125
+ return {
126
+ keyId: capabilities.agent.keyId,
127
+ files,
128
+ };
129
+ }
130
+ async search(query, options) {
131
+ const body = {
132
+ query,
133
+ ...(options?.type ? { type: options.type } : {}),
134
+ ...(options?.limit ? { limit: options.limit } : {}),
135
+ };
136
+ return this.http.post(`/agent-api/v1/workspaces/${encodeURIComponent(this.workspaceId)}/search`, body);
137
+ }
138
+ // ── Write ──
139
+ async createArtifact(params) {
140
+ return this.http.post(`/agent-api/v1/workspaces/${encodeURIComponent(this.workspaceId)}/artifacts`, params);
141
+ }
142
+ async createEvent(params) {
143
+ const body = {
144
+ eventType: params.eventType,
145
+ payload: params.payload,
146
+ occurredAt: params.occurredAt ?? new Date().toISOString(),
147
+ idempotencyKey: params.idempotencyKey ?? crypto.randomUUID(),
148
+ };
149
+ return this.http.post(`/agent-api/v1/workspaces/${encodeURIComponent(this.workspaceId)}/events`, body);
150
+ }
151
+ async createSignal(params) {
152
+ const body = {
153
+ findingTypeKey: params.findingTypeKey,
154
+ summary: params.summary,
155
+ severity: params.severity,
156
+ value: params.value,
157
+ idempotencyKey: params.idempotencyKey ?? crypto.randomUUID(),
158
+ };
159
+ return this.http.post(`/agent-api/v1/workspaces/${encodeURIComponent(this.workspaceId)}/signals`, body);
160
+ }
161
+ async ackMailbox(ids) {
162
+ return this.http.post(`/agent-api/v1/workspaces/${encodeURIComponent(this.workspaceId)}/mailbox/ack`, { ids });
163
+ }
164
+ async updateAgentProfile(params) {
165
+ const mode = params.mode ?? 'append';
166
+ const profile = await this.getAgentProfile({ fields: [params.field] });
167
+ const profileFile = profile.files[params.field];
168
+ if (!profileFile) {
169
+ throw new Error(`Agent profile file is missing for field: ${params.field}`);
170
+ }
171
+ if (!profileFile.baseVersionId || !profileFile.artifactId) {
172
+ throw new Error(`Agent profile file is not editable for field: ${params.field}`);
173
+ }
174
+ const newText = mode === 'replace'
175
+ ? params.content
176
+ : appendAgentProfileEntry(profileFile.text, params.content);
177
+ const proposal = await this.proposeEdit({
178
+ fileNodeId: profileFile.fileNodeId,
179
+ baseVersionId: profileFile.baseVersionId,
180
+ summary: `Update agent ${params.field} profile`,
181
+ newText,
182
+ instruction: 'Agent profile update requested through filepad_update_profile.',
183
+ toolName: 'filepad_update_profile',
184
+ });
185
+ return {
186
+ ...proposal,
187
+ field: params.field,
188
+ mode,
189
+ status: 'pending_review',
190
+ };
191
+ }
192
+ // ── Proposals ──
193
+ async proposeEdit(params) {
194
+ return this.http.post(`/agent-api/v1/workspaces/${encodeURIComponent(this.workspaceId)}/files/${encodeURIComponent(params.fileNodeId)}/proposals`, {
195
+ baseVersionId: params.baseVersionId,
196
+ editorKind: 'plainText',
197
+ summary: params.summary,
198
+ ops: {
199
+ type: 'plain_text_replace',
200
+ text: params.newText,
201
+ ...(params.baseTextSha256 ? { baseTextSha256: params.baseTextSha256 } : {}),
202
+ ...(params.instruction ? { instruction: params.instruction } : {}),
203
+ ...(params.toolName ? { toolName: params.toolName } : {}),
204
+ },
205
+ });
206
+ }
207
+ }
208
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAE3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AA+BxD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU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,CAAC,KAAK,UAAU;YAC/C,OAAO;YACP,WAAW,EACT,gEAAgE;YAClE,QAAQ,EAAE,wBAAwB;SACnC,CAAC,CAAC;QAEH,OAAO;YACL,GAAG,QAAQ;YACX,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,IAAI;YACJ,MAAM,EAAE,gBAAgB;SACzB,CAAC;IACJ,CAAC;IAED,kBAAkB;IAElB,KAAK,CAAC,WAAW,CAAC,MAQjB;QACC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CACnB,4BAA4B,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,kBAAkB,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,EAC3H;YACE,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,UAAU,EAAE,WAAW;YACvB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,GAAG,EAAE;gBACH,IAAI,EAAE,oBAAoB;gBAC1B,IAAI,EAAE,MAAM,CAAC,OAAO;gBACpB,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC3E,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClE,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC1D;SACF,CACF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,16 @@
1
+ import type { FilepadAgentClientConfig } from './types.js';
2
+ export declare class FilepadAgentHttpClient {
3
+ private readonly baseUrl;
4
+ private readonly keyId;
5
+ private readonly secret;
6
+ private readonly timeoutMs;
7
+ private readonly maxRetries;
8
+ private readonly retryDelayMs;
9
+ constructor(config: FilepadAgentClientConfig);
10
+ private buildUrl;
11
+ private fetchWithTimeout;
12
+ request<T>(method: string, pathWithQuery: string, body?: unknown): Promise<T>;
13
+ get<T>(pathWithQuery: string): Promise<T>;
14
+ post<T>(pathWithQuery: string, body?: unknown): Promise<T>;
15
+ }
16
+ //# sourceMappingURL=endpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../src/endpoints.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAiB,MAAM,YAAY,CAAC;AAc1E,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAE1B,MAAM,EAAE,wBAAwB;IAS5C,OAAO,CAAC,QAAQ;YAIF,gBAAgB;IAcxB,OAAO,CAAC,CAAC,EACb,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,IAAI,CAAC,EAAE,OAAO,GACb,OAAO,CAAC,CAAC,CAAC;IAkEb,GAAG,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAIzC,IAAI,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CAG3D"}