@runeditrun/rer 0.2.119 → 0.2.121
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/cli/README.md +89 -0
- package/cli/browser-runtime.mjs +32 -17
- package/cli/business/agent-args.mjs +60 -0
- package/cli/business/agent-help.mjs +53 -0
- package/cli/business/agent-output.mjs +38 -0
- package/cli/business/agent-table.mjs +32 -0
- package/cli/business/agent-verbs.mjs +132 -0
- package/cli/business/agent-wait.mjs +28 -0
- package/cli/business/command.mjs +18 -2
- package/cli/business/mcp-bridge.mjs +58 -0
- package/cli/business/questions.mjs +32 -9
- package/cli/business/run-child.mjs +42 -0
- package/cli/business/run-grant.mjs +65 -0
- package/cli/business/run-mask.mjs +21 -0
- package/cli/deploy-inputs.mjs +13 -0
- package/cli/deploy-settings.mjs +14 -0
- package/cli/deploy-variables.mjs +7 -1
- package/cli/deploy.mjs +2 -2
- package/cli/inspect.mjs +6 -1
- package/cli/lifecycle.mjs +1 -1
- package/cli/parse.mjs +11 -1
- package/global/CHANGELOG.md +31 -0
- package/global/browser-runtime.mjs +9 -5
- package/global/run.mjs +1 -1
- package/modules/deploy-kit/README.md +1 -0
- package/modules/deploy-kit/owner-cli.mjs +6 -4
- package/modules/deploy-kit/owner-secret-copy.mjs +2 -1
- package/modules/deploy-kit/owner-secret.mjs +1 -1
- package/modules/deploy-kit/owner.mjs +3 -2
- package/modules/deploy-kit/validation.mjs +1 -0
- package/modules/deploy-kit/worker.mjs +1 -0
- package/package.json +1 -1
|
@@ -41,7 +41,7 @@ export async function ownerSecret({api: provider, target, statePath, changes, fe
|
|
|
41
41
|
assert(names, 'invalid-secret-list');
|
|
42
42
|
// Removing secrets the Worker does not hold changes nothing; the rest of a removal still runs.
|
|
43
43
|
const writes = present ? changes : changes.filter(change => names.includes(change.binding));
|
|
44
|
-
const existed = writes.some(change => names.includes(change.binding)), changed = writes.length > 0, copy = writes.length > 1;
|
|
44
|
+
const existed = writes.some(change => names.includes(change.binding)), changed = writes.length > 0, copy = writes.length > 1 || writes.some(change => change.publicDefault !== undefined);
|
|
45
45
|
state.pendingSecret = {bindings, present, versionId:state.receipt.provider.versionId, names:names.filter(name => !bindings.includes(name)).sort(), ...(copy ? {copy:randomBytes(16).toString('hex')} : {})};
|
|
46
46
|
await writeOwnerState(statePath, state);
|
|
47
47
|
let failure, unchanged = false, confirming = false, uploaded = false;
|
|
@@ -144,7 +144,7 @@ export function localOnlyBinding(declaration, localOnlyKeys = []) {
|
|
|
144
144
|
return names.find(name => refused.has(name)) ?? null;
|
|
145
145
|
}
|
|
146
146
|
/** A seed declares bindings, never names. Migrations come from the packaged artifact. */
|
|
147
|
-
export function ownerPlan(target, declaration, artifact, { localOnlyKeys = [], env = {} } = {}) {
|
|
147
|
+
export function ownerPlan(target, declaration, artifact, { localOnlyKeys = [], env = {}, publicDefaults = {} } = {}) {
|
|
148
148
|
assert(declaration?.version === 1 && typeof declaration === 'object' && Object.keys(declaration).every(key => DECLARATION_KEYS.includes(key)), 'invalid-owner-declaration');
|
|
149
149
|
assert(declaration.publicSettings === undefined || Array.isArray(declaration.publicSettings) && new Set(declaration.publicSettings).size === declaration.publicSettings.length && declaration.publicSettings.every(name => typeof name === 'string' && /^[A-Z][A-Z0-9_]*$/.test(name)), 'invalid-public-settings');
|
|
150
150
|
ownerPlatforms(declaration);
|
|
@@ -165,6 +165,7 @@ export function ownerPlan(target, declaration, artifact, { localOnlyKeys = [], e
|
|
|
165
165
|
const queues = entries(declaration,'queues');
|
|
166
166
|
for (const item of queues) assert(item.deadLetterQueue === undefined || queues.some(other => other.binding === item.deadLetterQueue), 'invalid-dead-letter-queue');
|
|
167
167
|
const vars = {...(declaration.vars ?? {})};
|
|
168
|
+
for (const name of Object.keys(publicDefaults)) if (declaration.secrets?.some(item => item.binding === name)) delete vars[name];
|
|
168
169
|
const origin = publicOrigin(declaration, env);
|
|
169
170
|
if (declaration.originVar !== undefined) {
|
|
170
171
|
assert(identifier(declaration.originVar) && !Object.hasOwn(vars,declaration.originVar), 'invalid-owner-origin-variable');
|
|
@@ -183,7 +184,7 @@ export function ownerPlan(target, declaration, artifact, { localOnlyKeys = [], e
|
|
|
183
184
|
durableObjects:entries(declaration,'durableObjects').map(item => ({...item})),
|
|
184
185
|
// verifyStandIn is only `rer verify`'s hosted-check value: never planned, sent or stored.
|
|
185
186
|
// An optional secret (`"optional": true`, an integration's credential) may stay unset: it is bound only once supplied.
|
|
186
|
-
secrets:entries(declaration,'secrets').map(({verifyStandIn,...item}) => { assert(verifyStandIn === undefined || typeof verifyStandIn === 'string' && verifyStandIn.length > 0 && verifyStandIn.length <= 1024, 'invalid-verify-stand-in'); return item; }),
|
|
187
|
+
secrets:entries(declaration,'secrets').map(({verifyStandIn,...item}) => { assert(verifyStandIn === undefined || typeof verifyStandIn === 'string' && verifyStandIn.length > 0 && verifyStandIn.length <= 1024, 'invalid-verify-stand-in'); return Object.hasOwn(publicDefaults,item.binding) ? {...item,publicDefault:publicDefaults[item.binding]} : item; }),
|
|
187
188
|
crons:[...(declaration.crons ?? [])],vars,
|
|
188
189
|
// Only declarations using these add the keys, so earlier plans and fingerprints are unchanged.
|
|
189
190
|
...(services.length ? {services} : {}),...(declaration.workersDev === false ? {workersDev:false} : {})});
|
|
@@ -32,6 +32,7 @@ export function validatePlan(plan) {
|
|
|
32
32
|
for (const entry of plan.durableObjects) assert(identifier(entry.className) && ['sqlite','classic'].includes(entry.storage), 'invalid-durable-object');
|
|
33
33
|
for (const secret of plan.secrets) assert(identifier(secret.environment), 'invalid-secret-environment');
|
|
34
34
|
for (const secret of plan.secrets) assert(secret.optional === undefined || secret.optional === true, 'invalid-optional-secret');
|
|
35
|
+
for (const secret of plan.secrets) assert(secret.publicDefault === undefined || secret.optional === true && typeof secret.publicDefault === 'string', 'invalid-public-secret-default');
|
|
35
36
|
for (const item of plan.services ?? []) assert(Object.keys(item).every(k => ['binding','service','entrypoint','props','grant'].includes(k)) && resourceName(item.service) && item.service !== plan.worker
|
|
36
37
|
&& (item.entrypoint === undefined || identifier(item.entrypoint))
|
|
37
38
|
&& (item.props === undefined || Object.keys(item.props).join() === 'allowedHosts' && Array.isArray(item.props.allowedHosts)
|
|
@@ -58,6 +58,7 @@ export async function secretBindings(api, worker, plan, env, exists) {
|
|
|
58
58
|
}
|
|
59
59
|
for (const item of plan.secrets) {
|
|
60
60
|
if (names.includes(item.binding)) bindings.push({type:'inherit',name:item.binding});
|
|
61
|
+
else if (unset.includes(item.binding) && item.publicDefault !== undefined) bindings.push({type:'plain_text',name:item.binding,text:item.publicDefault});
|
|
61
62
|
else if (!unset.includes(item.binding)) {
|
|
62
63
|
bindings.push({type:'secret_text',name:item.binding,text:env[item.environment]});
|
|
63
64
|
}
|