@capybara-hq/kernel 0.1.0-rc.62 → 0.1.0-rc.64
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/bootstrap.json +3 -3
- package/dist/app.d.ts +2 -0
- package/dist/catalog/catalog.service.d.ts +13 -0
- package/dist/catalog/catalog.service.js +17 -8
- package/dist/catalog/git-source.d.ts +8 -0
- package/dist/catalog/git-source.js +14 -6
- package/dist/catalog/marketplaces.controller.d.ts +3 -2
- package/dist/catalog/marketplaces.controller.js +5 -2
- package/dist/catalog/marketplaces.schemas.d.ts +7 -0
- package/dist/catalog/marketplaces.schemas.js +13 -0
- package/dist/catalog/marketplaces.service.d.ts +65 -11
- package/dist/catalog/marketplaces.service.js +208 -30
- package/dist/catalog/org-catalog.schemas.d.ts +1 -1
- package/dist/catalog/org-catalog.schemas.js +1 -1
- package/dist/channels/actions.d.ts +2 -5
- package/dist/channels/actions.js +20 -8
- package/dist/channels/cards.d.ts +4 -3
- package/dist/channels/cards.js +6 -4
- package/dist/channels/outbound.js +3 -2
- package/dist/config/schema.d.ts +2 -0
- package/dist/config/schema.js +22 -2
- package/dist/conversations/approval-profile.d.ts +30 -0
- package/dist/conversations/approval-profile.js +62 -0
- package/dist/conversations/conversations.service.js +0 -2
- package/dist/conversations/events.d.ts +43 -0
- package/dist/conversations/events.js +52 -0
- package/dist/conversations/permission-profiles.controller.d.ts +3 -2
- package/dist/conversations/permission-profiles.service.d.ts +3 -2
- package/dist/conversations/permission-profiles.service.js +12 -8
- package/dist/db/kernel-schema.d.ts +8 -2
- package/dist/errors.d.ts +7 -0
- package/dist/errors.js +7 -0
- package/dist/extensions/bootstrap-defaults.d.ts +24 -0
- package/dist/extensions/bootstrap-defaults.js +78 -0
- package/dist/extensions/bootstrap-extra.d.ts +74 -0
- package/dist/extensions/bootstrap-extra.js +131 -0
- package/dist/extensions/bootstrap.d.ts +77 -13
- package/dist/extensions/bootstrap.js +282 -48
- package/dist/identity/initial-passwords.controller.d.ts +8 -6
- package/dist/identity/initial-passwords.controller.js +13 -7
- package/dist/identity/initial-passwords.d.ts +22 -13
- package/dist/identity/initial-passwords.js +25 -29
- package/dist/identity/settings.d.ts +10 -0
- package/dist/identity/settings.js +46 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/kernel.module.js +3 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +7 -1
- package/dist/lifecycle/kernel-lifecycle.js +69 -16
- package/dist/local-devices/relay.js +3 -1
- package/dist/models/images.js +5 -4
- package/dist/platform/connector-person-fields.js +2 -2
- package/dist/platform/exclusions.js +4 -4
- package/dist/platform/method.js +1 -1
- package/dist/platform/operation.d.ts +9 -7
- package/dist/platform/operation.js +1 -1
- package/dist/platform/ops/accounts.ops.d.ts +1 -1
- package/dist/platform/ops/accounts.ops.js +3 -3
- package/dist/platform/ops/channels.ops.d.ts +1 -1
- package/dist/platform/ops/channels.ops.js +2 -2
- package/dist/platform/ops/connectors.ops.d.ts +2 -2
- package/dist/platform/ops/connectors.ops.js +8 -8
- package/dist/platform/ops/extensions-admin.ops.d.ts +1 -1
- package/dist/platform/ops/extensions-admin.ops.js +3 -3
- package/dist/platform/ops/extensions.ops.d.ts +1 -1
- package/dist/platform/ops/extensions.ops.js +4 -4
- package/dist/platform/ops/marketplaces.ops.js +27 -4
- package/dist/platform/ops/org-plugins.ops.js +2 -2
- package/dist/platform/ops/orgs.ops.d.ts +1 -1
- package/dist/platform/ops/orgs.ops.js +3 -3
- package/dist/platform/ops/plugins.ops.d.ts +1 -1
- package/dist/platform/ops/plugins.ops.js +2 -2
- package/dist/platform/person-fields.d.ts +4 -3
- package/dist/platform/person-fields.js +6 -5
- package/dist/platform/sealed-inputs.d.ts +2 -2
- package/dist/platform/sealed-inputs.js +2 -2
- package/dist/platform/sealed-reveals.controller.d.ts +5 -8
- package/dist/platform/sealed-reveals.controller.js +8 -8
- package/dist/platform/sealed-reveals.d.ts +19 -17
- package/dist/platform/sealed-reveals.js +30 -33
- package/dist/runtime/context/build.js +3 -0
- package/dist/runtime/context/compaction.js +2 -0
- package/dist/runtime/waits.js +3 -2
- package/dist/sandbox/operation-authority.js +16 -15
- package/dist/sandbox/operation-intents.js +2 -2
- package/dist/sandbox/permission-availability.d.ts +49 -3
- package/dist/sandbox/permission-availability.js +61 -6
- package/dist/sandbox/permission-call-types.d.ts +3 -0
- package/dist/sandbox/permission-facts.d.ts +29 -1
- package/dist/sandbox/permission-facts.js +29 -6
- package/dist/sandbox/review/classifier.d.ts +72 -2
- package/dist/sandbox/review/classifier.js +113 -38
- package/dist/sandbox/review/index.d.ts +2 -2
- package/dist/sandbox/review/index.js +1 -1
- package/dist/sandbox/review/review.service.d.ts +1 -4
- package/dist/sandbox/review/review.service.js +4 -33
- package/dist/setup/setup-guides.service.js +1 -1
- package/dist/tools/approvals.service.d.ts +71 -16
- package/dist/tools/approvals.service.js +139 -13
- package/dist/tools/builtins/builtin-tools.d.ts +1 -1
- package/dist/tools/builtins/builtin-tools.js +12 -6
- package/dist/tools/builtins/platform.d.ts +15 -11
- package/dist/tools/builtins/platform.js +49 -39
- package/dist/tools/builtins/sandbox/bash.d.ts +1 -1
- package/dist/tools/builtins/sandbox/bash.js +32 -14
- package/dist/tools/builtins/sandbox/common.d.ts +12 -3
- package/dist/tools/builtins/sandbox/common.js +29 -5
- package/dist/tools/connectors.schemas.d.ts +1 -1
- package/dist/tools/connectors.schemas.js +1 -1
- package/dist/tools/pipeline.d.ts +70 -10
- package/dist/tools/pipeline.js +356 -48
- package/dist/tools/policy.d.ts +4 -3
- package/dist/tools/policy.js +6 -6
- package/dist/tools/registry.d.ts +25 -9
- package/dist/tools/tool-review.d.ts +113 -0
- package/dist/tools/tool-review.js +303 -0
- package/dist/tools/tools.module.js +6 -0
- package/package.json +4 -4
- package/src/migrations/0174_marketplace_managed_username.sql +4 -0
- package/src/migrations/0175_secure_input_kind.sql +8 -0
|
@@ -10,6 +10,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
10
10
|
import { randomInt } from "node:crypto";
|
|
11
11
|
import { Inject, Injectable } from "@nestjs/common";
|
|
12
12
|
import { sql } from "kysely";
|
|
13
|
+
import { accessibleTo } from "../conversations/access.js";
|
|
13
14
|
import { initialPasswordAad as aadOf } from "../ctx/secrets.js";
|
|
14
15
|
import { ApiError } from "../errors.js";
|
|
15
16
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
@@ -23,12 +24,11 @@ const ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789";
|
|
|
23
24
|
/** 20 characters of 56: about 116 bits. */
|
|
24
25
|
const LENGTH = 20;
|
|
25
26
|
/**
|
|
26
|
-
* How long a generated password waits for its reader. The
|
|
27
|
-
* the call runs; one that is never read expires (the account can still be disabled
|
|
27
|
+
* How long a generated password waits for its reader. The person the call was made for reads it
|
|
28
|
+
* right after the call runs; one that is never read expires (the account can still be disabled
|
|
29
|
+
* and recreated).
|
|
28
30
|
*/
|
|
29
31
|
export const INITIAL_PASSWORD_TTL_MS = 24 * 60 * 60 * 1000;
|
|
30
|
-
/** The tool key of the approval a generated password belongs to. */
|
|
31
|
-
export const CREATE_ACCOUNT_TOOL_KEY = "Platform:accounts.create";
|
|
32
32
|
/** A one-time initial password, cryptographically random. */
|
|
33
33
|
export function generateInitialPassword() {
|
|
34
34
|
let out = "";
|
|
@@ -40,7 +40,7 @@ export function generateInitialPassword() {
|
|
|
40
40
|
* Accounts created with a kernel-generated one-time password (Platform tool spec §14.5 item 2).
|
|
41
41
|
* The password never leaves the kernel except through {@link reveal}: it is not returned to the
|
|
42
42
|
* caller, not written to the audit, the event log or the logs. It is sealed with the master keyring
|
|
43
|
-
* in the creation's transaction and read once, on the web, by the person
|
|
43
|
+
* in the creation's transaction and read once, on the web, by the person the call was made for.
|
|
44
44
|
*/
|
|
45
45
|
let InitialPasswords = class InitialPasswords {
|
|
46
46
|
db;
|
|
@@ -82,35 +82,31 @@ let InitialPasswords = class InitialPasswords {
|
|
|
82
82
|
.execute();
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
|
-
* The password created by an
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* the
|
|
85
|
+
* The password created by an `accounts.create` call (`call` in `orgId`), read once by its
|
|
86
|
+
* recipient `accountId` while the call's conversation is still accessible to them, then deleted
|
|
87
|
+
* (plan ruling R6: read by call, whether the call ran under an approval or automatically).
|
|
88
|
+
* Anything else (not the recipient, the conversation not accessible, not run yet, read already,
|
|
89
|
+
* expired) is `account.initial_password_unavailable`, saying nothing about which. Audits the read
|
|
90
|
+
* (without the password).
|
|
90
91
|
*/
|
|
91
|
-
async reveal(orgId,
|
|
92
|
-
const unavailable = () => new ApiError("account.initial_password_unavailable", "No initial password to show: it was shown already, has expired, or the account was not created by a call you
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
.select(["conversation_id", "run_id", "call_id", "tool_key", "status", "decided_by"])
|
|
96
|
-
.where("id", "=", approvalId)
|
|
97
|
-
.where("org_id", "=", orgId)
|
|
98
|
-
.executeTakeFirst();
|
|
99
|
-
if (approval === undefined ||
|
|
100
|
-
approval.tool_key !== CREATE_ACCOUNT_TOOL_KEY ||
|
|
101
|
-
approval.status !== "approved" ||
|
|
102
|
-
approval.decided_by !== accountId) {
|
|
103
|
-
throw unavailable();
|
|
104
|
-
}
|
|
105
|
-
// exactly the row of this approval's call: locked, then deleted by its key
|
|
92
|
+
async reveal(orgId, call, accountId) {
|
|
93
|
+
const unavailable = () => new ApiError("account.initial_password_unavailable", "No initial password to show: it was shown already, has expired, or the account was not created by a call made for you");
|
|
94
|
+
// exactly the row of this call, for its recipient in a conversation of this org they can
|
|
95
|
+
// still see: locked, then deleted by its key
|
|
106
96
|
const found = await this.db
|
|
107
97
|
.selectFrom("account_initial_passwords")
|
|
108
98
|
.select("account_id")
|
|
109
|
-
.where("conversation_id", "=",
|
|
110
|
-
.where("run_id", "=",
|
|
111
|
-
.where("call_id", "=",
|
|
99
|
+
.where("conversation_id", "=", call.conversationId)
|
|
100
|
+
.where("run_id", "=", call.runId)
|
|
101
|
+
.where("call_id", "=", call.callId)
|
|
112
102
|
.where("recipient_account_id", "=", accountId)
|
|
113
103
|
.where("expires_at", ">", sql `now()`)
|
|
104
|
+
.where((eb) => eb.exists(eb
|
|
105
|
+
.selectFrom("conversations")
|
|
106
|
+
.select("conversations.id")
|
|
107
|
+
.whereRef("conversations.id", "=", "account_initial_passwords.conversation_id")
|
|
108
|
+
.where("conversations.org_id", "=", orgId)
|
|
109
|
+
.where(accessibleTo(accountId))))
|
|
114
110
|
.limit(1)
|
|
115
111
|
.forUpdate()
|
|
116
112
|
.executeTakeFirst();
|
|
@@ -132,7 +128,7 @@ let InitialPasswords = class InitialPasswords {
|
|
|
132
128
|
orgId,
|
|
133
129
|
action: "account.initial_password_shown",
|
|
134
130
|
target: row.account_id,
|
|
135
|
-
detail: {
|
|
131
|
+
detail: { conversationId: call.conversationId, runId: call.runId, callId: call.callId },
|
|
136
132
|
});
|
|
137
133
|
return { accountId: row.account_id, login, password };
|
|
138
134
|
}
|
|
@@ -394,6 +394,16 @@ export declare class SettingsService {
|
|
|
394
394
|
auditDetail?: Record<string, unknown>, opts?: {
|
|
395
395
|
onlyNarrows?: boolean;
|
|
396
396
|
}): Promise<DeploymentSettingsView>;
|
|
397
|
+
/**
|
|
398
|
+
* The extra bootstrap manifest's default theme (bootstrap extra manifest spec §7), a system write
|
|
399
|
+
* with no actor: sets `uiTheme` to `themeId` only while it is still the migration seed (`{ id:
|
|
400
|
+
* null }` that nobody saved, `updated_by` null), so a restart or a second replica keeps it and a
|
|
401
|
+
* super admin's choice (an explicit built-in theme too) is never reset. The locks are taken in
|
|
402
|
+
* the order of {@link write}: the super admin lock, the theme's rows FOR SHARE, the `uiTheme` row
|
|
403
|
+
* FOR UPDATE; then the eligibility check (400 `theme.not_available`). Audited
|
|
404
|
+
* `deployment.settings.updated` with no actor account and `source: "bootstrap"`.
|
|
405
|
+
*/
|
|
406
|
+
applyBootstrapUiTheme(themeId: string): Promise<"applied" | "kept">;
|
|
397
407
|
private lockFor;
|
|
398
408
|
private write;
|
|
399
409
|
}
|
|
@@ -716,6 +716,49 @@ let SettingsService = class SettingsService {
|
|
|
716
716
|
await withOrderedLocks(() => this.lockFor(valid, actorAccountId), () => this.write(valid, actorAccountId, actorTokenId, auditDetail, opts));
|
|
717
717
|
return this.view();
|
|
718
718
|
}
|
|
719
|
+
/**
|
|
720
|
+
* The extra bootstrap manifest's default theme (bootstrap extra manifest spec §7), a system write
|
|
721
|
+
* with no actor: sets `uiTheme` to `themeId` only while it is still the migration seed (`{ id:
|
|
722
|
+
* null }` that nobody saved, `updated_by` null), so a restart or a second replica keeps it and a
|
|
723
|
+
* super admin's choice (an explicit built-in theme too) is never reset. The locks are taken in
|
|
724
|
+
* the order of {@link write}: the super admin lock, the theme's rows FOR SHARE, the `uiTheme` row
|
|
725
|
+
* FOR UPDATE; then the eligibility check (400 `theme.not_available`). Audited
|
|
726
|
+
* `deployment.settings.updated` with no actor account and `source: "bootstrap"`.
|
|
727
|
+
*/
|
|
728
|
+
async applyBootstrapUiTheme(themeId) {
|
|
729
|
+
await this.adminLock.lock();
|
|
730
|
+
await lockThemeShared(this.db.db, themeId);
|
|
731
|
+
await lockUiThemeRow(this.db.db);
|
|
732
|
+
const row = await this.db
|
|
733
|
+
.selectFrom("deployment_settings")
|
|
734
|
+
.select(["value", "updated_by"])
|
|
735
|
+
.where("key", "=", UI_THEME_SETTING)
|
|
736
|
+
.executeTakeFirstOrThrow();
|
|
737
|
+
const current = UiThemeSetting.safeParse(row.value);
|
|
738
|
+
if (row.updated_by !== null || !current.success || current.data.id !== null)
|
|
739
|
+
return "kept";
|
|
740
|
+
await assertPlatformDefaultEligible(this.db.db, themeId);
|
|
741
|
+
// eligible, so the row is a live platform theme (held FOR SHARE above)
|
|
742
|
+
const theme = await this.db
|
|
743
|
+
.selectFrom("platform_themes")
|
|
744
|
+
.select(["plugin_name", "name"])
|
|
745
|
+
.where("id", "=", themeId)
|
|
746
|
+
.executeTakeFirstOrThrow();
|
|
747
|
+
await this.db
|
|
748
|
+
.updateTable("deployment_settings")
|
|
749
|
+
.set({ value: JSON.stringify({ id: themeId }), updated_by: null, updated_at: new Date() })
|
|
750
|
+
.where("key", "=", UI_THEME_SETTING)
|
|
751
|
+
.execute();
|
|
752
|
+
await audit(this.db.db, {
|
|
753
|
+
action: "deployment.settings.updated",
|
|
754
|
+
detail: {
|
|
755
|
+
source: "bootstrap",
|
|
756
|
+
uiTheme: { id: themeId },
|
|
757
|
+
defaultTheme: { plugin: theme.plugin_name, theme: theme.name },
|
|
758
|
+
},
|
|
759
|
+
});
|
|
760
|
+
return "applied";
|
|
761
|
+
}
|
|
719
762
|
async lockFor(patch, actorAccountId) {
|
|
720
763
|
await this.adminLock.lockAndAuthorize(actorAccountId);
|
|
721
764
|
if (patch.devicesOutsideSandbox !== undefined || patch.devicesNetwork !== undefined)
|
|
@@ -903,6 +946,9 @@ let SettingsService = class SettingsService {
|
|
|
903
946
|
});
|
|
904
947
|
}
|
|
905
948
|
};
|
|
949
|
+
__decorate([
|
|
950
|
+
Transactional()
|
|
951
|
+
], SettingsService.prototype, "applyBootstrapUiTheme", null);
|
|
906
952
|
__decorate([
|
|
907
953
|
Transactional({ propagation: "mandatory" })
|
|
908
954
|
], SettingsService.prototype, "lockFor", null);
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export { ExtensionAdmin, PLUGINS_CHANGED_TOPIC } from "./extensions/admin-view.j
|
|
|
31
31
|
export { type ApprovalDecision, ExtensionApprovals, type PendingExtension, type PermissionSnapshot, planApprovals, snapshotCovers, withPreApproved, } from "./extensions/approvals.js";
|
|
32
32
|
export { blobKey, ExtensionBlobIntegrityError, type ExtensionBlobSource, ExtensionBlobs, } from "./extensions/blobs.js";
|
|
33
33
|
export { BOOTSTRAP_MANIFEST_FILE, type BootstrapEntryResult, BootstrapFailedError, type BootstrapFailure, type BootstrapResolveOptions, type BootstrapResult, BootstrapService, bootstrapManifestSha256, readBootstrapManifest, resolveBootstrapPackages, } from "./extensions/bootstrap.js";
|
|
34
|
+
export { BootstrapExtraMismatchError, type ExtraManifestTraces, hasExtraManifestTraces, loadBootstrapManifest, type MergedBootstrapManifest, mergeBootstrapManifests, missingExtraManifestMessage, readBootstrapExtraManifest, } from "./extensions/bootstrap-extra.js";
|
|
34
35
|
export { type ExtensionCli, openExtensionCli } from "./extensions/cli.js";
|
|
35
36
|
export { DEPLOYMENT_SECRETS_ORG, type DeploymentConfigField, type DeploymentConfigView, ExtensionDeploymentConfigService, mergeDeploymentConfig, PLUGIN_DEPLOYMENT_CONFIG_TOPIC, readStoredDeploymentConfig, type SecretEntry, } from "./extensions/deployment-config.js";
|
|
36
37
|
export { assertSecretsReachable, ExtensionHost, type ExtensionLoadPlan, type InspectedExtension, type InstalledExtensionLoader, type InstallFailureReason, } from "./extensions/host.js";
|
|
@@ -67,6 +68,7 @@ export { type ContextJob, type JobWrapper, type LogContext, logContext, setJobWr
|
|
|
67
68
|
export { type Org, OrgsService } from "./orgs/orgs.service.js";
|
|
68
69
|
export type { KernelOverride } from "./overrides.js";
|
|
69
70
|
export { fetchNpmPackage, IntegrityMismatchError, type NpmFetchConfig, NpmFetchError, PackageTooLargeError, } from "./packages/npm.js";
|
|
71
|
+
export { packPackageTgz } from "./packages/tgz.js";
|
|
70
72
|
export { checkInputParity, inputParity, type ParityFinding, type ParityOperation, } from "./platform/parity.js";
|
|
71
73
|
export { PLATFORM_OPERATION_PROVIDERS } from "./platform/platform-ops.module.js";
|
|
72
74
|
export { PlatformOperations } from "./platform/registry.js";
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ export { ExtensionAdmin, PLUGINS_CHANGED_TOPIC } from "./extensions/admin-view.j
|
|
|
30
30
|
export { ExtensionApprovals, planApprovals, snapshotCovers, withPreApproved, } from "./extensions/approvals.js";
|
|
31
31
|
export { blobKey, ExtensionBlobIntegrityError, ExtensionBlobs, } from "./extensions/blobs.js";
|
|
32
32
|
export { BOOTSTRAP_MANIFEST_FILE, BootstrapFailedError, BootstrapService, bootstrapManifestSha256, readBootstrapManifest, resolveBootstrapPackages, } from "./extensions/bootstrap.js";
|
|
33
|
+
export { BootstrapExtraMismatchError, hasExtraManifestTraces, loadBootstrapManifest, mergeBootstrapManifests, missingExtraManifestMessage, readBootstrapExtraManifest, } from "./extensions/bootstrap-extra.js";
|
|
33
34
|
export { openExtensionCli } from "./extensions/cli.js";
|
|
34
35
|
export { DEPLOYMENT_SECRETS_ORG, ExtensionDeploymentConfigService, mergeDeploymentConfig, PLUGIN_DEPLOYMENT_CONFIG_TOPIC, readStoredDeploymentConfig, } from "./extensions/deployment-config.js";
|
|
35
36
|
export { assertSecretsReachable, ExtensionHost, } from "./extensions/host.js";
|
|
@@ -64,6 +65,8 @@ export { createConfiguredLogger, loggerOptionsFromConfig } from "./log-config.js
|
|
|
64
65
|
export { logContext, setJobWrapper, setTraceContextSource, withJobContext, withLogContext, } from "./log-context.js";
|
|
65
66
|
export { OrgsService } from "./orgs/orgs.service.js";
|
|
66
67
|
export { fetchNpmPackage, IntegrityMismatchError, NpmFetchError, PackageTooLargeError, } from "./packages/npm.js";
|
|
68
|
+
// The canonical tgz of a package tree; `capybara-plugin bootstrap` pins git entries with it.
|
|
69
|
+
export { packPackageTgz } from "./packages/tgz.js";
|
|
67
70
|
// Test seam: the Platform input-parity test in tools/checks (no runtime caller).
|
|
68
71
|
export { checkInputParity, inputParity, } from "./platform/parity.js";
|
|
69
72
|
// Test seam (the parity test builds every operation from these without a Nest app).
|
package/dist/kernel.module.js
CHANGED
|
@@ -12,6 +12,7 @@ import { ChannelsModule } from "./channels/channels.module.js";
|
|
|
12
12
|
import { ClientModule } from "./client/client.module.js";
|
|
13
13
|
import { PromptSuggestionsModule } from "./conversations/prompt-suggestions.js";
|
|
14
14
|
import { TitlesModule } from "./conversations/titles.js";
|
|
15
|
+
import { BootstrapDefaultsService } from "./extensions/bootstrap-defaults.js";
|
|
15
16
|
import { ExtensionsModule } from "./extensions/extensions.module.js";
|
|
16
17
|
import { ApiModule } from "./http/api.module.js";
|
|
17
18
|
import { ErrorFilterModule } from "./http/error-filter.module.js";
|
|
@@ -150,6 +151,8 @@ let KernelModule = KernelModule_1 = class KernelModule {
|
|
|
150
151
|
redis: redisCheck(redis),
|
|
151
152
|
}),
|
|
152
153
|
},
|
|
154
|
+
// the extra bootstrap manifest's defaults, applied by the start (settings: IdentityModule)
|
|
155
|
+
BootstrapDefaultsService,
|
|
153
156
|
KernelLifecycle,
|
|
154
157
|
],
|
|
155
158
|
};
|
|
@@ -11,6 +11,7 @@ import { PromptSuggestionQueue } from "../conversations/prompt-suggestions.js";
|
|
|
11
11
|
import { TitleQueue } from "../conversations/titles.js";
|
|
12
12
|
import { ExtensionBlobs } from "../extensions/blobs.js";
|
|
13
13
|
import { BootstrapService } from "../extensions/bootstrap.js";
|
|
14
|
+
import { BootstrapDefaultsService } from "../extensions/bootstrap-defaults.js";
|
|
14
15
|
import { ExtensionHost } from "../extensions/host.js";
|
|
15
16
|
import { ExtensionInstalls } from "../extensions/installs.js";
|
|
16
17
|
import { ExtensionLifecycle } from "../extensions/lifecycle.js";
|
|
@@ -80,6 +81,7 @@ export declare class KernelLifecycle implements OnApplicationBootstrap, BeforeAp
|
|
|
80
81
|
private readonly extensionLifecycle;
|
|
81
82
|
private readonly replicaStatus;
|
|
82
83
|
private readonly bootstrap;
|
|
84
|
+
private readonly bootstrapDefaults;
|
|
83
85
|
private readonly marketplaces;
|
|
84
86
|
private readonly pluginImport;
|
|
85
87
|
private readonly bus;
|
|
@@ -105,7 +107,9 @@ export declare class KernelLifecycle implements OnApplicationBootstrap, BeforeAp
|
|
|
105
107
|
private bootstrapCarry;
|
|
106
108
|
/** The packages the first bootstrap pass obtained, so the second downloads nothing again. */
|
|
107
109
|
private bootstrapPackages;
|
|
108
|
-
|
|
110
|
+
/** The merged bootstrap manifest, read once per start. */
|
|
111
|
+
private mergedManifest;
|
|
112
|
+
constructor(permissionConfig: PermissionConfigPublication, accounts: AccountsService, configService: KernelConfigService, log: KernelLogger, options: KernelAppOptions, pool: Kysely<any>, redis: Redis, kdb: KernelDb, shutdown: GracefulShutdown, host: ExtensionHost, registry: ExtensionRegistry, installs: ExtensionInstalls, blobs: ExtensionBlobs, extensionLifecycle: ExtensionLifecycle, replicaStatus: ReplicaStatusStore, bootstrap: BootstrapService, bootstrapDefaults: BootstrapDefaultsService, marketplaces: MarketplacesService, pluginImport: PluginImport, bus: Pick<ExtensionContext["bus"], "publish" | "subscribe">, usageReport: UsageReporter, titles: TitleQueue, suggestions: PromptSuggestionQueue, channelJobs: ChannelJobs, channelOutbound: ChannelOutbound, presence: ReplicaPresence, worker?: WorkerRole | undefined, gateway?: GatewayRole | undefined);
|
|
109
113
|
/** The kernel HTTP application (set up by `buildKernelApp` before `init()`). */
|
|
110
114
|
get http(): KernelHttpApp;
|
|
111
115
|
attachHttp(http: KernelHttpApp): void;
|
|
@@ -122,6 +126,8 @@ export declare class KernelLifecycle implements OnApplicationBootstrap, BeforeAp
|
|
|
122
126
|
* `/readyz`) after the start sequence; returns the actual port.
|
|
123
127
|
*/
|
|
124
128
|
listen(port: number): Promise<number>;
|
|
129
|
+
/** The built-in manifest (or `options.bootstrapManifest`) merged with the extra manifest, if any. */
|
|
130
|
+
private manifest;
|
|
125
131
|
/**
|
|
126
132
|
* Runs the bootstrap step unless it is done for the manifest. A required entry that cannot be
|
|
127
133
|
* completed (or a missing / tampered package: then nothing was installed) stops the start, so the
|
|
@@ -18,7 +18,9 @@ import { PromptSuggestionQueue } from "../conversations/prompt-suggestions.js";
|
|
|
18
18
|
import { TitleQueue } from "../conversations/titles.js";
|
|
19
19
|
import { migrate } from "../db/migrator.js";
|
|
20
20
|
import { ExtensionBlobs } from "../extensions/blobs.js";
|
|
21
|
-
import { BootstrapFailedError, BootstrapService, bootstrapManifestSha256,
|
|
21
|
+
import { BootstrapFailedError, BootstrapService, bootstrapManifestSha256, } from "../extensions/bootstrap.js";
|
|
22
|
+
import { BootstrapDefaultsService } from "../extensions/bootstrap-defaults.js";
|
|
23
|
+
import { BootstrapExtraMismatchError, hasExtraManifestTraces, loadBootstrapManifest, missingExtraManifestMessage, syncExtraMarketplaces, } from "../extensions/bootstrap-extra.js";
|
|
22
24
|
import { ExtensionHost } from "../extensions/host.js";
|
|
23
25
|
import { ExtensionInstalls } from "../extensions/installs.js";
|
|
24
26
|
import { ExtensionLifecycle } from "../extensions/lifecycle.js";
|
|
@@ -100,6 +102,7 @@ let KernelLifecycle = class KernelLifecycle {
|
|
|
100
102
|
extensionLifecycle;
|
|
101
103
|
replicaStatus;
|
|
102
104
|
bootstrap;
|
|
105
|
+
bootstrapDefaults;
|
|
103
106
|
marketplaces;
|
|
104
107
|
pluginImport;
|
|
105
108
|
bus;
|
|
@@ -125,9 +128,11 @@ let KernelLifecycle = class KernelLifecycle {
|
|
|
125
128
|
bootstrapCarry;
|
|
126
129
|
/** The packages the first bootstrap pass obtained, so the second downloads nothing again. */
|
|
127
130
|
bootstrapPackages;
|
|
131
|
+
/** The merged bootstrap manifest, read once per start. */
|
|
132
|
+
mergedManifest;
|
|
128
133
|
constructor(permissionConfig, accounts, configService, log, options,
|
|
129
134
|
// biome-ignore lint/suspicious/noExplicitAny: the pool carries no schema types
|
|
130
|
-
pool, redis, kdb, shutdown, host, registry, installs, blobs, extensionLifecycle, replicaStatus, bootstrap, marketplaces, pluginImport, bus,
|
|
135
|
+
pool, redis, kdb, shutdown, host, registry, installs, blobs, extensionLifecycle, replicaStatus, bootstrap, bootstrapDefaults, marketplaces, pluginImport, bus,
|
|
131
136
|
// the producers closed on every role (their consumers are the worker role's)
|
|
132
137
|
usageReport, titles, suggestions, channelJobs, channelOutbound,
|
|
133
138
|
// this process's presence beat, on every role (admin overview spec §5.1)
|
|
@@ -151,6 +156,7 @@ let KernelLifecycle = class KernelLifecycle {
|
|
|
151
156
|
this.extensionLifecycle = extensionLifecycle;
|
|
152
157
|
this.replicaStatus = replicaStatus;
|
|
153
158
|
this.bootstrap = bootstrap;
|
|
159
|
+
this.bootstrapDefaults = bootstrapDefaults;
|
|
154
160
|
this.marketplaces = marketplaces;
|
|
155
161
|
this.pluginImport = pluginImport;
|
|
156
162
|
this.bus = bus;
|
|
@@ -229,6 +235,25 @@ let KernelLifecycle = class KernelLifecycle {
|
|
|
229
235
|
this.checkpoint();
|
|
230
236
|
// official 清单来源按配置同步(幂等;每个副本启动时都做)
|
|
231
237
|
await this.marketplaces.syncOfficialFromConfig();
|
|
238
|
+
// No extra manifest here while one left traces (config-managed marketplaces, or entries the
|
|
239
|
+
// last bootstrap run took from one): this service is configured differently from the one
|
|
240
|
+
// that wrote them. Syncing would demote them, and the bootstrap step
|
|
241
|
+
// would clear the extra entries' required / builtin under the built-in manifest's sha, which
|
|
242
|
+
// the correctly configured services then find done and never repair. So both are skipped
|
|
243
|
+
// (decided from the database before either runs); the start goes on with the state as it is
|
|
244
|
+
const traces = opts.bootstrap?.extraManifest === undefined
|
|
245
|
+
? await this.bootstrap.extraManifestTraces()
|
|
246
|
+
: { marketplaces: [], plugins: [] };
|
|
247
|
+
const mismatch = hasExtraManifestTraces(traces);
|
|
248
|
+
if (mismatch) {
|
|
249
|
+
this.log.error(`${missingExtraManifestMessage(traces)}. The bootstrap step and the marketplace sync are skipped in this start`, { ...traces });
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
// The extra manifest's marketplaces (an empty list demotes the config-managed rows). Without
|
|
253
|
+
// an extra manifest nothing is synced or demoted: the check above may have run before
|
|
254
|
+
// another replica's sync committed (ruling R16)
|
|
255
|
+
await syncExtraMarketplaces((m) => this.marketplaces.syncExtraFromConfig(m), opts.bootstrap !== undefined ? (await this.manifest()).extra?.marketplaces : undefined, this.log);
|
|
256
|
+
}
|
|
232
257
|
// The bootstrap plugins (spec §7), once per manifest across replicas (the Redis lock
|
|
233
258
|
// `lock:bootstrap`); a bootstrap entry named like a config-declared extension is kept
|
|
234
259
|
if (opts.bootstrap !== undefined) {
|
|
@@ -236,7 +261,7 @@ let KernelLifecycle = class KernelLifecycle {
|
|
|
236
261
|
...(opts.resolveFrom !== undefined && { resolveFrom: opts.resolveFrom }),
|
|
237
262
|
}));
|
|
238
263
|
}
|
|
239
|
-
const bootstrapAgain = opts.bootstrap !== undefined && (await this.runBootstrap(opts.bootstrap.dir));
|
|
264
|
+
const bootstrapAgain = opts.bootstrap !== undefined && !mismatch && (await this.runBootstrap(opts.bootstrap.dir));
|
|
240
265
|
this.checkpoint();
|
|
241
266
|
// 配置声明 → 安装记录(C15 / C13)。安装记录的包在本副本同步到 extensionHost.dir 后导入,
|
|
242
267
|
// 与运行中的 reconcile 走同一条路径;迁移由一个副本持锁执行(ensureMigrated,C16)
|
|
@@ -288,6 +313,13 @@ let KernelLifecycle = class KernelLifecycle {
|
|
|
288
313
|
await this.runBootstrap(opts.bootstrap.dir, true);
|
|
289
314
|
this.checkpoint();
|
|
290
315
|
}
|
|
316
|
+
// The extra manifest's defaults (the platform default theme), at every start whether or not
|
|
317
|
+
// the step ran in it (compose's `init` usually ran it): its themes exist only once the second
|
|
318
|
+
// pass imported them. A no-op once applied or once a super admin chose; never fails the start
|
|
319
|
+
if (opts.bootstrap !== undefined) {
|
|
320
|
+
await this.bootstrapDefaults.apply((await this.manifest()).extra?.defaultTheme);
|
|
321
|
+
this.checkpoint();
|
|
322
|
+
}
|
|
291
323
|
if (opts.source?.watch) {
|
|
292
324
|
// 热更新:重新校验;只应用 hot 字段,其余变化 warn 并列出需重启的键;校验失败保持原配置
|
|
293
325
|
let reload = Promise.resolve();
|
|
@@ -322,6 +354,18 @@ let KernelLifecycle = class KernelLifecycle {
|
|
|
322
354
|
await this.warnIfSetupPending();
|
|
323
355
|
return this.listening;
|
|
324
356
|
}
|
|
357
|
+
/** The built-in manifest (or `options.bootstrapManifest`) merged with the extra manifest, if any. */
|
|
358
|
+
manifest() {
|
|
359
|
+
this.mergedManifest ??= loadBootstrapManifest({
|
|
360
|
+
...(this.options.bootstrapManifest !== undefined && {
|
|
361
|
+
builtin: this.options.bootstrapManifest,
|
|
362
|
+
}),
|
|
363
|
+
...(this.options.bootstrap?.extraManifest !== undefined && {
|
|
364
|
+
extraManifest: this.options.bootstrap.extraManifest,
|
|
365
|
+
}),
|
|
366
|
+
});
|
|
367
|
+
return this.mergedManifest;
|
|
368
|
+
}
|
|
325
369
|
/**
|
|
326
370
|
* Runs the bootstrap step unless it is done for the manifest. A required entry that cannot be
|
|
327
371
|
* completed (or a missing / tampered package: then nothing was installed) stops the start, so the
|
|
@@ -333,7 +377,7 @@ let KernelLifecycle = class KernelLifecycle {
|
|
|
333
377
|
* them too; the final pass imports them, and one that fails is logged like an optional entry.
|
|
334
378
|
*/
|
|
335
379
|
async runBootstrap(dir, final = false) {
|
|
336
|
-
const manifest = this.
|
|
380
|
+
const manifest = await this.manifest();
|
|
337
381
|
const bootstrap = this.bootstrap;
|
|
338
382
|
if (await bootstrap.isDone(bootstrapManifestSha256(manifest)))
|
|
339
383
|
return false;
|
|
@@ -351,6 +395,14 @@ let KernelLifecycle = class KernelLifecycle {
|
|
|
351
395
|
return false;
|
|
352
396
|
}
|
|
353
397
|
catch (e) {
|
|
398
|
+
// The step's own check under the lock (ruling R16): another replica's sync committed after
|
|
399
|
+
// this start's check. Nothing was written; the start goes on like an R14 mismatch
|
|
400
|
+
if (e instanceof BootstrapExtraMismatchError) {
|
|
401
|
+
this.log.error(`${e.message}. The bootstrap step is skipped in this start`, {
|
|
402
|
+
...e.traces,
|
|
403
|
+
});
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
354
406
|
if (e instanceof BootstrapFailedError && !e.requiredFailed) {
|
|
355
407
|
this.bootstrapCarry = e.results;
|
|
356
408
|
this.bootstrapPackages = e.packages;
|
|
@@ -501,18 +553,19 @@ KernelLifecycle = __decorate([
|
|
|
501
553
|
__param(13, Inject(ExtensionLifecycle)),
|
|
502
554
|
__param(14, Inject(ReplicaStatusStore)),
|
|
503
555
|
__param(15, Inject(BootstrapService)),
|
|
504
|
-
__param(16, Inject(
|
|
505
|
-
__param(17, Inject(
|
|
506
|
-
__param(18, Inject(
|
|
507
|
-
__param(19, Inject(
|
|
508
|
-
__param(20, Inject(
|
|
509
|
-
__param(21, Inject(
|
|
510
|
-
__param(22, Inject(
|
|
511
|
-
__param(23, Inject(
|
|
512
|
-
__param(24, Inject(
|
|
513
|
-
__param(25,
|
|
514
|
-
__param(25, Inject(WorkerRole)),
|
|
556
|
+
__param(16, Inject(BootstrapDefaultsService)),
|
|
557
|
+
__param(17, Inject(MarketplacesService)),
|
|
558
|
+
__param(18, Inject(PluginImport)),
|
|
559
|
+
__param(19, Inject(KERNEL_BUS)),
|
|
560
|
+
__param(20, Inject(UsageReporter)),
|
|
561
|
+
__param(21, Inject(TitleQueue)),
|
|
562
|
+
__param(22, Inject(PromptSuggestionQueue)),
|
|
563
|
+
__param(23, Inject(ChannelJobs)),
|
|
564
|
+
__param(24, Inject(ChannelOutbound)),
|
|
565
|
+
__param(25, Inject(ReplicaPresence)),
|
|
515
566
|
__param(26, Optional()),
|
|
516
|
-
__param(26, Inject(
|
|
567
|
+
__param(26, Inject(WorkerRole)),
|
|
568
|
+
__param(27, Optional()),
|
|
569
|
+
__param(27, Inject(GatewayRole))
|
|
517
570
|
], KernelLifecycle);
|
|
518
571
|
export { KernelLifecycle };
|
|
@@ -8,7 +8,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
10
|
import { randomUUID } from "node:crypto";
|
|
11
|
-
import { DeviceProtocolError, FileSystemGoneError, parseDeviceFrame, parseLegacyDeviceFrame, parseOperationResult, parseOpResult, SandboxGoneError, SandboxOperationOutcomeUnknownError, SandboxPermissionUnsupportedError, SandboxScopeDeniedError, SandboxScopeValidationError, ToolError, } from "@capybara-hq/plugin-sdk";
|
|
11
|
+
import { DeviceProtocolError, FileSystemGoneError, parseDeviceFrame, parseLegacyDeviceFrame, parseOperationResult, parseOpResult, SandboxGoneError, SandboxOperationOutcomeUnknownError, SandboxPermissionUnsupportedError, SandboxScopeDeniedError, SandboxScopeValidationError, SandboxWorkUnsettledError, ToolError, } from "@capybara-hq/plugin-sdk";
|
|
12
12
|
import { Inject, Injectable } from "@nestjs/common";
|
|
13
13
|
import { machineRevoked } from "../devices/errors.js";
|
|
14
14
|
import { ApiError } from "../errors.js";
|
|
@@ -530,6 +530,8 @@ let LocalDeviceRelay = class LocalDeviceRelay {
|
|
|
530
530
|
throw new SandboxScopeDeniedError(message);
|
|
531
531
|
case "unsupported":
|
|
532
532
|
throw new SandboxPermissionUnsupportedError(message);
|
|
533
|
+
case "unsettled":
|
|
534
|
+
throw new SandboxWorkUnsettledError(message);
|
|
533
535
|
case "unknown":
|
|
534
536
|
throw new SandboxOperationOutcomeUnknownError(message);
|
|
535
537
|
case "invalid":
|
package/dist/models/images.js
CHANGED
|
@@ -298,10 +298,11 @@ let ModelImages = class ModelImages {
|
|
|
298
298
|
}
|
|
299
299
|
signal.throwIfAborted();
|
|
300
300
|
const sentAt = Date.now();
|
|
301
|
-
|
|
301
|
+
// the caller measures the latency once, so the hook payload and the result report the same value
|
|
302
|
+
const respond = (r, latencyMs) => {
|
|
302
303
|
if (!hooks)
|
|
303
304
|
return;
|
|
304
|
-
fireObserve(hooks, "model.response", { ...base, ...identity, ...r, latencyMs
|
|
305
|
+
fireObserve(hooks, "model.response", { ...base, ...identity, ...r, latencyMs }, signal, this.log);
|
|
305
306
|
};
|
|
306
307
|
let res;
|
|
307
308
|
try {
|
|
@@ -319,7 +320,7 @@ let ModelImages = class ModelImages {
|
|
|
319
320
|
images: [],
|
|
320
321
|
usage: null,
|
|
321
322
|
errorCode: isModelError(err) ? `model.${err.kind}` : "model.unknown",
|
|
322
|
-
});
|
|
323
|
+
}, Date.now() - sentAt);
|
|
323
324
|
}
|
|
324
325
|
throw err;
|
|
325
326
|
}
|
|
@@ -329,7 +330,7 @@ let ModelImages = class ModelImages {
|
|
|
329
330
|
images: res.images.map((i) => ({ mediaType: i.mediaType, size: base64Bytes(i.data) })),
|
|
330
331
|
...(typeof res.revisedPrompt === "string" && { revisedPrompt: res.revisedPrompt }),
|
|
331
332
|
usage: res.usage ?? null,
|
|
332
|
-
});
|
|
333
|
+
}, latencyMs);
|
|
333
334
|
return { ...res, latencyMs };
|
|
334
335
|
}
|
|
335
336
|
/**
|
|
@@ -109,7 +109,7 @@ export function templateConnectorInput(t, params, entered) {
|
|
|
109
109
|
*/
|
|
110
110
|
export function headersWebOnly(auth, where) {
|
|
111
111
|
return auth.type === "headers"
|
|
112
|
-
? `${where} authenticates with custom headers, whose values
|
|
112
|
+
? `${where} authenticates with custom headers, whose values a secure input request cannot ask for; the person enters them on the web.`
|
|
113
113
|
: null;
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
@@ -120,7 +120,7 @@ export function headersWebOnly(auth, where) {
|
|
|
120
120
|
export function clientProblem(auth, client, where) {
|
|
121
121
|
const needs = auth.type === "oauth_client" || (auth.type === "oauth_code" && auth.client === "manual");
|
|
122
122
|
if (needs && client === undefined) {
|
|
123
|
-
return `${where} uses an OAuth client: pass its id in client (the person enters the client secret
|
|
123
|
+
return `${where} uses an OAuth client: pass its id in client (the person enters the client secret in a secure input request)`;
|
|
124
124
|
}
|
|
125
125
|
if (!needs && client !== undefined) {
|
|
126
126
|
return `${where} takes no OAuth client (auth ${auth.type}${auth.type === "oauth_code" ? " with a registered client" : ""}); leave client out`;
|
|
@@ -395,14 +395,14 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
395
395
|
},
|
|
396
396
|
// identity
|
|
397
397
|
{
|
|
398
|
-
route: "POST /api/v1/orgs/:orgId/
|
|
398
|
+
route: "POST /api/v1/orgs/:orgId/conversations/:conversationId/runs/:runId/calls/:callId/initial-password",
|
|
399
399
|
category: "secret",
|
|
400
|
-
reason: "Returns a generated initial password once, on the web, to the person
|
|
400
|
+
reason: "Returns a generated initial password once, on the web, to the person the account creation call was made for",
|
|
401
401
|
},
|
|
402
402
|
{
|
|
403
|
-
route: "POST /api/v1/orgs/:orgId/
|
|
403
|
+
route: "POST /api/v1/orgs/:orgId/conversations/:conversationId/runs/:runId/calls/:callId/invitation-link",
|
|
404
404
|
category: "secret",
|
|
405
|
-
reason: "Returns an invitation link once, on the web, to the person
|
|
405
|
+
reason: "Returns an invitation link once, on the web, to the person the orgs.invite call was made for",
|
|
406
406
|
},
|
|
407
407
|
{ route: "POST /api/v1/auth/login", category: "human-only", reason: "Password login" },
|
|
408
408
|
{ route: "POST /api/v1/auth/refresh", category: "human-only", reason: "Rotates a refresh token" },
|
package/dist/platform/method.js
CHANGED
|
@@ -11,6 +11,6 @@ export const PLATFORM_METHOD = [
|
|
|
11
11
|
"4. An operation you may not call is not a dead end: its reason says who can (an org admin, the super admin) and whether a request operation exists; offer that.",
|
|
12
12
|
"5. Errors say what to do next; follow them.",
|
|
13
13
|
'6. When unsure how the platform works, use action "read" for the docs before acting.',
|
|
14
|
-
"Secret fields (API keys, tokens, passwords, credentials) never go in params: list their dot paths in askPerson and the person types them
|
|
14
|
+
"Secret fields (API keys, tokens, passwords, credentials) never go in params: list their dot paths in askPerson and the person types them in a secure input request, which you never see; list the stored secrets to remove in clearSecrets. Required secrets without a stored value are asked even when not listed. The result names each field the person entered, never its value. A secret that appeared in the conversation counts as leaked: tell the person to rotate it.",
|
|
15
15
|
'Find an operation with "browse" (a domain) or "search": each lists its input keys in "params" ("?" marks an optional key, an id key takes the id field of the matching list or get result). "describe" gives the types, bounds and an example; describe before a call whose params you are unsure of, and never guess a key that params does not list.',
|
|
16
16
|
].join("\n");
|
|
@@ -37,8 +37,8 @@ export interface OperationContext {
|
|
|
37
37
|
*/
|
|
38
38
|
errorRole?: ErrorRole;
|
|
39
39
|
/**
|
|
40
|
-
* The values the person typed
|
|
41
|
-
* parity spec §4.3): present only when the
|
|
40
|
+
* The values the person typed in the secure input request for this call's secret fields
|
|
41
|
+
* (platform web parity spec §4.3): present only when the call asked for person fields. `paths` are the
|
|
42
42
|
* asked fields; `apply` consumes the sealed values once and runs `fn` with them in the same
|
|
43
43
|
* transaction (a throw puts them back), so the handler passes them to the route's service method
|
|
44
44
|
* inside `fn`. The values never go into the result: the tool appends a line per entered path.
|
|
@@ -152,12 +152,14 @@ export interface PlatformOperation<I = unknown> {
|
|
|
152
152
|
*/
|
|
153
153
|
rememberable?: false;
|
|
154
154
|
/**
|
|
155
|
-
*
|
|
156
|
-
* invitation link, a generated initial password),
|
|
157
|
-
*
|
|
158
|
-
*
|
|
155
|
+
* The write's result is shown once, on the web, to the person the call is made for (an
|
|
156
|
+
* invitation link, a generated initial password), read by the call (profiles govern every
|
|
157
|
+
* approval, R6); the value names which, and the tool result carries the reveal view. Only the
|
|
158
|
+
* person the run works for may consent to it: the call always asks them (never a grant, an
|
|
159
|
+
* `allow`, a role escalation; the conversation's profile decides the ask) and is refused in an
|
|
160
|
+
* unattended run (`CallPolicy.personOnly`).
|
|
159
161
|
*/
|
|
160
|
-
|
|
162
|
+
revealsOnce?: "initial_password" | "invitation_link";
|
|
161
163
|
/**
|
|
162
164
|
* The class of one call when it depends on the target (read at confirmation time): e.g.
|
|
163
165
|
* `agents.update` is `personal` only on a private agent the actor owns and `org` otherwise, so a
|
|
@@ -41,7 +41,7 @@ export const PLATFORM_DOMAINS = [
|
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
id: "extensions",
|
|
44
|
-
description: "Extensions in the org (state, tool switches, extension point defaults, file previewers, the org config and the org's copy of platform config) and, for the super admin, on the platform (state, deployment config, pending permission confirmations, enable, disable, uninstall). Secrets are entered by the person
|
|
44
|
+
description: "Extensions in the org (state, tool switches, extension point defaults, file previewers, the org config and the org's copy of platform config) and, for the super admin, on the platform (state, deployment config, pending permission confirmations, enable, disable, uninstall). Secrets are entered by the person in a secure input request.",
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
id: "conversations",
|
|
@@ -6,7 +6,7 @@ import { SessionService } from "../../identity/sessions.js";
|
|
|
6
6
|
import { OrgsService } from "../../orgs/orgs.service.js";
|
|
7
7
|
import { PlatformOperations } from "../registry.js";
|
|
8
8
|
/** What the tool result says instead of the password (model-visible English). */
|
|
9
|
-
export declare const INITIAL_PASSWORD_NOTE = "The kernel generated a one-time initial password. It is shown once, on the web, to the person
|
|
9
|
+
export declare const INITIAL_PASSWORD_NOTE = "The kernel generated a one-time initial password. It is shown once, on the web, to the person this call was made for, under the tool call in this conversation, and never to you. The account must change it at first sign-in.";
|
|
10
10
|
/**
|
|
11
11
|
* Account operations of the `Platform` tool (spec §14.2, admin console): the super admin lists,
|
|
12
12
|
* reads, creates, disables and enables accounts, only through their own private agent
|
|
@@ -23,7 +23,7 @@ import { named } from "./summary.js";
|
|
|
23
23
|
const PAGE = 50;
|
|
24
24
|
const AccountId = AccountParams.shape.accountId.describe("The account id (accounts.list).");
|
|
25
25
|
/** What the tool result says instead of the password (model-visible English). */
|
|
26
|
-
export const INITIAL_PASSWORD_NOTE = "The kernel generated a one-time initial password. It is shown once, on the web, to the person
|
|
26
|
+
export const INITIAL_PASSWORD_NOTE = "The kernel generated a one-time initial password. It is shown once, on the web, to the person this call was made for, under the tool call in this conversation, and never to you. The account must change it at first sign-in.";
|
|
27
27
|
/** An account as a detail returns it (the admin console's account fields). */
|
|
28
28
|
const accountView = (a, login) => ({
|
|
29
29
|
id: a.id,
|
|
@@ -182,7 +182,7 @@ let AccountsOperations = class AccountsOperations {
|
|
|
182
182
|
}),
|
|
183
183
|
defineOperation({
|
|
184
184
|
id: "accounts.create",
|
|
185
|
-
description: "Create a local sign-in account (super admin): a login (3-64 characters: letters, digits, . _ @ + -), a display name and an optional email. You pass no password: the kernel generates a one-time initial password, shows it once to the person
|
|
185
|
+
description: "Create a local sign-in account (super admin): a login (3-64 characters: letters, digits, . _ @ + -), a display name and an optional email. You pass no password: the kernel generates a one-time initial password, shows it once, on the web, to the person the call is made for (under the tool call in the conversation), never to you; it is lost if not read within 24 hours (then disable the account and create it again). The account must change it at first sign-in. The account is never a super admin; that and org memberships are set by a person on the web (add it to an org with an invitation).",
|
|
186
186
|
input: CreateAccountBody.pick({ login: true, displayName: true, email: true }).strict(),
|
|
187
187
|
example: { login: "alice", displayName: "Alice Chen", email: "alice@example.com" },
|
|
188
188
|
authz: { superAdmin: true },
|
|
@@ -190,7 +190,7 @@ let AccountsOperations = class AccountsOperations {
|
|
|
190
190
|
// the password is generated by the kernel; the super-admin flag is a role change (human-only)
|
|
191
191
|
omits: ["password", "superAdmin"],
|
|
192
192
|
confirm: "platform",
|
|
193
|
-
|
|
193
|
+
revealsOnce: "initial_password",
|
|
194
194
|
errors: [
|
|
195
195
|
{
|
|
196
196
|
code: "account.login_taken",
|
|
@@ -7,7 +7,7 @@ import { PlatformOperations } from "../registry.js";
|
|
|
7
7
|
* Channel connection operations of the `Platform` tool (spec §14): read a connection and change
|
|
8
8
|
* its binding (which agent answers, what happens to unbound people, on / off, inbound mode),
|
|
9
9
|
* or remove it. Creating a connection takes the channel's secrets as person fields (the person types
|
|
10
|
-
* them
|
|
10
|
+
* them in a secure input request; platform web parity spec §4, §7.2); changing the credentials or
|
|
11
11
|
* the config of a connection stays on the web.
|
|
12
12
|
*/
|
|
13
13
|
export declare class ChannelsOperations implements OnModuleInit {
|