@halonicjs/testing 0.1.0 → 0.1.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.
- package/NOTICE +4 -0
- package/README.md +1 -1
- package/dist/adapters/http-kit/src/address-checking.d.ts +19 -0
- package/dist/adapters/http-kit/src/address-checking.js +1 -0
- package/dist/adapters/http-kit/src/index.d.ts +1 -0
- package/dist/adapters/integration-kit/src/auth-placement.d.ts +40 -0
- package/dist/adapters/integration-kit/src/auth-placement.js +102 -0
- package/dist/adapters/integration-kit/src/current-secret-forms.d.ts +28 -0
- package/dist/adapters/integration-kit/src/current-secret-forms.js +60 -0
- package/dist/adapters/integration-kit/src/declaration.d.ts +2 -1
- package/dist/adapters/integration-kit/src/declaration.js +4 -3
- package/dist/adapters/integration-kit/src/host.d.ts +7 -1
- package/dist/adapters/integration-kit/src/host.js +1 -0
- package/dist/adapters/integration-kit/src/index.d.ts +3 -1
- package/dist/adapters/integration-kit/src/index.js +1 -0
- package/dist/adapters/integration-kit/src/leak-attempt.d.ts +4 -2
- package/dist/adapters/integration-kit/src/leak-attempt.js +5 -2
- package/dist/adapters/integration-kit/src/limited-http.d.ts +7 -1
- package/dist/adapters/integration-kit/src/limited-http.js +53 -10
- package/dist/adapters/integration-kit/src/loader.d.ts +29 -2
- package/dist/adapters/integration-kit/src/loader.js +44 -12
- package/dist/adapters/integration-kit/src/own-request.d.ts +2 -2
- package/dist/adapters/integration-kit/src/own-request.js +1 -1
- package/dist/adapters/integration-kit/src/plugin-load.d.ts +3 -3
- package/dist/adapters/integration-kit/src/plugin-load.js +5 -5
- package/dist/adapters/integration-kit/src/policy.d.ts +28 -0
- package/dist/adapters/integration-kit/src/response-body.d.ts +6 -2
- package/dist/adapters/integration-kit/src/secret-filter.d.ts +3 -3
- package/dist/adapters/integration-kit/src/secret-filter.js +19 -4
- package/dist/adapters/integration-kit/src/secret-in-request.d.ts +3 -0
- package/dist/adapters/integration-kit/src/secret-in-request.js +8 -2
- package/dist/adapters/integration-kit/src/secret-placement.d.ts +35 -25
- package/dist/adapters/integration-kit/src/secret-placement.js +65 -95
- package/dist/adapters/integration-kit/src/sign-in-placement.d.ts +29 -0
- package/dist/adapters/integration-kit/src/sign-in-placement.js +92 -0
- package/dist/core/events/src/blocked-sites.d.ts +57 -0
- package/dist/core/events/src/blocked-sites.js +89 -0
- package/dist/core/events/src/index.d.ts +5 -1
- package/dist/core/events/src/index.js +3 -0
- package/dist/core/events/src/run-basics.d.ts +30 -7
- package/dist/core/events/src/run-event.d.ts +49 -5
- package/dist/core/events/src/run-reads.d.ts +25 -0
- package/dist/core/events/src/run-reads.js +44 -0
- package/dist/core/events/src/run-sends.d.ts +47 -0
- package/dist/core/events/src/run-sends.js +68 -0
- package/dist/core/events/src/summarize.js +5 -1
- package/dist/core/events/src/timeline-entry.js +1 -0
- package/dist/core/format/src/index.d.ts +7 -5
- package/dist/core/format/src/index.js +5 -3
- package/dist/core/format/src/integration/index.d.ts +3 -2
- package/dist/core/format/src/integration/index.js +2 -1
- package/dist/core/format/src/kinds/agent/sandbox-fields.d.ts +15 -5
- package/dist/core/format/src/kinds/agent/sandbox-fields.js +29 -10
- package/dist/core/format/src/kinds/agent/schema.js +2 -2
- package/dist/core/format/src/kinds/connector/is-local.js +1 -1
- package/dist/core/format/src/kinds/connector/kind.js +99 -0
- package/dist/core/format/src/kinds/connector/schema.d.ts +24 -0
- package/dist/core/format/src/kinds/connector/schema.js +53 -2
- package/dist/core/format/src/kinds/deployments/kind.js +25 -1
- package/dist/core/format/src/kinds/deployments/schema.d.ts +40 -0
- package/dist/core/format/src/kinds/deployments/schema.js +52 -0
- package/dist/core/format/src/kinds/integration/approved-sign-ins.d.ts +62 -0
- package/dist/core/format/src/kinds/integration/approved-sign-ins.js +125 -0
- package/dist/core/format/src/kinds/integration/host-key.d.ts +7 -0
- package/dist/core/format/src/kinds/integration/host-key.js +8 -0
- package/dist/core/format/src/kinds/integration/kind.d.ts +4 -2
- package/dist/core/format/src/kinds/integration/kind.js +49 -12
- package/dist/core/format/src/kinds/integration/policy.d.ts +47 -2
- package/dist/core/format/src/kinds/integration/policy.js +61 -2
- package/dist/core/format/src/kinds/integration/schema.d.ts +180 -3
- package/dist/core/format/src/kinds/integration/schema.js +132 -6
- package/dist/core/format/src/kinds/integration/sign-in-checks.d.ts +13 -0
- package/dist/core/format/src/kinds/integration/sign-in-checks.js +120 -0
- package/dist/core/format/src/kinds/integration/sign-in-urls.d.ts +19 -0
- package/dist/core/format/src/kinds/integration/sign-in-urls.js +47 -0
- package/dist/core/format/src/kinds/plugin/checks.js +7 -1
- package/dist/core/format/src/kinds/plugin/schema.d.ts +130 -0
- package/dist/core/format/src/kinds/plugin/schema.js +2 -2
- package/dist/core/format/src/kinds/plugin/ui-checks.d.ts +1 -1
- package/dist/core/format/src/kinds/plugin/ui-checks.js +1 -10
- package/dist/core/format/src/kinds/routine/kind.js +38 -1
- package/dist/core/format/src/kinds/routine/schema.d.ts +10 -0
- package/dist/core/format/src/kinds/routine/schema.js +23 -1
- package/dist/core/format/src/kinds/routine/webhook-headers.d.ts +9 -0
- package/dist/core/format/src/kinds/routine/webhook-headers.js +26 -0
- package/dist/core/format/src/kinds/workflow/schema.js +1 -1
- package/dist/core/format/src/kinds/workspace/kind.js +1 -1
- package/dist/core/format/src/kinds/workspace/schema.d.ts +2 -2
- package/dist/core/format/src/kinds/workspace/schema.js +1 -1
- package/dist/core/format/src/shared/fields.d.ts +3 -6
- package/dist/core/format/src/shared/fields.js +33 -13
- package/dist/core/ports/src/agent-runs-not-available.d.ts +21 -0
- package/dist/core/ports/src/agent-runs-not-available.js +25 -0
- package/dist/core/ports/src/blob-store.d.ts +12 -0
- package/dist/core/ports/src/blob-store.js +22 -0
- package/dist/core/ports/src/connector-client.d.ts +48 -4
- package/dist/core/ports/src/connector-client.js +17 -0
- package/dist/core/ports/src/definition-store.d.ts +23 -2
- package/dist/core/ports/src/harness-bridge-server.d.ts +12 -3
- package/dist/core/ports/src/harness-sign-in-command.d.ts +27 -0
- package/dist/core/ports/src/harness-sign-in-command.js +31 -0
- package/dist/core/ports/src/harness.d.ts +46 -13
- package/dist/core/ports/src/harness.js +1 -1
- package/dist/core/ports/src/host-settings-store.d.ts +116 -0
- package/dist/core/ports/src/host-settings-store.js +106 -0
- package/dist/core/ports/src/index.d.ts +18 -10
- package/dist/core/ports/src/index.js +15 -7
- package/dist/core/ports/src/instruction-trust-store.d.ts +81 -0
- package/dist/core/ports/src/instruction-trust-store.js +43 -0
- package/dist/core/ports/src/integration.d.ts +71 -7
- package/dist/core/ports/src/integration.js +22 -4
- package/dist/core/ports/src/llm-provider.d.ts +3 -1
- package/dist/core/ports/src/llm-provider.js +3 -0
- package/dist/core/ports/src/password-hasher.d.ts +36 -20
- package/dist/core/ports/src/port-versions.d.ts +7 -4
- package/dist/core/ports/src/port-versions.js +6 -0
- package/dist/core/ports/src/program-probe.d.ts +25 -2
- package/dist/core/ports/src/program-probe.js +1 -1
- package/dist/core/ports/src/provider-default-base-url.d.ts +10 -0
- package/dist/core/ports/src/provider-default-base-url.js +18 -0
- package/dist/core/ports/src/record-store.d.ts +17 -0
- package/dist/core/ports/src/record-store.js +70 -0
- package/dist/core/ports/src/run-executor.d.ts +5 -4
- package/dist/core/ports/src/run-target-not-found.d.ts +34 -0
- package/dist/core/ports/src/run-target-not-found.js +41 -0
- package/dist/core/ports/src/sandbox-setting-store.d.ts +68 -0
- package/dist/core/ports/src/sandbox-setting-store.js +33 -0
- package/dist/core/ports/src/sandbox.d.ts +130 -13
- package/dist/core/ports/src/sandbox.js +38 -2
- package/dist/core/ports/src/secrets.d.ts +73 -0
- package/dist/core/ports/src/secrets.js +56 -0
- package/dist/core/ports/src/tool-approval-store.d.ts +50 -8
- package/dist/core/ports/src/tool-approval-store.js +59 -0
- package/dist/core/ports/src/vcs-status.d.ts +8 -0
- package/dist/core/ports/src/vcs-status.js +90 -0
- package/dist/core/std/src/amount.d.ts +13 -0
- package/dist/core/std/src/amount.js +22 -0
- package/dist/core/std/src/hidden-characters.d.ts +19 -0
- package/dist/core/std/src/hidden-characters.js +54 -0
- package/dist/core/std/src/index.d.ts +5 -0
- package/dist/core/std/src/index.js +5 -0
- package/dist/core/std/src/public-suffixes.generated.d.ts +9 -0
- package/dist/core/std/src/public-suffixes.generated.js +10429 -0
- package/dist/core/std/src/registrable-domain.d.ts +10 -0
- package/dist/core/std/src/registrable-domain.js +62 -0
- package/dist/core/std/src/secret-variable-name.d.ts +12 -0
- package/dist/core/std/src/secret-variable-name.js +34 -0
- package/dist/core/std/src/site-name.d.ts +35 -0
- package/dist/core/std/src/site-name.js +111 -0
- package/dist/core/std/src/url-host.d.ts +35 -0
- package/dist/core/std/src/url-host.js +170 -0
- package/dist/testing/integration/src/load.js +3 -1
- package/package.json +2 -2
|
@@ -104,6 +104,7 @@ function applyEvent(summary, event) {
|
|
|
104
104
|
return;
|
|
105
105
|
case "event.received":
|
|
106
106
|
case "workflow.finished":
|
|
107
|
+
case "workflow.resumed":
|
|
107
108
|
case "timer.fired":
|
|
108
109
|
summary.status = "running";
|
|
109
110
|
summary.waitingOn = null;
|
|
@@ -163,9 +164,12 @@ function removeApproval(approvals, callId) {
|
|
|
163
164
|
}
|
|
164
165
|
/**
|
|
165
166
|
* Add one model call's tokens, and its cost when it has a price. A call the
|
|
166
|
-
* person's subscription paid for is counted on its own, never priced.
|
|
167
|
+
* person's subscription paid for is counted on its own, never priced. An
|
|
168
|
+
* answer from the cache made no model call, so it adds nothing at all.
|
|
167
169
|
*/
|
|
168
170
|
function addModelCall(summary, call) {
|
|
171
|
+
if (call.cached === true)
|
|
172
|
+
return;
|
|
169
173
|
summary.usage = addUsage(summary.usage, call.usage);
|
|
170
174
|
if (call.paidBy === "subscription")
|
|
171
175
|
summary.subscriptionCalls++;
|
|
@@ -98,6 +98,7 @@ function updateOf(event) {
|
|
|
98
98
|
// Only while the run waits; otherwise no entry is open and it stands alone.
|
|
99
99
|
case "timer.fired":
|
|
100
100
|
case "event.received":
|
|
101
|
+
case "workflow.resumed":
|
|
101
102
|
return { opener: "run.waiting", fields: [], closes: true };
|
|
102
103
|
default:
|
|
103
104
|
return null;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
export { compact } from "./compact.js";
|
|
2
2
|
export { jsonSchemaOf } from "./json-schema.js";
|
|
3
3
|
export type { FileKind, FilePlace, KindCheckProblem, KindSyntax } from "./kind.js";
|
|
4
|
-
export { AGENT_HARNESSES, asciiAllowedSites, defaultWorkingFolder, isInWorkingFolder, MAX_ALLOWED_SITES, } from "./kinds/agent/sandbox-fields.js";
|
|
4
|
+
export { AGENT_HARNESSES, asciiAllowedSites, defaultWorkingFolder, isInWorkingFolder, MAX_ALLOWED_SITES, PROTECTED_TOP_NAMES, workingFolderProblem, } from "./kinds/agent/sandbox-fields.js";
|
|
5
5
|
export type { Agent, AgentMethod, AgentOutput, MethodField } from "./kinds/agent/schema.js";
|
|
6
6
|
export { type ConnectorStart, type FolderLookup, touchesWorkingFolder, type WorkingFolderReach, workingFolderRefusal, } from "./kinds/agent/working-folder-start.js";
|
|
7
7
|
export type { Collection, CollectionField, CollectionView } from "./kinds/collection/schema.js";
|
|
8
8
|
export { FIELD_TYPES } from "./kinds/collection/schema.js";
|
|
9
9
|
export { connectorIsLocal } from "./kinds/connector/is-local.js";
|
|
10
|
-
export { approveAll, type Connector, needsApproval } from "./kinds/connector/schema.js";
|
|
11
|
-
export type { Deployment, Deployments } from "./kinds/deployments/schema.js";
|
|
10
|
+
export { approveAll, type Connector, marksRead, needsApproval } from "./kinds/connector/schema.js";
|
|
11
|
+
export type { CloudflareSettings, Deployment, DeploymentLimits, Deployments, } from "./kinds/deployments/schema.js";
|
|
12
12
|
export type { Hub, HubUses } from "./kinds/hub/schema.js";
|
|
13
|
+
export { approvedSignIns, type ResolvedSignIn, } from "./kinds/integration/approved-sign-ins.js";
|
|
13
14
|
export { checkIntegrationSheet } from "./kinds/integration/kind.js";
|
|
14
15
|
export { parseIntegrationSheet, type SheetProblem } from "./kinds/integration/parse-sheet.js";
|
|
15
|
-
export { type DeclaredPlacement, type DeclaredSecret, type IntegrationLimits, type IntegrationPolicy, integrationPolicy, type PolicyProblem, type ResolvedIntegration, } from "./kinds/integration/policy.js";
|
|
16
|
-
export { ADDRESS_CLASSES, type AddressClass, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, type IntegrationHost, type IntegrationSecret, type IntegrationSecretHost, IntegrationSheet, type IntegrationTool, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, } from "./kinds/integration/schema.js";
|
|
16
|
+
export { type DeclaredClientSecret, type DeclaredPlacement, type DeclaredSecret, type DeclaredSignIn, type DeclaredSignInPlacement, type IntegrationLimits, type IntegrationPolicy, integrationPolicy, type PolicyProblem, type ResolvedIntegration, } from "./kinds/integration/policy.js";
|
|
17
|
+
export { ADDRESS_CLASSES, type AddressClass, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, type IntegrationClientSecret, type IntegrationHost, type IntegrationSecret, type IntegrationSecretEntry, type IntegrationSecretHost, IntegrationSheet, type IntegrationSignIn, type IntegrationTool, isPlacedSecret, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, placedSecrets, } from "./kinds/integration/schema.js";
|
|
17
18
|
export type { KnowledgeSource } from "./kinds/knowledge/schema.js";
|
|
18
19
|
export type { ModelAlias, Models } from "./kinds/models/schema.js";
|
|
19
20
|
export { backendSheet, pluginFromIntegrationSheet } from "./kinds/plugin/backend.js";
|
|
@@ -22,6 +23,7 @@ export { ARGUMENT_NAME_PATTERN, DEFAULT_BACKEND_ENTRY, ENV_NAME_PATTERN, MAX_PLU
|
|
|
22
23
|
export { type PluginSettingField, type PluginSettingValue, settingValueProblem, } from "./kinds/plugin/setting-values.js";
|
|
23
24
|
export type { Provider } from "./kinds/provider/schema.js";
|
|
24
25
|
export type { Routine, RoutineTarget, RoutineTrigger } from "./kinds/routine/schema.js";
|
|
26
|
+
export { WEBHOOK_REFUSED_HEADERS } from "./kinds/routine/webhook-headers.js";
|
|
25
27
|
export type { Runtime } from "./kinds/runtime/schema.js";
|
|
26
28
|
export type { Skill } from "./kinds/skill/schema.js";
|
|
27
29
|
export { type PathLookup, skillScriptsRefusal, touchesSkillScripts, } from "./kinds/skill/scripts-folder.js";
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
// The public API of @halonicjs/format. Internal code imports by relative path.
|
|
2
2
|
export { compact } from "./compact.js";
|
|
3
3
|
export { jsonSchemaOf } from "./json-schema.js";
|
|
4
|
-
export { AGENT_HARNESSES, asciiAllowedSites, defaultWorkingFolder, isInWorkingFolder, MAX_ALLOWED_SITES, } from "./kinds/agent/sandbox-fields.js";
|
|
4
|
+
export { AGENT_HARNESSES, asciiAllowedSites, defaultWorkingFolder, isInWorkingFolder, MAX_ALLOWED_SITES, PROTECTED_TOP_NAMES, workingFolderProblem, } from "./kinds/agent/sandbox-fields.js";
|
|
5
5
|
export { touchesWorkingFolder, workingFolderRefusal, } from "./kinds/agent/working-folder-start.js";
|
|
6
6
|
export { FIELD_TYPES } from "./kinds/collection/schema.js";
|
|
7
7
|
export { connectorIsLocal } from "./kinds/connector/is-local.js";
|
|
8
|
-
export { approveAll, needsApproval } from "./kinds/connector/schema.js";
|
|
8
|
+
export { approveAll, marksRead, needsApproval } from "./kinds/connector/schema.js";
|
|
9
|
+
export { approvedSignIns, } from "./kinds/integration/approved-sign-ins.js";
|
|
9
10
|
export { checkIntegrationSheet } from "./kinds/integration/kind.js";
|
|
10
11
|
export { parseIntegrationSheet } from "./kinds/integration/parse-sheet.js";
|
|
11
12
|
export { integrationPolicy, } from "./kinds/integration/policy.js";
|
|
12
|
-
export { ADDRESS_CLASSES, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, IntegrationSheet, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, } from "./kinds/integration/schema.js";
|
|
13
|
+
export { ADDRESS_CLASSES, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, IntegrationSheet, isPlacedSecret, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, placedSecrets, } from "./kinds/integration/schema.js";
|
|
13
14
|
export { backendSheet, pluginFromIntegrationSheet } from "./kinds/plugin/backend.js";
|
|
14
15
|
export { checkPlugin } from "./kinds/plugin/checks.js";
|
|
15
16
|
export { ARGUMENT_NAME_PATTERN, DEFAULT_BACKEND_ENTRY, ENV_NAME_PATTERN, MAX_PLUGIN_ID_LENGTH, MAX_PLUGIN_SECRET_NAME_LENGTH, NPM_EXACT_VERSION_PATTERN, networkSiteProblem, Plugin, PYPI_EXACT_VERSION_PATTERN, pluginPathProblem, } from "./kinds/plugin/schema.js";
|
|
16
17
|
export { settingValueProblem, } from "./kinds/plugin/setting-values.js";
|
|
18
|
+
export { WEBHOOK_REFUSED_HEADERS } from "./kinds/routine/webhook-headers.js";
|
|
17
19
|
export { skillScriptsRefusal, touchesSkillScripts, } from "./kinds/skill/scripts-folder.js";
|
|
18
20
|
export { parseFile, } from "./parse-file.js";
|
|
19
21
|
export { fileKinds, isKindName, kindNames } from "./registry.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export { approvedSignIns, type ResolvedSignIn, } from "../kinds/integration/approved-sign-ins.js";
|
|
1
2
|
export { checkIntegrationSheet } from "../kinds/integration/kind.js";
|
|
2
3
|
export { parseIntegrationSheet, type SheetProblem } from "../kinds/integration/parse-sheet.js";
|
|
3
|
-
export { type IntegrationLimits, type IntegrationPolicy, integrationPolicy, type PolicyProblem, type ResolvedIntegration, } from "../kinds/integration/policy.js";
|
|
4
|
-
export { ADDRESS_CLASSES, type AddressClass, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, type IntegrationHost, type IntegrationSecret, type IntegrationSecretHost, IntegrationSheet, type IntegrationTool, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, } from "../kinds/integration/schema.js";
|
|
4
|
+
export { type DeclaredClientSecret, type DeclaredSignIn, type DeclaredSignInPlacement, type IntegrationLimits, type IntegrationPolicy, integrationPolicy, type PolicyProblem, type ResolvedIntegration, } from "../kinds/integration/policy.js";
|
|
5
|
+
export { ADDRESS_CLASSES, type AddressClass, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, type IntegrationClientSecret, type IntegrationHost, type IntegrationSecret, type IntegrationSecretEntry, type IntegrationSecretHost, IntegrationSheet, type IntegrationSignIn, type IntegrationTool, isPlacedSecret, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, placedSecrets, } from "../kinds/integration/schema.js";
|
|
5
6
|
export { backendSheet, pluginFromIntegrationSheet } from "../kinds/plugin/backend.js";
|
|
6
7
|
export { Plugin } from "../kinds/plugin/schema.js";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// The public API of @halonicjs/format/integration: the permission sheet for
|
|
2
2
|
// the integration kit and the conformance suite. It must not import `yaml`,
|
|
3
3
|
// even indirectly; integration-entry.test.ts checks that.
|
|
4
|
+
export { approvedSignIns, } from "../kinds/integration/approved-sign-ins.js";
|
|
4
5
|
export { checkIntegrationSheet } from "../kinds/integration/kind.js";
|
|
5
6
|
export { parseIntegrationSheet } from "../kinds/integration/parse-sheet.js";
|
|
6
7
|
export { integrationPolicy, } from "../kinds/integration/policy.js";
|
|
7
|
-
export { ADDRESS_CLASSES, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, IntegrationSheet, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, } from "../kinds/integration/schema.js";
|
|
8
|
+
export { ADDRESS_CLASSES, CONTENT_PATH_PATTERN, HOST_PATTERN, INTEGRATION_NAME_PATTERN, IntegrationSheet, isPlacedSecret, MAX_RESPONSE_BYTES, MAX_TIMEOUT_MS, placedSecrets, } from "../kinds/integration/schema.js";
|
|
8
9
|
export { backendSheet, pluginFromIntegrationSheet } from "../kinds/plugin/backend.js";
|
|
9
10
|
export { Plugin } from "../kinds/plugin/schema.js";
|
|
@@ -31,12 +31,14 @@ export declare function defaultWorkingFolder(agentId: string): string;
|
|
|
31
31
|
* Why a working folder can't be used, or `null` when it can. It must be a
|
|
32
32
|
* path relative to the workspace with `/` between its parts, that stays in
|
|
33
33
|
* the workspace and doesn't point into a {@link PROTECTED_TOP_NAMES} entry
|
|
34
|
-
* or a
|
|
35
|
-
* Code, Codex and editors read hooks, commands and tasks from those
|
|
34
|
+
* or, at any depth, a folder whose name starts with `.`: tools such as git,
|
|
35
|
+
* Claude Code, Codex and editors read hooks, commands and tasks from those
|
|
36
36
|
* (`.git`, `.claude`, `.codex`, `.vscode`), and would run them outside the
|
|
37
|
-
* sandbox.
|
|
38
|
-
*
|
|
39
|
-
* are
|
|
37
|
+
* sandbox. Any depth, because a nested clone such as `vendor/lib` has a
|
|
38
|
+
* `.git` of its own (HAL-5951). Parts that Windows or macOS would read as
|
|
39
|
+
* another name are refused too, in fullwidth forms as well (see
|
|
40
|
+
* {@link relativePathProblem}). Symlinks are resolved later, when the
|
|
41
|
+
* sandbox profile is built.
|
|
40
42
|
*
|
|
41
43
|
* @param path - the `workingFolder` value
|
|
42
44
|
* @returns a message, or `null`
|
|
@@ -87,3 +89,11 @@ export declare function asciiAllowedSites(sites: readonly string[]): string[];
|
|
|
87
89
|
export declare const WorkingFolder: import("zod").ZodString;
|
|
88
90
|
/** One `allowedSites` entry: a host name, or `*.` and a domain. */
|
|
89
91
|
export declare const AllowedSite: import("zod").ZodString;
|
|
92
|
+
/**
|
|
93
|
+
* A list of {@link AllowedSite}s, at most {@link MAX_ALLOWED_SITES}, for a
|
|
94
|
+
* field inside a union, such as a connector's `transport`. The cap is a
|
|
95
|
+
* refinement rather than `max`, because a union reports a list that's too
|
|
96
|
+
* long only as its whole input being wrong, not at the list. The JSON
|
|
97
|
+
* Schema still shows the cap as `maxItems`, so editors know it too.
|
|
98
|
+
*/
|
|
99
|
+
export declare const AllowedSitesInUnion: import("zod").ZodArray<import("zod").ZodString>;
|
|
@@ -50,12 +50,14 @@ export function defaultWorkingFolder(agentId) {
|
|
|
50
50
|
* Why a working folder can't be used, or `null` when it can. It must be a
|
|
51
51
|
* path relative to the workspace with `/` between its parts, that stays in
|
|
52
52
|
* the workspace and doesn't point into a {@link PROTECTED_TOP_NAMES} entry
|
|
53
|
-
* or a
|
|
54
|
-
* Code, Codex and editors read hooks, commands and tasks from those
|
|
53
|
+
* or, at any depth, a folder whose name starts with `.`: tools such as git,
|
|
54
|
+
* Claude Code, Codex and editors read hooks, commands and tasks from those
|
|
55
55
|
* (`.git`, `.claude`, `.codex`, `.vscode`), and would run them outside the
|
|
56
|
-
* sandbox.
|
|
57
|
-
*
|
|
58
|
-
* are
|
|
56
|
+
* sandbox. Any depth, because a nested clone such as `vendor/lib` has a
|
|
57
|
+
* `.git` of its own (HAL-5951). Parts that Windows or macOS would read as
|
|
58
|
+
* another name are refused too, in fullwidth forms as well (see
|
|
59
|
+
* {@link relativePathProblem}). Symlinks are resolved later, when the
|
|
60
|
+
* sandbox profile is built.
|
|
59
61
|
*
|
|
60
62
|
* @param path - the `workingFolder` value
|
|
61
63
|
* @returns a message, or `null`
|
|
@@ -64,12 +66,14 @@ export function workingFolderProblem(path) {
|
|
|
64
66
|
const pathProblem = relativePathProblem(path, { root: "the workspace", part: "folder name" });
|
|
65
67
|
if (pathProblem !== null)
|
|
66
68
|
return pathProblem;
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
if (PROTECTED_TOP_NAMES.includes(
|
|
70
|
-
return `The agent can't write in '${
|
|
69
|
+
const shownParts = path.split("/");
|
|
70
|
+
const parts = foldName(path).split("/");
|
|
71
|
+
if (PROTECTED_TOP_NAMES.includes(parts[0] ?? "")) {
|
|
72
|
+
return `The agent can't write in '${shownParts[0]}': it holds definitions or Halonic's own data`;
|
|
71
73
|
}
|
|
72
|
-
|
|
74
|
+
const dotPart = parts.findIndex((part) => part.startsWith("."));
|
|
75
|
+
if (dotPart !== -1) {
|
|
76
|
+
const shown = shownParts.slice(0, dotPart + 1).join("/");
|
|
73
77
|
return `The agent can't write in '${shown}': tools read settings and hooks from folders that start with '.'`;
|
|
74
78
|
}
|
|
75
79
|
return null;
|
|
@@ -195,3 +199,18 @@ export const AllowedSite = s.string().superRefine((site, context) => {
|
|
|
195
199
|
if (problem !== null)
|
|
196
200
|
context.addIssue({ code: "custom", message: problem });
|
|
197
201
|
});
|
|
202
|
+
/**
|
|
203
|
+
* A list of {@link AllowedSite}s, at most {@link MAX_ALLOWED_SITES}, for a
|
|
204
|
+
* field inside a union, such as a connector's `transport`. The cap is a
|
|
205
|
+
* refinement rather than `max`, because a union reports a list that's too
|
|
206
|
+
* long only as its whole input being wrong, not at the list. The JSON
|
|
207
|
+
* Schema still shows the cap as `maxItems`, so editors know it too.
|
|
208
|
+
*/
|
|
209
|
+
export const AllowedSitesInUnion = s
|
|
210
|
+
.array(AllowedSite)
|
|
211
|
+
.superRefine((sites, context) => {
|
|
212
|
+
if (sites.length > MAX_ALLOWED_SITES) {
|
|
213
|
+
context.addIssue({ code: "custom", message: `Name at most ${MAX_ALLOWED_SITES} sites` });
|
|
214
|
+
}
|
|
215
|
+
})
|
|
216
|
+
.meta({ maxItems: MAX_ALLOWED_SITES });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s } from "../../../../schema-kit/src/index.js";
|
|
2
|
-
import { collectionId, id, ModelParams, version } from "../../shared/fields.js";
|
|
2
|
+
import { agentId, collectionId, id, ModelParams, version } from "../../shared/fields.js";
|
|
3
3
|
import { AgentHarness, AllowedSite, MAX_ALLOWED_SITES, WorkingFolder } from "./sandbox-fields.js";
|
|
4
4
|
/** The shape of an agent's reply: free text, one of a list of options, or JSON. */
|
|
5
5
|
export const AgentOutput = s.discriminatedUnion("type", [
|
|
@@ -74,7 +74,7 @@ export const AgentCharacter = s
|
|
|
74
74
|
export const Agent = s
|
|
75
75
|
.object({
|
|
76
76
|
version,
|
|
77
|
-
id,
|
|
77
|
+
id: agentId,
|
|
78
78
|
name: s.string().min(1),
|
|
79
79
|
description: s.string().optional(),
|
|
80
80
|
/** Model alias (preferred) or "provider/model". */
|
|
@@ -14,7 +14,7 @@ export function connectorIsLocal(connector) {
|
|
|
14
14
|
if ("stdio" in transport) {
|
|
15
15
|
return true;
|
|
16
16
|
}
|
|
17
|
-
if ("google" in transport) {
|
|
17
|
+
if ("google" in transport || "integration" in transport || "plugin" in transport) {
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
20
|
const host = hostOf(transport.http.url);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { passesNameRule } from "../../../../ports/src/index.js";
|
|
2
|
+
import { isSecretVariableName } from "../../../../std/src/index.js";
|
|
1
3
|
import { checkKeysIn } from "../../shared/key-in-value.js";
|
|
2
4
|
import { checkSecretName, looksLikeKey } from "../../shared/secret-name.js";
|
|
3
5
|
import { approveAll, Connector } from "./schema.js";
|
|
@@ -15,7 +17,9 @@ export const connectorKind = {
|
|
|
15
17
|
...checkSecretNames(connector),
|
|
16
18
|
...checkGoogleValues(connector),
|
|
17
19
|
...checkPastedKeys(connector),
|
|
20
|
+
...checkInheritedNames(connector),
|
|
18
21
|
...checkApprovedTools(connector),
|
|
22
|
+
...checkReadTools(connector),
|
|
19
23
|
],
|
|
20
24
|
};
|
|
21
25
|
/**
|
|
@@ -78,6 +82,51 @@ function checkPastedKeys(connector) {
|
|
|
78
82
|
}
|
|
79
83
|
return [];
|
|
80
84
|
}
|
|
85
|
+
/** A variable name a program can be given: letters, digits and `_`, not starting with a digit. */
|
|
86
|
+
const variableName = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
87
|
+
/*
|
|
88
|
+
* The words are the team's (HAL-6266), next to the placeholders of
|
|
89
|
+
* `secret-name.ts` and `key-in-value.ts` that wait on the board.
|
|
90
|
+
*/
|
|
91
|
+
const inheritWords = {
|
|
92
|
+
"inherit-env-name": (name) => `"${name}" isn't a variable name. Use only letters, digits and _, not starting with a digit.`,
|
|
93
|
+
"inherit-env-secret": (name) => `"${name}" looks like it holds a secret, so it can't be taken from your environment. Store the value as a secret and set this variable under secretEnv to the secret's name instead.`,
|
|
94
|
+
"inherit-env-duplicate": (name) => `"${name}" is already in this list. Name each variable once, whatever its letter case.`,
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* `inheritEnv` names variables a local program takes from the app's own
|
|
98
|
+
* environment. A name that says it holds a secret, such as
|
|
99
|
+
* `ANTHROPIC_API_KEY`, is refused: a workspace file must not reach for a
|
|
100
|
+
* key in the person's shell, and `secretEnv` names the secret openly. A name
|
|
101
|
+
* written twice, in any letter case, is refused too, since Windows reads
|
|
102
|
+
* `Aws_Profile` and `AWS_PROFILE` as one variable.
|
|
103
|
+
*/
|
|
104
|
+
function checkInheritedNames(connector) {
|
|
105
|
+
if (!("stdio" in connector.transport)) {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
const problems = [];
|
|
109
|
+
const seen = new Set();
|
|
110
|
+
(connector.transport.stdio.inheritEnv ?? []).forEach((name, index) => {
|
|
111
|
+
const path = ["transport", "stdio", "inheritEnv", index];
|
|
112
|
+
const folded = name.toUpperCase();
|
|
113
|
+
const repeated = seen.has(folded);
|
|
114
|
+
seen.add(folded);
|
|
115
|
+
if (!variableName.test(name)) {
|
|
116
|
+
const code = "inherit-env-name";
|
|
117
|
+
problems.push({ severity: "error", code, path, message: inheritWords[code](name) });
|
|
118
|
+
}
|
|
119
|
+
else if (isSecretVariableName(name)) {
|
|
120
|
+
const code = "inherit-env-secret";
|
|
121
|
+
problems.push({ severity: "error", code, path, message: inheritWords[code](name) });
|
|
122
|
+
}
|
|
123
|
+
else if (repeated) {
|
|
124
|
+
const code = "inherit-env-duplicate";
|
|
125
|
+
problems.push({ severity: "error", code, path, message: inheritWords[code](name) });
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
return problems;
|
|
129
|
+
}
|
|
81
130
|
/**
|
|
82
131
|
* An argument's value and the option it belongs to: `--api-key=…` and
|
|
83
132
|
* `--api-key …` both name the value, so a key without a known format is
|
|
@@ -117,3 +166,53 @@ function checkApprovedTools(connector) {
|
|
|
117
166
|
});
|
|
118
167
|
return problems;
|
|
119
168
|
}
|
|
169
|
+
/** Characters that make a name in `tools.read` look like a pattern, not a tool's name. */
|
|
170
|
+
const patternCharacters = /[*?[\]{}]/;
|
|
171
|
+
/**
|
|
172
|
+
* Said when a name in `tools.read` fails the listed-tool name rule. It
|
|
173
|
+
* doesn't quote the name: the character at fault may be invisible, so the
|
|
174
|
+
* name would look right. Wording: Sofia, HAL-5762.
|
|
175
|
+
*/
|
|
176
|
+
const readNameBreaksRule = `"read" needs exact tool names: letters a–z and A–Z, digits 0–9, "_" and "-", up to 64 characters. This one doesn't match, often because of a space, a look-alike letter or an invisible character.`;
|
|
177
|
+
/**
|
|
178
|
+
* `tools.read` takes exact names only, so a pattern is refused rather than
|
|
179
|
+
* matching nothing in silence. A name must also pass the name rule that a
|
|
180
|
+
* server's tool names pass, so a look-alike letter, a space or an invisible
|
|
181
|
+
* character can't make a name read as one tool and be another; it is
|
|
182
|
+
* refused too. A name that `tools.allow` leaves out is never offered, so
|
|
183
|
+
* say so. Without `tools.allow` nothing checks the names against a listing:
|
|
184
|
+
* a name, exactly as written, makes a tool `read` as soon as a server lists
|
|
185
|
+
* a tool by that name. Wording: Sofia, HAL-5582 and HAL-5762.
|
|
186
|
+
*/
|
|
187
|
+
function checkReadTools(connector) {
|
|
188
|
+
const { allow, read } = connector.tools;
|
|
189
|
+
const problems = [];
|
|
190
|
+
read?.forEach((tool, index) => {
|
|
191
|
+
const path = ["tools", "read", index];
|
|
192
|
+
if (patternCharacters.test(tool)) {
|
|
193
|
+
problems.push({
|
|
194
|
+
severity: "error",
|
|
195
|
+
code: "read-tool-pattern",
|
|
196
|
+
path,
|
|
197
|
+
message: `"read" needs exact tool names. "${tool}" looks like a pattern.`,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
else if (!passesNameRule(tool)) {
|
|
201
|
+
problems.push({
|
|
202
|
+
severity: "error",
|
|
203
|
+
code: "read-tool-name",
|
|
204
|
+
path,
|
|
205
|
+
message: readNameBreaksRule,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
else if (allow !== undefined && !allow.includes(tool)) {
|
|
209
|
+
problems.push({
|
|
210
|
+
severity: "warning",
|
|
211
|
+
code: "read-tool-not-allowed",
|
|
212
|
+
path,
|
|
213
|
+
message: `"read" lists "${tool}", but this connector has no tool by that name. Check the spelling.`,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
return problems;
|
|
218
|
+
}
|
|
@@ -21,18 +21,29 @@ export declare const Connector: import("zod").ZodObject<{
|
|
|
21
21
|
args: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
22
22
|
env: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
23
23
|
secretEnv: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
24
|
+
inheritEnv: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
24
25
|
cwd: import("zod").ZodOptional<import("zod").ZodString>;
|
|
26
|
+
sites: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
25
27
|
}, import("zod/v4/core").$strict>;
|
|
26
28
|
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
27
29
|
google: import("zod").ZodObject<{
|
|
28
30
|
account: import("zod").ZodString;
|
|
29
31
|
client: import("zod").ZodDefault<import("zod").ZodString>;
|
|
30
32
|
}, import("zod/v4/core").$strict>;
|
|
33
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
34
|
+
integration: import("zod").ZodObject<{
|
|
35
|
+
folder: import("zod").ZodString;
|
|
36
|
+
}, import("zod/v4/core").$strict>;
|
|
37
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
38
|
+
plugin: import("zod").ZodObject<{
|
|
39
|
+
id: import("zod").ZodString;
|
|
40
|
+
}, import("zod/v4/core").$strict>;
|
|
31
41
|
}, import("zod/v4/core").$strict>]>;
|
|
32
42
|
secret: import("zod").ZodOptional<import("zod").ZodString>;
|
|
33
43
|
tools: import("zod").ZodDefault<import("zod").ZodObject<{
|
|
34
44
|
allow: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
35
45
|
approve: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodArray<import("zod").ZodString>, import("zod").ZodLiteral<"all">]>>;
|
|
46
|
+
read: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
36
47
|
}, import("zod/v4/core").$strict>>;
|
|
37
48
|
local: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
38
49
|
}, import("zod/v4/core").$strict>;
|
|
@@ -48,3 +59,16 @@ export type Connector = Infer<typeof Connector>;
|
|
|
48
59
|
* needsApproval({ approve: ["send_mail"] }, "read_mail"); // false
|
|
49
60
|
*/
|
|
50
61
|
export declare function needsApproval(tools: Pick<Connector["tools"], "approve">, tool: string): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Whether the workspace marks `tool` as only reading, as the connector's
|
|
64
|
+
* `tools.read` says: the list names it exactly, and `tools.approve` doesn't
|
|
65
|
+
* make it ask first, so `approve` wins when both name a tool. `tool` is the
|
|
66
|
+
* name the server lists the tool under. A tool this says `false` for counts
|
|
67
|
+
* as `write`, or `send` when its listing says so.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* marksRead({ approve: [], read: ["search_issues"] }, "search_issues"); // true
|
|
71
|
+
* marksRead({ approve: ["search_issues"], read: ["search_issues"] }, "search_issues"); // false
|
|
72
|
+
* marksRead({ approve: [] }, "search_issues"); // false
|
|
73
|
+
*/
|
|
74
|
+
export declare function marksRead(tools: Pick<Connector["tools"], "approve" | "read">, tool: string): boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { s } from "../../../../schema-kit/src/index.js";
|
|
2
2
|
import { id, version } from "../../shared/fields.js";
|
|
3
|
+
import { AllowedSitesInUnion } from "../agent/sandbox-fields.js";
|
|
3
4
|
/** A remote MCP server over HTTP. */
|
|
4
5
|
const HttpTransport = s
|
|
5
6
|
.object({
|
|
@@ -19,8 +20,20 @@ const StdioTransport = s
|
|
|
19
20
|
env: s.record(s.string(), s.string()).optional(),
|
|
20
21
|
/** Environment variable → secret name. */
|
|
21
22
|
secretEnv: s.record(s.string(), s.string()).optional(),
|
|
23
|
+
/**
|
|
24
|
+
* Variables taken from the app's own environment by name, such as
|
|
25
|
+
* `AWS_PROFILE`, on top of the base every program gets. No secret:
|
|
26
|
+
* a key goes in `secretEnv`.
|
|
27
|
+
*/
|
|
28
|
+
inheritEnv: s.array(s.string()).optional(),
|
|
22
29
|
/** Working directory, relative to the workspace root. */
|
|
23
30
|
cwd: s.string().optional(),
|
|
31
|
+
/**
|
|
32
|
+
* The sites the program may reach when it runs in a sandbox: host
|
|
33
|
+
* names or `*.` and a domain, with the agent file's `allowedSites`
|
|
34
|
+
* rules. Without a sandbox the program runs as before, unfenced.
|
|
35
|
+
*/
|
|
36
|
+
sites: AllowedSitesInUnion.optional(),
|
|
24
37
|
})
|
|
25
38
|
.strict(),
|
|
26
39
|
})
|
|
@@ -42,8 +55,17 @@ const GoogleTransport = s
|
|
|
42
55
|
.strict(),
|
|
43
56
|
})
|
|
44
57
|
.strict();
|
|
58
|
+
/**
|
|
59
|
+
* A local integration: a folder under `integrations/` whose code runs in the
|
|
60
|
+
* I5 runner. The tools offered are the ones its permission sheet names.
|
|
61
|
+
*/
|
|
62
|
+
const IntegrationTransport = s.object({ integration: s.object({ folder: id }).strict() }).strict();
|
|
63
|
+
/** A plugin's backend, started in the I5 runner. Same rules as a local integration. */
|
|
64
|
+
const PluginTransport = s.object({ plugin: s.object({ id }).strict() }).strict();
|
|
45
65
|
/** The `tools.approve` value that makes every tool of the connector ask a person first. */
|
|
46
66
|
export const approveAll = "all";
|
|
67
|
+
/** Said when `tools.read` isn't a list of tool names. Wording: Sofia, HAL-5582. */
|
|
68
|
+
const readNotAList = '"read" must be a list of tool names.';
|
|
47
69
|
/**
|
|
48
70
|
* `library/connectors/<id>.connector.yaml`: tools for agents from an MCP
|
|
49
71
|
* server or a built-in service. Secrets are referenced by name only.
|
|
@@ -54,7 +76,13 @@ export const Connector = s
|
|
|
54
76
|
id,
|
|
55
77
|
name: s.string().optional(),
|
|
56
78
|
description: s.string().optional(),
|
|
57
|
-
transport: s.union([
|
|
79
|
+
transport: s.union([
|
|
80
|
+
HttpTransport,
|
|
81
|
+
StdioTransport,
|
|
82
|
+
GoogleTransport,
|
|
83
|
+
IntegrationTransport,
|
|
84
|
+
PluginTransport,
|
|
85
|
+
]),
|
|
58
86
|
/**
|
|
59
87
|
* HTTP: the secret sent as a bearer token. Google: kept so older files
|
|
60
88
|
* still read, but it names no secret: the account's Google setup keeps
|
|
@@ -71,10 +99,18 @@ export const Connector = s
|
|
|
71
99
|
* adds later: a new MCP connector starts with it.
|
|
72
100
|
*/
|
|
73
101
|
approve: s.union([s.array(s.string()), s.literal(approveAll)]).default([]),
|
|
102
|
+
/**
|
|
103
|
+
* Tools listed here run without asking. Only list tools that don't
|
|
104
|
+
* change anything. Exact names only, no patterns: every tool not
|
|
105
|
+
* listed still asks first, and a tool `approve` names asks whatever
|
|
106
|
+
* this list says. Only the person writing this file sets it; nothing
|
|
107
|
+
* a connector's server lists can add a tool to it.
|
|
108
|
+
*/
|
|
109
|
+
read: s.array(s.string({ error: readNotAList }), { error: readNotAList }).optional(),
|
|
74
110
|
})
|
|
75
111
|
.strict()
|
|
76
112
|
.default({ approve: [] }),
|
|
77
|
-
/** Runs on this machine or your own network. Default: true for stdio and localhost URLs. */
|
|
113
|
+
/** Runs on this machine or your own network. Default: true for stdio and localhost URLs, false for integrations and plugins, whose sheet can name outside sites. */
|
|
78
114
|
local: s.boolean().optional(),
|
|
79
115
|
})
|
|
80
116
|
.strict();
|
|
@@ -90,3 +126,18 @@ export const Connector = s
|
|
|
90
126
|
export function needsApproval(tools, tool) {
|
|
91
127
|
return tools.approve === approveAll || tools.approve.includes(tool);
|
|
92
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Whether the workspace marks `tool` as only reading, as the connector's
|
|
131
|
+
* `tools.read` says: the list names it exactly, and `tools.approve` doesn't
|
|
132
|
+
* make it ask first, so `approve` wins when both name a tool. `tool` is the
|
|
133
|
+
* name the server lists the tool under. A tool this says `false` for counts
|
|
134
|
+
* as `write`, or `send` when its listing says so.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* marksRead({ approve: [], read: ["search_issues"] }, "search_issues"); // true
|
|
138
|
+
* marksRead({ approve: ["search_issues"], read: ["search_issues"] }, "search_issues"); // false
|
|
139
|
+
* marksRead({ approve: [] }, "search_issues"); // false
|
|
140
|
+
*/
|
|
141
|
+
export function marksRead(tools, tool) {
|
|
142
|
+
return (tools.read?.includes(tool) ?? false) && !needsApproval(tools, tool);
|
|
143
|
+
}
|
|
@@ -9,8 +9,15 @@ export const deploymentsKind = {
|
|
|
9
9
|
idFromPlace: "none",
|
|
10
10
|
check: checkDeployments,
|
|
11
11
|
};
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* The default deployment, when one is named, must be one of the listed ones,
|
|
14
|
+
* and Cloudflare settings on another host are flagged as unused.
|
|
15
|
+
*/
|
|
13
16
|
function checkDeployments(file) {
|
|
17
|
+
return [...checkDefault(file), ...checkUnusedCloudflare(file)];
|
|
18
|
+
}
|
|
19
|
+
/** The default deployment, when one is named, must be one of the listed ones. */
|
|
20
|
+
function checkDefault(file) {
|
|
14
21
|
if (file.default === undefined || Object.hasOwn(file.deployments, file.default)) {
|
|
15
22
|
return [];
|
|
16
23
|
}
|
|
@@ -23,3 +30,20 @@ function checkDeployments(file) {
|
|
|
23
30
|
},
|
|
24
31
|
];
|
|
25
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Cloudflare settings on a deployment that runs elsewhere are a warning, not
|
|
35
|
+
* an error: moving a deployment to another host changes only `host:`, so the
|
|
36
|
+
* settings may stay behind for the way back (ADR HAL-35, 2).
|
|
37
|
+
*/
|
|
38
|
+
function checkUnusedCloudflare(file) {
|
|
39
|
+
return Object.entries(file.deployments).flatMap(([id, deployment]) => deployment.cloudflare === undefined || deployment.host === "cloudflare"
|
|
40
|
+
? []
|
|
41
|
+
: [
|
|
42
|
+
{
|
|
43
|
+
severity: "warning",
|
|
44
|
+
code: "cloudflare-settings-unused",
|
|
45
|
+
path: ["deployments", id, "cloudflare"],
|
|
46
|
+
message: `Deployment "${id}" runs on host "${deployment.host}", so its cloudflare settings are not used`,
|
|
47
|
+
},
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { type Infer } from "../../../../schema-kit/src/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Non-secret settings for a deployment with `host: cloudflare` (ADR HAL-35,
|
|
4
|
+
* 5.7). They carry no account id, token or key, so the file stays safe to
|
|
5
|
+
* commit and the same file deploys from any account.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CloudflareSettings: import("zod").ZodObject<{
|
|
8
|
+
worker: import("zod").ZodString;
|
|
9
|
+
domain: import("zod").ZodOptional<import("zod").ZodString>;
|
|
10
|
+
location: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
11
|
+
eu: "eu";
|
|
12
|
+
}>>;
|
|
13
|
+
}, import("zod/v4/core").$strict>;
|
|
14
|
+
/** Ceilings the deployment's handler enforces, because Cloudflare has no hard spending cap. */
|
|
15
|
+
export declare const DeploymentLimits: import("zod").ZodObject<{
|
|
16
|
+
dailyRequests: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
17
|
+
}, import("zod/v4/core").$strict>;
|
|
2
18
|
/** One place the workspace runs, with its own data (runs, Inbox, records, simulations). */
|
|
3
19
|
export declare const Deployment: import("zod").ZodObject<{
|
|
4
20
|
name: import("zod").ZodString;
|
|
@@ -12,6 +28,16 @@ export declare const Deployment: import("zod").ZodObject<{
|
|
|
12
28
|
production: "production";
|
|
13
29
|
}>>;
|
|
14
30
|
shadow: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
31
|
+
cloudflare: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
32
|
+
worker: import("zod").ZodString;
|
|
33
|
+
domain: import("zod").ZodOptional<import("zod").ZodString>;
|
|
34
|
+
location: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
35
|
+
eu: "eu";
|
|
36
|
+
}>>;
|
|
37
|
+
}, import("zod/v4/core").$strict>>;
|
|
38
|
+
limits: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
39
|
+
dailyRequests: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
40
|
+
}, import("zod/v4/core").$strict>>;
|
|
15
41
|
}, import("zod/v4/core").$strict>;
|
|
16
42
|
/** `deployments.yaml`: the places the workspace runs. */
|
|
17
43
|
export declare const Deployments: import("zod").ZodObject<{
|
|
@@ -29,8 +55,22 @@ export declare const Deployments: import("zod").ZodObject<{
|
|
|
29
55
|
production: "production";
|
|
30
56
|
}>>;
|
|
31
57
|
shadow: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
58
|
+
cloudflare: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
59
|
+
worker: import("zod").ZodString;
|
|
60
|
+
domain: import("zod").ZodOptional<import("zod").ZodString>;
|
|
61
|
+
location: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
62
|
+
eu: "eu";
|
|
63
|
+
}>>;
|
|
64
|
+
}, import("zod/v4/core").$strict>>;
|
|
65
|
+
limits: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
66
|
+
dailyRequests: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
67
|
+
}, import("zod/v4/core").$strict>>;
|
|
32
68
|
}, import("zod/v4/core").$strict>>;
|
|
33
69
|
}, import("zod/v4/core").$strict>;
|
|
70
|
+
/** A deployment's Cloudflare settings. */
|
|
71
|
+
export type CloudflareSettings = Infer<typeof CloudflareSettings>;
|
|
72
|
+
/** A deployment's ceilings. */
|
|
73
|
+
export type DeploymentLimits = Infer<typeof DeploymentLimits>;
|
|
34
74
|
/** One deployment, with defaults filled in. */
|
|
35
75
|
export type Deployment = Infer<typeof Deployment>;
|
|
36
76
|
/** The content of `deployments.yaml`, with defaults filled in. */
|