@pikku/skills 0.12.8 → 0.12.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/skills",
3
- "version": "0.12.8",
3
+ "version": "0.12.9",
4
4
  "description": "The Pikku agent skills — the instruction set coding agents read to build, wire and deploy Pikku projects",
5
5
  "author": "yasser.fadl@gmail.com",
6
6
  "license": "MIT",
@@ -50,9 +50,13 @@ wireAddon({
50
50
  mcp?: boolean,
51
51
  tags?: string[], // Tags applied to all addon functions
52
52
  scopes?: string[], // Required of every function, on top of its own
53
- secretOverrides?: Record<string, string>, // Remap secret names
53
+ secretOverrides?: Record<string, string>, // Remap secret names (and grant them)
54
54
  variableOverrides?: Record<string, string>, // Remap variable names
55
- credentialOverrides?: Record<string, string>, // Remap credential names
55
+ credentialOverrides?: Record<string, string>, // Remap credential names (and grant them)
56
+ secretGrants?: string[], // Secrets the app lends this addon
57
+ credentialGrants?: string[], // Credentials the app lends this addon
58
+ globalSecrets?: string, // Reason for handing over the whole SecretService
59
+ globalCredentials?: string, // Reason for handing over the whole CredentialService
56
60
  })
57
61
  ```
58
62
 
@@ -61,6 +65,58 @@ it would weaken the wiring's own gate — so the addon-level setting can require
61
65
  session but never waive one. The same package wired twice under two namespaces is
62
66
  governed by the union of both instances' scopes and tags.
63
67
 
68
+ ### An addon reads only the secrets it declared
69
+
70
+ An addon's `SecretService` and `CredentialService` are **scoped**: it may read
71
+ the secrets its own source declares (literal `getSecret('X')` calls and
72
+ `wireSecret` definitions, which the CLI collects into `declaredSecrets`) and
73
+ nothing else. Anything undeclared throws `Access denied to secret key: X` at
74
+ runtime. The same holds for credentials, and a scoped addon can never call
75
+ `getAllUsers()`.
76
+
77
+ That works for an addon naming its own secrets. It does not work for a _generic_
78
+ addon whose secret names arrive as data — `@pikku/addon-graph` reads
79
+ `getSecret(auth.credential)`, where the name comes off the workflow node — so
80
+ such an addon declares nothing and is scoped to nothing. Only the consuming app
81
+ can widen it, with one of three fields:
82
+
83
+ ```typescript
84
+ wireAddon({
85
+ name: 'graph',
86
+ package: '@pikku/addon-graph',
87
+
88
+ secretGrants: ['STRIPE_KEY'], // lend these, unrenamed
89
+ secretOverrides: { MAILGUN_KEY: 'PROD_EMAIL_KEY' }, // lend + rename
90
+ // globalSecrets: 'why no static list can cover it' // lend everything
91
+ })
92
+ ```
93
+
94
+ | field | meaning |
95
+ | ----------------- | --------------------------------------- |
96
+ | `secretOverrides` | grant **and** rename |
97
+ | `secretGrants` | grant as-is |
98
+ | `globalSecrets` | grant everything, with a written reason |
99
+
100
+ **Grants name the secret as the addon reads it**, not as your project stores it.
101
+ Scoping is checked _before_ the override map renames anything, so an overridden
102
+ secret is granted by its addon-side key — which is also why an override's key
103
+ grants and its value does not. With no rename in play the two names coincide.
104
+
105
+ `globalSecrets` / `globalCredentials` take the _reason_ for the grant, not a
106
+ boolean, because every grant is enumerated in the deploy manifest
107
+ (`unscopedSecretAddons`, `grantedSecretAddons`). Prefer `secretGrants` — reach
108
+ for `globalSecrets` only when no static list can exist, and never for an addon
109
+ that performs outbound requests, where an unrestricted secret read is an
110
+ exfiltration primitive.
111
+
112
+ A grant naming a secret your project does not declare is a build error from
113
+ `pikku all`, resolved through the override map first:
114
+
115
+ ```
116
+ Secret grant 'STIRPE_KEY' in addon 'graph' (@pikku/addon-graph) targets a secret
117
+ that does not exist. Available secrets: BETTER_AUTH_SECRET, GITHUB_OAUTH
118
+ ```
119
+
64
120
  ### `ref(name)`
65
121
 
66
122
  Type-safe reference to a function — local or addon — for use in any wiring. It