@vibesdotdev/integrations-penpot 0.0.0-stage → 1.0.0-rc.1

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 (63) hide show
  1. package/LICENSE +126 -0
  2. package/README.md +46 -2
  3. package/dist/client/index.d.ts +5 -0
  4. package/dist/client/index.d.ts.map +1 -0
  5. package/dist/client/index.js +5 -0
  6. package/dist/client/index.js.map +1 -0
  7. package/dist/client/penpot-api.d.ts +70 -0
  8. package/dist/client/penpot-api.d.ts.map +1 -0
  9. package/dist/client/penpot-api.js +241 -0
  10. package/dist/client/penpot-api.js.map +1 -0
  11. package/dist/client/penpot-client.d.ts +50 -0
  12. package/dist/client/penpot-client.d.ts.map +1 -0
  13. package/dist/client/penpot-client.descriptor.d.ts +4 -0
  14. package/dist/client/penpot-client.descriptor.d.ts.map +1 -0
  15. package/dist/client/penpot-client.descriptor.js +6 -0
  16. package/dist/client/penpot-client.descriptor.js.map +1 -0
  17. package/dist/client/penpot-client.js +52 -0
  18. package/dist/client/penpot-client.js.map +1 -0
  19. package/dist/config/penpot.config.descriptor.d.ts +50 -0
  20. package/dist/config/penpot.config.descriptor.d.ts.map +1 -0
  21. package/dist/config/penpot.config.descriptor.js +56 -0
  22. package/dist/config/penpot.config.descriptor.js.map +1 -0
  23. package/dist/index.d.ts +8 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +7 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/plugin.d.ts +4 -0
  28. package/dist/plugin.d.ts.map +1 -0
  29. package/dist/plugin.js +18 -0
  30. package/dist/plugin.js.map +1 -0
  31. package/dist/schemas/board.d.ts +37 -0
  32. package/dist/schemas/board.d.ts.map +1 -0
  33. package/dist/schemas/board.js +20 -0
  34. package/dist/schemas/board.js.map +1 -0
  35. package/dist/schemas/catalog.d.ts +129 -0
  36. package/dist/schemas/catalog.d.ts.map +1 -0
  37. package/dist/schemas/catalog.js +82 -0
  38. package/dist/schemas/catalog.js.map +1 -0
  39. package/dist/schemas/sync.d.ts +212 -0
  40. package/dist/schemas/sync.d.ts.map +1 -0
  41. package/dist/schemas/sync.js +23 -0
  42. package/dist/schemas/sync.js.map +1 -0
  43. package/dist/schemas/transport.d.ts +169 -0
  44. package/dist/schemas/transport.d.ts.map +1 -0
  45. package/dist/schemas/transport.js +93 -0
  46. package/dist/schemas/transport.js.map +1 -0
  47. package/dist/sync/penpot.sync-endpoint.descriptor.d.ts +14 -0
  48. package/dist/sync/penpot.sync-endpoint.descriptor.d.ts.map +1 -0
  49. package/dist/sync/penpot.sync-endpoint.descriptor.js +10 -0
  50. package/dist/sync/penpot.sync-endpoint.descriptor.js.map +1 -0
  51. package/dist/sync/penpot.sync-endpoint.impl.d.ts +31 -0
  52. package/dist/sync/penpot.sync-endpoint.impl.d.ts.map +1 -0
  53. package/dist/sync/penpot.sync-endpoint.impl.js +98 -0
  54. package/dist/sync/penpot.sync-endpoint.impl.js.map +1 -0
  55. package/dist/tokens/apply-penpot-catalog.d.ts +7 -0
  56. package/dist/tokens/apply-penpot-catalog.d.ts.map +1 -0
  57. package/dist/tokens/apply-penpot-catalog.js +40 -0
  58. package/dist/tokens/apply-penpot-catalog.js.map +1 -0
  59. package/dist/tokens/plugin.d.ts +4 -0
  60. package/dist/tokens/plugin.d.ts.map +1 -0
  61. package/dist/tokens/plugin.js +13 -0
  62. package/dist/tokens/plugin.js.map +1 -0
  63. package/package.json +73 -4
package/LICENSE ADDED
@@ -0,0 +1,126 @@
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: VIBES DEV LLC
6
+ Licensed Work: @vibesdotdev/integrations-penpot
7
+ The Licensed Work is (c) 2026 VIBES DEV LLC.
8
+ Additional Use Grant: In this grant, "Vibes Platform" means the hosted services VIBES DEV LLC
9
+ operates at vibes.dev and its subdomains.
10
+
11
+ You may make production use of the Licensed Work, including commercial
12
+ use, subject to the limits below. Permitted production use includes:
13
+ building, operating and selling your own applications, agents and services
14
+ on or with the Vibes Platform; self-hosting the Licensed Work for use inside
15
+ your own organization; and providing consulting, integration or development
16
+ services to clients who build on the Vibes Platform.
17
+
18
+ The production use permitted above does not include use that:
19
+
20
+ (a) offers third parties a hosted, managed or embedded service that
21
+ substitutes for the Vibes Platform or a material part of it (including
22
+ agent hosting; fleet, sandbox or container provisioning; package
23
+ registry; source hosting and continuous integration; and managed AI,
24
+ storage, secrets or messaging), where the Licensed Work provides a
25
+ material part of that service's value and that service earns more than
26
+ US$1,000,000 in gross revenue in any twelve-month period;
27
+ (b) sells, rents, sublicenses or white-labels the Licensed Work, or access
28
+ to Vibes Platform functionality, as a product in its own right;
29
+ (c) removes, disables or works around entitlement checks, usage metering,
30
+ quotas or plan limits, or reaches Vibes Platform features the user's
31
+ account is not entitled to;
32
+ (d) scrapes, bulk-exports or harvests data or content from the Vibes
33
+ Platform or its users other than through documented interfaces and
34
+ within their terms, or uses outputs or data obtained from the Vibes
35
+ Platform to train or improve a product that competes with it;
36
+ (e) violates applicable law, infringes anyone's rights, commits fraud or
37
+ deception, conducts unlawful surveillance or harassment, distributes
38
+ malware, or accesses systems without authorization; or
39
+ (f) violates applicable antitrust or competition law.
40
+
41
+ A written permission from the Licensor extends this grant.
42
+ Change Date: Four years from the date the Licensed Work is published.
43
+ Change License: MIT
44
+
45
+ For information about alternative licensing arrangements for the Licensed Work,
46
+ contact VIBES DEV LLC through https://vibes.dev.
47
+
48
+ Notice
49
+
50
+ The Business Source License (this document, or the "License") is not an Open
51
+ Source license. However, the Licensed Work will eventually be made available
52
+ under an Open Source License, as stated in this License.
53
+
54
+ -----------------------------------------------------------------------------
55
+
56
+ Business Source License 1.1
57
+
58
+ License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
59
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
60
+
61
+ Terms
62
+
63
+ The Licensor hereby grants you the right to copy, modify, create derivative
64
+ works, redistribute, and make non-production use of the Licensed Work. The
65
+ Licensor may make an Additional Use Grant, above, permitting limited
66
+ production use.
67
+
68
+ Effective on the Change Date, or the fourth anniversary of the first publicly
69
+ available distribution of a specific version of the Licensed Work under this
70
+ License, whichever comes first, the Licensor hereby grants you rights under
71
+ the terms of the Change License, and the rights granted in the paragraph
72
+ above terminate.
73
+
74
+ If your use of the Licensed Work does not comply with the requirements
75
+ currently in effect as described in this License, you must purchase a
76
+ commercial license from the Licensor, its affiliated entities, or authorized
77
+ resellers, or you must refrain from using the Licensed Work.
78
+
79
+ All copies of the original and modified Licensed Work, and derivative works
80
+ of the Licensed Work, are subject to this License. This License applies
81
+ separately for each version of the Licensed Work and the Change Date may vary
82
+ for each version of the Licensed Work released by Licensor.
83
+
84
+ You must conspicuously display this License on each original or modified copy
85
+ of the Licensed Work. If you receive the Licensed Work in original or
86
+ modified form from a third party, the terms and conditions set forth in this
87
+ License apply to your use of that work.
88
+
89
+ Any use of the Licensed Work in violation of this License will automatically
90
+ terminate your rights under this License for the current and all other
91
+ versions of the Licensed Work.
92
+
93
+ This License does not grant you any right in any trademark or logo of
94
+ Licensor or its affiliates (provided that you may use a trademark or logo of
95
+ Licensor as expressly required by this License).
96
+
97
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
98
+ AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
99
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
100
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
101
+ TITLE.
102
+
103
+ MariaDB hereby grants you permission to use this License’s text to license
104
+ your works, and to refer to it using the trademark “Business Source License”,
105
+ as long as you comply with the Covenants of Licensor below.
106
+
107
+ Covenants of Licensor
108
+
109
+ In consideration of the right to use this License’s text and the “Business
110
+ Source License” name and trademark, Licensor covenants to MariaDB, and to all
111
+ other recipients of the licensed work to be provided by Licensor:
112
+
113
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
114
+ or a license that is compatible with GPL Version 2.0 or a later version,
115
+ where “compatible” means that software provided under the Change License can
116
+ be included in a program with software provided under GPL Version 2.0 or a
117
+ later version. Licensor may specify additional Change Licenses without
118
+ limitation.
119
+
120
+ 2. To either: (a) specify an additional grant of rights to use that does not
121
+ impose any additional restriction on the right granted in this License, as
122
+ the Additional Use Grant; or (b) insert the text “None”.
123
+
124
+ 3. To specify a Change Date.
125
+
126
+ 4. Not to modify this License in any other way.
package/README.md CHANGED
@@ -1,3 +1,47 @@
1
- # Temporary Holding Version
1
+ # @vibesdotdev/integrations-penpot
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Runtime-owned Penpot API, token synchronization, and native catalog application.
4
+ See [SPEC.md](SPEC.md) for supported formats and typed refusals.
5
+
6
+ Compose Storage (with the host's adapter), Config, and Sync before
7
+ `@vibesdotdev/integrations-penpot/plugin`. The host must also compose those
8
+ owners' dependencies, including runtime-client, context, and logging.
9
+
10
+ ```ts
11
+ import { getVibesClient } from '@vibesdotdev/kernel/client';
12
+ import type { PenpotClient } from '@vibesdotdev/integrations-penpot';
13
+
14
+ const penpot = await getVibesClient<PenpotClient>('integrations-penpot', runtime);
15
+ const catalogs = await penpot.pullTokens({ fileId: 'your-file-id' });
16
+ ```
17
+
18
+ The registered endpoint is `sync.endpoint.vibes.design-tokens.penpot`, resolved
19
+ through `runtime.query('sync/endpoint').withId(id).resolve()`. It supports bounded
20
+ pulls and upserts. Archive/delete operations refuse.
21
+
22
+ Configure `integrations.penpot` through the Config owner:
23
+
24
+ ```ts
25
+ { baseUrl: 'https://your-penpot.example', tokensPath: '/your-token-endpoint' }
26
+ ```
27
+
28
+ Defaults are `https://design.vibes.dev` and `/api/rpc/command/get-file`.
29
+ The semantic client uses RPC; `tokensPath` configures the standalone
30
+ `HttpPenpotTokensClient`. Explicit constructor settings override runtime settings.
31
+
32
+ Provision `PENPOT_ACCESS_TOKEN` and/or `PENPOT_SESSION_COOKIE` through the
33
+ runtime secret owner. Standalone `accessToken`/`sessionCookie` options override
34
+ their respective secret references. Missing credentials permit anonymous requests.
35
+ There are no automatic environment reads.
36
+
37
+ The root and `./client` preserve API/RPC/HTTP clients and the in-memory store.
38
+ `./sync` preserves standalone endpoint construction; hosts normally use runtime
39
+ resolution. Root catalog helpers apply supported Tokens Studio color/borderRadius
40
+ sets and themes after full validation. Descriptions, source-only sets, and other
41
+ unrepresentable data refuse before replacement.
42
+
43
+ RPC reads current and legacy plugin-data catalogs; writes replace only the same
44
+ preset in the single catalog slot. Another preset refuses to prevent data loss.
45
+ HTTP compatibility accepts the formats described in SPEC and requires a recognized
46
+ write acknowledgement. Invalid timestamps, malformed data, mismatched identities,
47
+ and failed HTTP requests produce typed refusals with safe messages.
@@ -0,0 +1,5 @@
1
+ export * from '../schemas/board.ts';
2
+ export { UpdateAcknowledgementSchema, type UpdateAcknowledgement } from '../schemas/transport.ts';
3
+ export { PenpotClient } from './penpot-client.ts';
4
+ export { HttpPenpotTokensClient, MemoryPenpotTokensStore, PenpotApiClient, RpcPenpotTokensClient, PENPOT_TOKENS_PLUGIN_KEY, PENPOT_TOKENS_PLUGIN_NAMESPACE, type HttpPenpotTokensClientConfig, type PenpotApiClientConfig, type PenpotFileRef, type PenpotTokenCatalog, type PenpotTokensPullInput, type PenpotTokensPushInput, type PenpotTokensTransport } from './penpot-api.ts';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,2BAA2B,EAAE,KAAK,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACN,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,8BAA8B,EAC9B,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from "../schemas/board.js";
2
+ export { UpdateAcknowledgementSchema } from "../schemas/transport.js";
3
+ export { PenpotClient } from "./penpot-client.js";
4
+ export { HttpPenpotTokensClient, MemoryPenpotTokensStore, PenpotApiClient, RpcPenpotTokensClient, PENPOT_TOKENS_PLUGIN_KEY, PENPOT_TOKENS_PLUGIN_NAMESPACE } from "./penpot-api.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,2BAA2B,EAA8B,MAAM,yBAAyB,CAAC;AAClG,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACN,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,8BAA8B,EAQ9B,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,70 @@
1
+ import type { HttpPenpotTokensClientConfig, PenpotApiClientConfig, PenpotFileRef, PenpotJson, PenpotTokenCatalog, PenpotTokensPullInput, PenpotTokensPushInput, PenpotTokensTransport, UpdateFileInput } from '../schemas/transport.ts';
2
+ export type { HttpPenpotTokensClientConfig, PenpotApiClientConfig, PenpotFileRef, PenpotTokenCatalog, PenpotTokensPullInput, PenpotTokensPushInput, PenpotTokensTransport } from '../schemas/transport.ts';
3
+ export declare const PENPOT_TOKENS_PLUGIN_NAMESPACE = "vibesDesignTokens";
4
+ export declare const PENPOT_TOKENS_PLUGIN_KEY = "catalog";
5
+ export declare class PenpotApiClient {
6
+ baseUrl: string;
7
+ private readonly config;
8
+ private readonly fetchImpl;
9
+ constructor(config: PenpotApiClientConfig);
10
+ protected origin(): Promise<string>;
11
+ protected headers(extra?: HeadersInit): Promise<Headers>;
12
+ rpc(command: string, body: PenpotJson): Promise<PenpotJson>;
13
+ getFile(fileId: string): Promise<PenpotFileRef>;
14
+ exportTokens(fileId: string): Promise<PenpotJson>;
15
+ updateFile(input: UpdateFileInput): Promise<{
16
+ [x: string]: import("@vibesdotdev/kernel/bootstrap").JsonValue;
17
+ revn: number;
18
+ } | {
19
+ [x: string]: import("@vibesdotdev/kernel/bootstrap").JsonValue;
20
+ success: true;
21
+ } | {
22
+ [x: string]: import("@vibesdotdev/kernel/bootstrap").JsonValue;
23
+ revn: number;
24
+ }[]>;
25
+ }
26
+ export declare class MemoryPenpotTokensStore implements PenpotTokensTransport {
27
+ private readonly byFile;
28
+ seed(fileId: string, catalogs: PenpotTokenCatalog[]): void;
29
+ pullTokens(input: PenpotTokensPullInput): Promise<{
30
+ presetId: string;
31
+ updatedAt: string;
32
+ dtcg: import("@vibesdotdev/kernel/bootstrap").JsonValue;
33
+ }[]>;
34
+ pushTokens(input: PenpotTokensPushInput): Promise<{
35
+ presetId: string;
36
+ updatedAt: string;
37
+ dtcg: import("@vibesdotdev/kernel/bootstrap").JsonValue;
38
+ }>;
39
+ }
40
+ export declare class HttpPenpotTokensClient implements PenpotTokensTransport {
41
+ baseUrl: string;
42
+ tokensPath: string;
43
+ private readonly config;
44
+ private readonly fetchImpl;
45
+ constructor(config: HttpPenpotTokensClientConfig);
46
+ private request;
47
+ pullTokens(input: PenpotTokensPullInput): Promise<{
48
+ presetId: string;
49
+ updatedAt: string;
50
+ dtcg: import("@vibesdotdev/kernel/bootstrap").JsonValue;
51
+ }[]>;
52
+ pushTokens(input: PenpotTokensPushInput): Promise<{
53
+ presetId: string;
54
+ updatedAt: string;
55
+ dtcg: import("@vibesdotdev/kernel/bootstrap").JsonValue;
56
+ }>;
57
+ }
58
+ export declare class RpcPenpotTokensClient extends PenpotApiClient implements PenpotTokensTransport {
59
+ pullTokens(input: PenpotTokensPullInput): Promise<{
60
+ presetId: string;
61
+ updatedAt: string;
62
+ dtcg: import("@vibesdotdev/kernel/bootstrap").JsonValue;
63
+ }[]>;
64
+ pushTokens(input: PenpotTokensPushInput): Promise<{
65
+ presetId: string;
66
+ updatedAt: string;
67
+ dtcg: import("@vibesdotdev/kernel/bootstrap").JsonValue;
68
+ }>;
69
+ }
70
+ //# sourceMappingURL=penpot-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"penpot-api.d.ts","sourceRoot":"","sources":["../../src/client/penpot-api.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACX,4BAA4B,EAAE,qBAAqB,EAAE,aAAa,EAAE,UAAU,EAC9E,kBAAkB,EAAE,qBAAqB,EAAE,qBAAqB,EAChE,qBAAqB,EAAE,eAAe,EACtC,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACX,4BAA4B,EAAE,qBAAqB,EAAE,aAAa,EAClE,kBAAkB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,qBAAqB,EACvF,MAAM,yBAAyB,CAAC;AAEjC,eAAO,MAAM,8BAA8B,sBAAsB,CAAC;AAClE,eAAO,MAAM,wBAAwB,YAAY,CAAC;AA8ElD,qBAAa,eAAe;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;IAC/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAc;gBAC5B,MAAM,EAAE,qBAAqB;cAKzB,MAAM;IAItB,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,WAAW;IAC/B,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAU3D,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAQ/C,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAIjD,UAAU,CAAC,KAAK,EAAE,eAAe;;;;;;;;;;CAOvC;AAED,qBAAa,uBAAwB,YAAW,qBAAqB;IACpE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsD;IAC7E,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE;IAK7C,UAAU,CAAC,KAAK,EAAE,qBAAqB;;;;;IAKvC,UAAU,CAAC,KAAK,EAAE,qBAAqB;;;;;CAQ7C;AAED,qBAAa,sBAAuB,YAAW,qBAAqB;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+B;IACtD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAc;gBAC5B,MAAM,EAAE,4BAA4B;YAOlC,OAAO;IAYf,UAAU,CAAC,KAAK,EAAE,qBAAqB;;;;;IAMvC,UAAU,CAAC,KAAK,EAAE,qBAAqB;;;;;CAiB7C;AAED,qBAAa,qBAAsB,SAAQ,eAAgB,YAAW,qBAAqB;IACpF,UAAU,CAAC,KAAK,EAAE,qBAAqB;;;;;IAKvC,UAAU,CAAC,KAAK,EAAE,qBAAqB;;;;;CAqB7C"}
@@ -0,0 +1,241 @@
1
+ import { CapabilityError } from '@vibesdotdev/kernel';
2
+ import { loadPenpotSettings, penpotSettingsDescriptor, resolvePenpotBaseUrl } from "../config/penpot.config.descriptor.js";
3
+ import { CatalogEnvelopeSchema, CatalogPayloadSchema, HttpPenpotTokensClientConfigSchema, HttpPushAcknowledgementSchema, PluginCatalogSchema, JsonSchema, JsonObjectSchema, PenpotApiClientConfigSchema, PenpotCatalogSchema, PenpotFileSchema, PluginDataSchema, PullInputSchema, PushInputSchema, UpdateAcknowledgementSchema, UpdateFileInputSchema, parseBoundary, parseJsonText } from "../schemas/transport.js";
4
+ export const PENPOT_TOKENS_PLUGIN_NAMESPACE = 'vibesDesignTokens';
5
+ export const PENPOT_TOKENS_PLUGIN_KEY = 'catalog';
6
+ async function resolveOptionalCredential(explicit, runtime, key) {
7
+ if (explicit?.trim())
8
+ return explicit.trim();
9
+ if (!runtime)
10
+ return undefined;
11
+ const result = await runtime.resolveCredential({ source: 'secret', key });
12
+ if (result.ok)
13
+ return result.value.trim() || undefined;
14
+ if (result.error.code === 'NOT_FOUND' && result.error.reason === 'credential-not-set')
15
+ return undefined;
16
+ throw new CapabilityError('Penpot credential resolution failed.', 'AUTH_REQUIRED', {
17
+ reason: 'penpot-credential-unavailable', cause: result.error
18
+ });
19
+ }
20
+ async function penpotHeaders(config, extra) {
21
+ const headers = new Headers(extra);
22
+ headers.set('Accept', 'application/json');
23
+ headers.set('Content-Type', 'application/json');
24
+ const accessToken = await resolveOptionalCredential(config.accessToken, config.runtime, 'PENPOT_ACCESS_TOKEN');
25
+ if (accessToken)
26
+ headers.set('Authorization', `Token ${accessToken}`);
27
+ const sessionCookie = await resolveOptionalCredential(config.sessionCookie, config.runtime, 'PENPOT_SESSION_COOKIE');
28
+ if (sessionCookie)
29
+ headers.set('Cookie', sessionCookie);
30
+ return headers;
31
+ }
32
+ function joinUrl(base, path) {
33
+ return `${base.replace(/\/+$/, '')}${path.startsWith('/') ? path : `/${path}`}`;
34
+ }
35
+ async function responseJson(response) {
36
+ if (!response.ok) {
37
+ throw new CapabilityError('Penpot HTTP request failed.', 'UNAVAILABLE', {
38
+ reason: 'penpot-http-failed', details: { status: response.status }
39
+ });
40
+ }
41
+ try {
42
+ const text = await response.text();
43
+ return text ? parseJsonText(text) : null;
44
+ }
45
+ catch (cause) {
46
+ throw new CapabilityError('Penpot response could not be read.', 'INVALID_INPUT', {
47
+ reason: 'penpot-response-invalid', cause
48
+ });
49
+ }
50
+ }
51
+ function catalogFromFileData(data, presetId) {
52
+ if (data === undefined)
53
+ return [];
54
+ const fileData = parseBoundary(PluginDataSchema, data);
55
+ if (!fileData.pluginData)
56
+ return [];
57
+ const catalogs = new Map();
58
+ // Current namespace wins when both legacy and current copies exist.
59
+ for (const namespace of ['vibes.design-tokens', PENPOT_TOKENS_PLUGIN_NAMESPACE]) {
60
+ const raw = fileData.pluginData[namespace]?.[PENPOT_TOKENS_PLUGIN_KEY];
61
+ if (raw === undefined)
62
+ continue;
63
+ const encoded = zString.safeParse(raw);
64
+ const payload = encoded.success ? parseJsonText(encoded.data) : raw;
65
+ const parsed = parseBoundary(PluginCatalogSchema, payload, 'penpot-catalog-invalid');
66
+ catalogs.set(parsed.presetId, parsed);
67
+ }
68
+ return Array.from(catalogs.values()).filter(item => !presetId || item.presetId === presetId);
69
+ }
70
+ import * as z from 'zod/v4';
71
+ const zString = z.string();
72
+ const CatalogListSchema = z.array(CatalogPayloadSchema);
73
+ function normalizeTokenCatalogs(body, fileId) {
74
+ const list = CatalogListSchema.safeParse(body);
75
+ if (list.success)
76
+ return list.data;
77
+ const record = parseBoundary(CatalogEnvelopeSchema, body, 'penpot-catalog-invalid');
78
+ const plugin = catalogFromFileData(record.data ?? record);
79
+ if (plugin.length)
80
+ return plugin;
81
+ if (record.catalogs !== undefined)
82
+ return record.catalogs;
83
+ if (record.tokens !== undefined)
84
+ return record.tokens;
85
+ if (record.dtcg !== undefined)
86
+ return [parseBoundary(CatalogPayloadSchema, {
87
+ ...record, presetId: record.presetId ?? fileId
88
+ })];
89
+ // A validated file with no token fields is confirmed absence.
90
+ if (PenpotFileSchema.safeParse(body).success)
91
+ return [];
92
+ throw new CapabilityError('Penpot did not return a recognized catalog response.', 'INVALID_INPUT', {
93
+ reason: 'penpot-catalog-invalid'
94
+ });
95
+ }
96
+ export class PenpotApiClient {
97
+ baseUrl;
98
+ config;
99
+ fetchImpl;
100
+ constructor(config) {
101
+ this.config = parseBoundary(PenpotApiClientConfigSchema, config, 'penpot-config-invalid');
102
+ this.baseUrl = penpotSettingsDescriptor.schema.parse({ baseUrl: config.baseUrl }).baseUrl.replace(/\/+$/, '');
103
+ this.fetchImpl = config.fetch ?? fetch;
104
+ }
105
+ async origin() {
106
+ this.baseUrl = await resolvePenpotBaseUrl(this.config.runtime, this.config.baseUrl);
107
+ return this.baseUrl;
108
+ }
109
+ headers(extra) { return penpotHeaders(this.config, extra); }
110
+ async rpc(command, body) {
111
+ const payload = parseBoundary(JsonObjectSchema, body);
112
+ try {
113
+ return await responseJson(await this.fetchImpl(joinUrl(await this.origin(), `/api/rpc/command/${command}`), {
114
+ method: 'POST', headers: await this.headers(), body: JSON.stringify(payload)
115
+ }));
116
+ }
117
+ catch (cause) {
118
+ throw new CapabilityError('Penpot RPC request failed.', 'UNAVAILABLE', { reason: 'penpot-rpc-failed', cause });
119
+ }
120
+ }
121
+ async getFile(fileId) {
122
+ const input = parseBoundary(PullInputSchema, { fileId });
123
+ const file = parseBoundary(PenpotFileSchema, await this.rpc('get-file', { id: input.fileId }));
124
+ if (file.id !== input.fileId)
125
+ throw new CapabilityError('Penpot returned a different file.', 'CONFLICT', {
126
+ reason: 'penpot-destination-mismatch'
127
+ });
128
+ return file;
129
+ }
130
+ async exportTokens(fileId) {
131
+ const input = parseBoundary(PullInputSchema, { fileId });
132
+ return this.rpc('get-file', { id: input.fileId, features: ['tokens'] });
133
+ }
134
+ async updateFile(input) {
135
+ const value = parseBoundary(UpdateFileInputSchema, input);
136
+ return parseBoundary(UpdateAcknowledgementSchema, await this.rpc('update-file', {
137
+ id: value.fileId, 'session-id': value.sessionId, revn: value.revn,
138
+ vern: value.vern, changes: value.changes, features: value.features
139
+ }), 'penpot-acknowledgement-invalid');
140
+ }
141
+ }
142
+ export class MemoryPenpotTokensStore {
143
+ byFile = new Map();
144
+ seed(fileId, catalogs) {
145
+ const id = parseBoundary(PullInputSchema, { fileId }).fileId;
146
+ const values = parseBoundary(z.array(PenpotCatalogSchema), catalogs);
147
+ this.byFile.set(id, new Map(values.map(catalog => [catalog.presetId, structuredClone(catalog)])));
148
+ }
149
+ async pullTokens(input) {
150
+ const value = parseBoundary(PullInputSchema, input);
151
+ const all = Array.from(this.byFile.get(value.fileId)?.values() ?? []);
152
+ return structuredClone(all.filter(catalog => !value.presetId || catalog.presetId === value.presetId));
153
+ }
154
+ async pushTokens(input) {
155
+ const value = parseBoundary(PushInputSchema, input);
156
+ const map = this.byFile.get(value.fileId) ?? new Map();
157
+ const catalog = { presetId: value.presetId, updatedAt: value.updatedAt ?? new Date().toISOString(), dtcg: value.dtcg };
158
+ map.set(value.presetId, structuredClone(catalog));
159
+ this.byFile.set(value.fileId, map);
160
+ return structuredClone(catalog);
161
+ }
162
+ }
163
+ export class HttpPenpotTokensClient {
164
+ baseUrl;
165
+ tokensPath;
166
+ config;
167
+ fetchImpl;
168
+ constructor(config) {
169
+ this.config = parseBoundary(HttpPenpotTokensClientConfigSchema, config, 'penpot-config-invalid');
170
+ const settings = penpotSettingsDescriptor.schema.parse({ baseUrl: config.baseUrl, tokensPath: config.tokensPath });
171
+ this.baseUrl = settings.baseUrl.replace(/\/+$/, '');
172
+ this.tokensPath = settings.tokensPath;
173
+ this.fetchImpl = config.fetch ?? fetch;
174
+ }
175
+ async request(body) {
176
+ const settings = await loadPenpotSettings(this.config.runtime);
177
+ this.baseUrl = (this.config.baseUrl ?? settings.baseUrl).replace(/\/+$/, '');
178
+ this.tokensPath = this.config.tokensPath ?? settings.tokensPath;
179
+ try {
180
+ return await responseJson(await this.fetchImpl(joinUrl(this.baseUrl, this.tokensPath), {
181
+ method: 'POST', headers: await penpotHeaders(this.config), body: JSON.stringify(body)
182
+ }));
183
+ }
184
+ catch (cause) {
185
+ throw new CapabilityError('Penpot token request failed.', 'UNAVAILABLE', { reason: 'penpot-http-failed', cause });
186
+ }
187
+ }
188
+ async pullTokens(input) {
189
+ const value = parseBoundary(PullInputSchema, input);
190
+ const body = { op: 'pull-tokens', id: value.fileId, ...value };
191
+ return normalizeTokenCatalogs(await this.request(parseBoundary(JsonSchema, body)), value.fileId)
192
+ .filter(catalog => !value.presetId || catalog.presetId === value.presetId);
193
+ }
194
+ async pushTokens(input) {
195
+ const value = parseBoundary(PushInputSchema, input);
196
+ const response = await this.request(parseBoundary(JsonSchema, { op: 'push-tokens', id: value.fileId, ...value }));
197
+ const acknowledgement = HttpPushAcknowledgementSchema.safeParse(response);
198
+ if (acknowledgement.success) {
199
+ if (acknowledgement.data.presetId && acknowledgement.data.presetId !== value.presetId) {
200
+ throw new CapabilityError('Penpot acknowledged a different catalog.', 'CONFLICT', { reason: 'penpot-destination-mismatch' });
201
+ }
202
+ return { presetId: value.presetId, dtcg: value.dtcg,
203
+ updatedAt: acknowledgement.data.updatedAt ?? value.updatedAt ?? new Date().toISOString() };
204
+ }
205
+ const match = normalizeTokenCatalogs(response, value.fileId).find(catalog => catalog.presetId === value.presetId);
206
+ if (!match)
207
+ throw new CapabilityError('Penpot did not acknowledge the requested catalog.', 'INVALID_INPUT', {
208
+ reason: 'penpot-acknowledgement-invalid'
209
+ });
210
+ return match;
211
+ }
212
+ }
213
+ export class RpcPenpotTokensClient extends PenpotApiClient {
214
+ async pullTokens(input) {
215
+ const value = parseBoundary(PullInputSchema, input);
216
+ const file = await this.getFile(value.fileId);
217
+ return normalizeTokenCatalogs(file, value.fileId).filter(catalog => !value.presetId || catalog.presetId === value.presetId);
218
+ }
219
+ async pushTokens(input) {
220
+ const value = parseBoundary(PushInputSchema, input);
221
+ const catalog = { presetId: value.presetId, updatedAt: value.updatedAt ?? new Date().toISOString(), dtcg: value.dtcg };
222
+ const file = await this.getFile(value.fileId);
223
+ const existing = normalizeTokenCatalogs(file, value.fileId);
224
+ if (existing.some(item => item.presetId !== value.presetId)) {
225
+ throw new CapabilityError('Penpot catalog slot belongs to another preset.', 'CONFLICT', {
226
+ reason: 'penpot-destination-mismatch'
227
+ });
228
+ }
229
+ await this.updateFile({
230
+ fileId: value.fileId, revn: file.revn ?? 0, vern: file.vern,
231
+ features: file.features,
232
+ changes: [{
233
+ type: 'set-plugin-data', 'object-type': 'file', id: value.fileId,
234
+ namespace: PENPOT_TOKENS_PLUGIN_NAMESPACE, key: PENPOT_TOKENS_PLUGIN_KEY,
235
+ value: JSON.stringify(catalog)
236
+ }]
237
+ });
238
+ return catalog;
239
+ }
240
+ }
241
+ //# sourceMappingURL=penpot-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"penpot-api.js","sourceRoot":"","sources":["../../src/client/penpot-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC3H,OAAO,EACN,qBAAqB,EAAE,oBAAoB,EAAE,kCAAkC,EAC/E,6BAA6B,EAAE,mBAAmB,EAClD,UAAU,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,mBAAmB,EAC9E,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EACpE,2BAA2B,EAAE,qBAAqB,EAAE,aAAa,EAAE,aAAa,EAChF,MAAM,yBAAyB,CAAC;AAWjC,MAAM,CAAC,MAAM,8BAA8B,GAAG,mBAAmB,CAAC;AAClE,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAAS,CAAC;AAElD,KAAK,UAAU,yBAAyB,CAAC,QAA4B,EAAE,OAA+B,EAAE,GAAW;IAClH,IAAI,QAAQ,EAAE,IAAI,EAAE;QAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC7C,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1E,IAAI,MAAM,CAAC,EAAE;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC;IACvD,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,WAAW,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,oBAAoB;QAAE,OAAO,SAAS,C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MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI;YAC3D,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,CAAC;oBACT,IAAI,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,CAAC,MAAM;oBAChE,SAAS,EAAE,8BAA8B,EAAE,GAAG,EAAE,wBAAwB;oBACxE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;iBAC9B,CAAC;SACF,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IAChB,CAAC;CACD"}
@@ -0,0 +1,50 @@
1
+ import { type GetFileInput, type BoardUpdateInput, type RenameFileInput } from '../schemas/board.ts';
2
+ import { BaseRuntimeClient } from '@vibesdotdev/kernel/client';
3
+ import type { PenpotTokensPullInput, PenpotTokensPushInput, PenpotTokensTransport } from '../schemas/transport.ts';
4
+ /** Runtime-owned Penpot transport and credential/configuration context. */
5
+ export declare class PenpotClient extends BaseRuntimeClient implements PenpotTokensTransport {
6
+ getFile(input: GetFileInput): Promise<{
7
+ [x: string]: import("@vibesdotdev/kernel/bootstrap").JsonValue;
8
+ id: string;
9
+ revn: number;
10
+ vern: number;
11
+ features: string[];
12
+ data: {
13
+ [x: string]: import("@vibesdotdev/kernel/bootstrap").JsonValue;
14
+ pages: string[];
15
+ pagesIndex: Record<string, Record<string, import("@vibesdotdev/kernel/bootstrap").JsonValue>>;
16
+ };
17
+ name?: string | undefined;
18
+ }>;
19
+ updateFile(input: BoardUpdateInput): Promise<{
20
+ [x: string]: import("@vibesdotdev/kernel/bootstrap").JsonValue;
21
+ revn: number;
22
+ } | {
23
+ [x: string]: import("@vibesdotdev/kernel/bootstrap").JsonValue;
24
+ success: true;
25
+ } | {
26
+ [x: string]: import("@vibesdotdev/kernel/bootstrap").JsonValue;
27
+ revn: number;
28
+ }[]>;
29
+ renameFile(input: RenameFileInput): Promise<{
30
+ [x: string]: import("@vibesdotdev/kernel/bootstrap").JsonValue;
31
+ id: string;
32
+ name: string;
33
+ revn?: number | undefined;
34
+ vern?: number | undefined;
35
+ features?: string[] | undefined;
36
+ data?: Record<string, import("@vibesdotdev/kernel/bootstrap").JsonValue> | undefined;
37
+ }>;
38
+ pullTokens(input: PenpotTokensPullInput): Promise<{
39
+ presetId: string;
40
+ updatedAt: string;
41
+ dtcg: import("@vibesdotdev/kernel/bootstrap").JsonValue;
42
+ }[]>;
43
+ pushTokens(input: PenpotTokensPushInput): Promise<{
44
+ presetId: string;
45
+ updatedAt: string;
46
+ dtcg: import("@vibesdotdev/kernel/bootstrap").JsonValue;
47
+ }>;
48
+ }
49
+ export default PenpotClient;
50
+ //# sourceMappingURL=penpot-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"penpot-client.d.ts","sourceRoot":"","sources":["../../src/client/penpot-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAyG,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG5M,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEnH,2EAA2E;AAC3E,qBAAa,YAAa,SAAQ,iBAAkB,YAAW,qBAAqB;IAC7E,OAAO,CAAC,KAAK,EAAE,YAAY;;;;;;;;;;;;;IAa3B,UAAU,CAAC,KAAK,EAAE,gBAAgB;;;;;;;;;;IAUlC,UAAU,CAAC,KAAK,EAAE,eAAe;;;;;;;;;IAajC,UAAU,CAAC,KAAK,EAAE,qBAAqB;;;;;IAIvC,UAAU,CAAC,KAAK,EAAE,qBAAqB;;;;;CAI7C;AACD,eAAe,YAAY,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { RuntimeClientDescriptor } from '@vibesdotdev/kernel/client';
2
+ declare const _default: RuntimeClientDescriptor;
3
+ export default _default;
4
+ //# sourceMappingURL=penpot-client.descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"penpot-client.descriptor.d.ts","sourceRoot":"","sources":["../../src/client/penpot-client.descriptor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;;AAC1E,wBAGG"}
@@ -0,0 +1,6 @@
1
+ import { createRuntimeAsset } from '@vibesdotdev/kernel/factory';
2
+ export default createRuntimeAsset({
3
+ kind: 'runtime/client', id: 'integrations-penpot', name: 'Penpot',
4
+ description: 'Penpot file and design-token transport'
5
+ });
6
+ //# sourceMappingURL=penpot-client.descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"penpot-client.descriptor.js","sourceRoot":"","sources":["../../src/client/penpot-client.descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,eAAe,kBAAkB,CAA0B;IAC1D,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,qBAAqB,EAAE,IAAI,EAAE,QAAQ;IACjE,WAAW,EAAE,wCAAwC;CACrD,CAAC,CAAC"}