@jskit-ai/agent-docs 0.1.257 → 0.1.259
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/guide/agent/app-extras/assistant-conversation.md +88 -35
- package/guide/agent/app-extras/assistant.md +28 -28
- package/guide/agent/app-setup/authentication.md +36 -17
- package/guide/agent/app-setup/database-layer.md +116 -17
- package/guide/agent/app-setup/existing-application-migration.md +29 -25
- package/guide/agent/app-setup/multi-homing.md +94 -48
- package/guide/agent/app-setup/run-an-accounts-hub.md +6 -4
- package/guide/agent/framework/client-features.md +496 -0
- package/guide/agent/framework/crud-operations.md +5 -5
- package/guide/agent/framework/translation.md +4 -3
- package/guide/agent/framework/typed-features.md +1104 -0
- package/guide/agent/framework/ui-operations.md +2 -2
- package/guide/agent/index.md +6 -1
- package/package.json +1 -1
- package/patterns/feature-package/PATTERN.md +104 -10
- package/patterns/feature-package/example/booking-engine/package.json +9 -4
- package/patterns/feature-package/example/booking-engine/src/server/BookingEngineFeature.js +24 -0
- package/patterns/feature-package/example/booking-engine/src/server/bookingAvailability.js +10 -0
- package/patterns/feature-package/example/booking-engine/src/server/bookingEngine.js +29 -0
- package/patterns/feature-package/example/booking-engine/src/server/bookingEngineActions.js +26 -0
- package/patterns/feature-package/example/booking-engine/src/server/inputSchemas.js +1 -2
- package/patterns/feature-package/example/booking-engine/src/server/types.js +12 -0
- package/patterns/feature-package/example/variations/AvailabilityEngineFeature.js +19 -0
- package/patterns/feature-package/example/variations/InvoiceRollupFeature.js +23 -0
- package/patterns/feature-package/example/variations/availabilityEngineActions.js +26 -0
- package/patterns/feature-package/example/variations/customKnexRepository.js +32 -26
- package/patterns/feature-package/example/variations/invoiceRollupActions.js +26 -0
- package/patterns/feature-package/example/variations/orchestratorService.js +24 -19
- package/patterns/feature-package/example/variations/types.js +7 -0
- package/patterns/minimal-foundation/PATTERN.md +30 -1
- package/patterns/minimal-foundation/example/AGENTS.md +14 -0
- package/patterns/minimal-foundation/example/bin/develop.js +10 -5
- package/patterns/minimal-foundation/example/eslint.config.mjs +21 -2
- package/patterns/minimal-foundation/example/package.json +5 -4
- package/patterns/minimal-foundation/example/playwright.config.mjs +1 -1
- package/patterns/minimal-foundation/example/server/lib/envFile.js +19 -0
- package/patterns/minimal-foundation/example/server/lib/loggerOptions.js +15 -0
- package/patterns/minimal-foundation/example/server/lib/runtimeEnv.js +17 -17
- package/patterns/minimal-foundation/example/server.js +32 -29
- package/patterns/minimal-foundation/example/tests/server/smoke.test.js +2 -1
- package/patterns/shell-foundation/PATTERN.md +29 -0
- package/patterns/shell-foundation/example/AGENTS.md +14 -0
- package/patterns/shell-foundation/example/bin/develop.js +10 -5
- package/patterns/shell-foundation/example/eslint.config.mjs +21 -2
- package/patterns/shell-foundation/example/package.json +6 -5
- package/patterns/shell-foundation/example/packages/main/package.json +1 -1
- package/patterns/shell-foundation/example/packages/main/src/client/providers/MainClientProvider.js +1 -0
- package/patterns/shell-foundation/example/playwright.config.mjs +1 -1
- package/patterns/shell-foundation/example/server/lib/envFile.js +19 -0
- package/patterns/shell-foundation/example/server/lib/loggerOptions.js +15 -0
- package/patterns/shell-foundation/example/server/lib/runtimeEnv.js +17 -17
- package/patterns/shell-foundation/example/server.js +32 -29
- package/patterns/shell-foundation/example/tests/server/smoke.test.js +2 -1
- package/reference/autogen/KERNEL_MAP.md +14 -8
- package/reference/autogen/PATTERN_INDEX.md +37 -37
- package/reference/autogen/README.md +2 -0
- package/reference/autogen/packages/agent-docs.md +70 -26
- package/reference/autogen/packages/agent-runtime.md +129 -0
- package/reference/autogen/packages/agent.md +149 -0
- package/reference/autogen/packages/architecture-inspector.md +97 -44
- package/reference/autogen/packages/assistant-core.md +786 -292
- package/reference/autogen/packages/assistant-runtime.md +182 -57
- package/reference/autogen/packages/assistant-voice-sherpa.md +4 -0
- package/reference/autogen/packages/assistant-voice.md +54 -8
- package/reference/autogen/packages/auth-core.md +44 -13
- package/reference/autogen/packages/auth-provider-local-core.md +86 -34
- package/reference/autogen/packages/auth-provider-local-db-core.md +1 -2
- package/reference/autogen/packages/auth-provider-oidc-core.md +10 -4
- package/reference/autogen/packages/auth-provider-supabase-core.md +52 -66
- package/reference/autogen/packages/auth-web.md +19 -11
- package/reference/autogen/packages/connectors-catalog.md +71 -43
- package/reference/autogen/packages/connectors-core.md +42 -4
- package/reference/autogen/packages/console-core.md +27 -14
- package/reference/autogen/packages/crud-core.md +178 -170
- package/reference/autogen/packages/database-runtime-mysql.md +0 -2
- package/reference/autogen/packages/database-runtime-postgres.md +0 -2
- package/reference/autogen/packages/database-runtime.md +39 -10
- package/reference/autogen/packages/http-runtime.md +79 -57
- package/reference/autogen/packages/json-rest-api-core.md +11 -8
- package/reference/autogen/packages/kernel.md +144 -83
- package/reference/autogen/packages/oidc-issuer-core.md +49 -20
- package/reference/autogen/packages/payments-core.md +20 -3
- package/reference/autogen/packages/realtime.md +47 -22
- package/reference/autogen/packages/resource-core.md +1 -1
- package/reference/autogen/packages/resource-crud-core.md +64 -26
- package/reference/autogen/packages/rewarded-core.md +47 -36
- package/reference/autogen/packages/shell-web.md +7 -10
- package/reference/autogen/packages/storage-runtime.md +6 -2
- package/reference/autogen/packages/uploads-runtime.md +10 -2
- package/reference/autogen/packages/users-core.md +73 -71
- package/reference/autogen/packages/workspaces-core.md +121 -106
- package/reference/autogen/packages/workspaces-web.md +1 -2
- package/reference/autogen/tooling/config-eslint.md +302 -0
- package/reference/autogen/tooling/jskit-catalog.md +28 -18
- package/reference/autogen/tooling/jskit-release.md +35 -20
- package/reference/autogen/tooling/testUtils.md +3 -1
- package/skills/jskit/SKILL.md +9 -8
- package/skills/jskit/references/app-operations.md +1 -1
- package/skills/jskit/references/client-features.md +491 -0
- package/skills/jskit/references/crud-form-actions.md +1 -1
- package/skills/jskit/references/crud-operations.md +7 -7
- package/skills/jskit/references/existing-application-migration.md +31 -27
- package/skills/jskit/references/heuristics/INDEX.md +5 -1
- package/skills/jskit/references/heuristics/child-cruds.md +1 -1
- package/skills/jskit/references/heuristics/client-features.md +66 -0
- package/skills/jskit/references/heuristics/client-requests.md +1 -1
- package/skills/jskit/references/heuristics/crud-authoring.md +12 -2
- package/skills/jskit/references/heuristics/crud-links.md +1 -1
- package/skills/jskit/references/heuristics/crud-repository-mapping.md +3 -3
- package/skills/jskit/references/heuristics/filters.md +1 -1
- package/skills/jskit/references/heuristics/live-actions.md +1 -1
- package/skills/jskit/references/heuristics/page-redirects.md +1 -1
- package/skills/jskit/references/heuristics/page-scaffolding.md +1 -1
- package/skills/jskit/references/heuristics/placements.md +1 -1
- package/skills/jskit/references/heuristics/row-policies.md +1 -1
- package/skills/jskit/references/heuristics/server-search.md +1 -1
- package/skills/jskit/references/heuristics/surfaces.md +1 -1
- package/skills/jskit/references/heuristics/typed-features.md +100 -0
- package/skills/jskit/references/heuristics/ui-contract.md +1 -1
- package/skills/jskit/references/heuristics/ui-testing.md +4 -4
- package/skills/jskit/references/material-3.md +2 -2
- package/skills/jskit/references/multi-homing.md +96 -50
- package/skills/jskit/references/pattern-index.md +37 -37
- package/skills/jskit/references/patterns/app/minimal-foundation/PATTERN.md +30 -1
- package/skills/jskit/references/patterns/app/minimal-foundation/example/AGENTS.md +14 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/bin/develop.js +10 -5
- package/skills/jskit/references/patterns/app/minimal-foundation/example/eslint.config.mjs +21 -2
- package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +5 -4
- package/skills/jskit/references/patterns/app/minimal-foundation/example/playwright.config.mjs +1 -1
- package/skills/jskit/references/patterns/app/minimal-foundation/example/server/lib/envFile.js +19 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/server/lib/loggerOptions.js +15 -0
- package/skills/jskit/references/patterns/app/minimal-foundation/example/server/lib/runtimeEnv.js +17 -17
- package/skills/jskit/references/patterns/app/minimal-foundation/example/server.js +32 -29
- package/skills/jskit/references/patterns/app/minimal-foundation/example/tests/server/smoke.test.js +2 -1
- package/skills/jskit/references/patterns/app/shell-foundation/PATTERN.md +29 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/AGENTS.md +14 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/bin/develop.js +10 -5
- package/skills/jskit/references/patterns/app/shell-foundation/example/eslint.config.mjs +21 -2
- package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +6 -5
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
- package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/src/client/providers/MainClientProvider.js +1 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/playwright.config.mjs +1 -1
- package/skills/jskit/references/patterns/app/shell-foundation/example/server/lib/envFile.js +19 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/server/lib/loggerOptions.js +15 -0
- package/skills/jskit/references/patterns/app/shell-foundation/example/server/lib/runtimeEnv.js +17 -17
- package/skills/jskit/references/patterns/app/shell-foundation/example/server.js +32 -29
- package/skills/jskit/references/patterns/app/shell-foundation/example/tests/server/smoke.test.js +2 -1
- package/skills/jskit/references/patterns/assistant/assistant-surface/example/src/ApplicationAiFeature.js +4 -2
- package/skills/jskit/references/patterns/auth/accounts-hub/PATTERN.md +2 -1
- package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +2 -2
- package/skills/jskit/references/patterns/auth/accounts-hub/example/server/hubPaths.js +9 -3
- package/skills/jskit/references/patterns/auth/auth-surface/PATTERN.md +25 -12
- package/skills/jskit/references/patterns/auth/auth-surface/example/tools/preview-identity +7 -1
- package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
- package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
- package/skills/jskit/references/patterns/connectors/ai-connections/PATTERN.md +16 -1
- package/skills/jskit/references/patterns/connectors/ai-connections/example/ai-model.js +12 -3
- package/skills/jskit/references/patterns/connectors/ai-connections/example/perplexity-answer.js +15 -4
- package/skills/jskit/references/patterns/connectors/api-key-connection/PATTERN.md +9 -1
- package/skills/jskit/references/patterns/connectors/api-key-connection/example/connections.js +5 -2
- package/skills/jskit/references/patterns/connectors/aws-storage-queries/PATTERN.md +13 -3
- package/skills/jskit/references/patterns/connectors/aws-storage-queries/example/s3-transfer.js +14 -3
- package/skills/jskit/references/patterns/connectors/calendar-cli/PATTERN.md +8 -0
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/knexfile.js +1 -1
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +4 -4
- package/skills/jskit/references/patterns/connectors/calendar-cli/example/scripts/calendar.js +8 -4
- package/skills/jskit/references/patterns/connectors/event-delivery/PATTERN.md +1 -1
- package/skills/jskit/references/patterns/connectors/firebase-messaging/PATTERN.md +10 -0
- package/skills/jskit/references/patterns/connectors/firebase-messaging/example/server/notifications.js +8 -0
- package/skills/jskit/references/patterns/connectors/google-ads-search/PATTERN.md +18 -7
- package/skills/jskit/references/patterns/connectors/google-ads-search/example/ads-setup.js +13 -5
- package/skills/jskit/references/patterns/connectors/oauth-connection/PATTERN.md +1 -1
- package/skills/jskit/references/patterns/connectors/paddle-catalogue/PATTERN.md +11 -2
- package/skills/jskit/references/patterns/connectors/paddle-catalogue/example/create-products.js +5 -2
- package/skills/jskit/references/patterns/connectors/public-image/PATTERN.md +10 -1
- package/skills/jskit/references/patterns/connectors/public-image/example/logo-url.js +4 -1
- package/skills/jskit/references/patterns/connectors/redshift-queries/PATTERN.md +1 -1
- package/skills/jskit/references/patterns/connectors/source-scanning/PATTERN.md +13 -2
- package/skills/jskit/references/patterns/connectors/source-scanning/example/source-scanner.js +9 -0
- package/skills/jskit/references/patterns/crud/json-api-resource-package/PATTERN.md +102 -23
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/package.json +3 -2
- package/skills/jskit/references/patterns/crud/json-api-resource-package/example/packages/books/src/server/types.js +5 -0
- package/skills/jskit/references/patterns/crud/resource-contract/PATTERN.md +54 -1
- package/skills/jskit/references/patterns/database/mysql-application/PATTERN.md +16 -5
- package/skills/jskit/references/patterns/database/mysql-application/example/knexfile.js +2 -2
- package/skills/jskit/references/patterns/database/mysql-application/example/package.json +1 -1
- package/skills/jskit/references/patterns/database/mysql-application/example/scripts/prepare-database.js +1 -1
- package/skills/jskit/references/patterns/database/postgres-application/PATTERN.md +16 -5
- package/skills/jskit/references/patterns/database/postgres-application/example/knexfile.js +2 -2
- package/skills/jskit/references/patterns/database/postgres-application/example/package.json +1 -1
- package/skills/jskit/references/patterns/database/postgres-application/example/scripts/prepare-database.js +1 -1
- package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
- package/skills/jskit/references/patterns/rewards/google-rewarded/example/GoogleRewardedDeliveryProvider.js +1 -1
- package/skills/jskit/references/patterns/rewards/google-rewarded/example/googlePublisherTag.js +5 -11
- package/skills/jskit/references/patterns/server/feature-package/PATTERN.md +104 -10
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +9 -4
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/BookingEngineFeature.js +24 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/bookingAvailability.js +10 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/bookingEngine.js +29 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/bookingEngineActions.js +26 -0
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/inputSchemas.js +1 -2
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/types.js +12 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/AvailabilityEngineFeature.js +19 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/InvoiceRollupFeature.js +23 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/availabilityEngineActions.js +26 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/customKnexRepository.js +32 -26
- package/skills/jskit/references/patterns/server/feature-package/example/variations/invoiceRollupActions.js +26 -0
- package/skills/jskit/references/patterns/server/feature-package/example/variations/orchestratorService.js +24 -19
- package/skills/jskit/references/patterns/server/feature-package/example/variations/types.js +7 -0
- package/skills/jskit/references/patterns/users/user-administration-server/PATTERN.md +16 -1
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -2
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/src/server/types.js +5 -0
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +4 -3
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/server/UsersWorkspaceFeature.js +2 -9
- package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/src/server/types.js +5 -0
- package/skills/jskit/references/patterns/workspaces/workspace-server/PATTERN.md +42 -17
- package/skills/jskit/references/patterns/workspaces/workspace-server/example/packages/main/src/server/WorkspaceInvitationsFeature.js +27 -0
- package/skills/jskit/references/patterns/workspaces/workspace-server/example/packages/main/src/server/email/workspaceInviteEmail.js +11 -10
- package/skills/jskit/references/patterns/workspaces/workspace-server/example/packages/main/src/server/email/workspaceInviteMailer.js +27 -0
- package/skills/jskit/references/translation.md +5 -4
- package/skills/jskit/references/typed-features.md +1099 -0
- package/skills/jskit/references/ui-operations.md +3 -3
- package/patterns/feature-package/example/booking-engine/src/server/BookingEngineProvider.js +0 -33
- package/patterns/feature-package/example/booking-engine/src/server/actions.js +0 -24
- package/patterns/feature-package/example/variations/AvailabilityEngineProvider.js +0 -31
- package/patterns/feature-package/example/variations/InvoiceRollupProvider.js +0 -36
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/BookingEngineProvider.js +0 -33
- package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/src/server/actions.js +0 -24
- package/skills/jskit/references/patterns/server/feature-package/example/variations/AvailabilityEngineProvider.js +0 -31
- package/skills/jskit/references/patterns/server/feature-package/example/variations/InvoiceRollupProvider.js +0 -36
|
@@ -34,14 +34,26 @@ Every application with accounts includes the managed-preview login. It is
|
|
|
34
34
|
standard, not optional: adding this pattern adds it, so a managed host's
|
|
35
35
|
preview can sign its browser in as an existing account without anyone asking
|
|
36
36
|
for it. Copy the app-owned `tools/preview-identity` executable (keep it
|
|
37
|
-
executable)
|
|
38
|
-
|
|
37
|
+
executable). It passes `runManagedPreviewIdentityCommand` the two facts only
|
|
38
|
+
the preview host knows, as that host documents them:
|
|
39
|
+
|
|
40
|
+
- `protocol`: the protocol id the host's requests carry and the responses
|
|
41
|
+
echo (JSKIT's default is `jskit.preview-identity.command.v1`);
|
|
42
|
+
- `localHostnames`: the hostname patterns, besides loopback, that the host
|
|
43
|
+
serves the preview application on (none by default).
|
|
44
|
+
|
|
45
|
+
It also passes the process environment as `env`, where the host supplies the
|
|
46
|
+
two exchange values per run.
|
|
47
|
+
|
|
48
|
+
Declare the executable to the host in the form the host reads. A host that
|
|
49
|
+
reads the project's web `Outputs` target takes this block, with the same
|
|
50
|
+
protocol id the executable passes:
|
|
39
51
|
|
|
40
52
|
```markdown
|
|
41
53
|
#### Preview identity
|
|
42
54
|
|
|
43
55
|
- Command: `tools/preview-identity`
|
|
44
|
-
- Protocol:
|
|
56
|
+
- Protocol: `<the host's protocol id>`
|
|
45
57
|
- Identity types: `email` `user-id`
|
|
46
58
|
- Enabled environment: `AUTH_DEV_BYPASS_ENABLED`
|
|
47
59
|
- Secret environment: `AUTH_DEV_BYPASS_SECRET`
|
|
@@ -52,11 +64,11 @@ The preview host supplies fresh output-run-scoped values for both environment
|
|
|
52
64
|
names; users do not set them by hand, and the exchange stays disabled without
|
|
53
65
|
them. The person using the host chooses which existing accounts the preview may
|
|
54
66
|
sign in as; the application never creates users for it. JSKIT owns this
|
|
55
|
-
executable/library pattern
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
executable/library pattern; the host owns its declaration grammar, its
|
|
68
|
+
protocol id and its runtime behavior. The executable calls the exported
|
|
69
|
+
managed-preview identity library directly; it does not require a JSKIT CLI. A
|
|
70
|
+
project without a managed host keeps the executable; it is inert unless both
|
|
71
|
+
environment values are present.
|
|
60
72
|
|
|
61
73
|
Choose local-auth storage through the installed capability provider. A
|
|
62
74
|
database-backed application installs `@jskit-ai/auth-provider-local-db-core`,
|
|
@@ -69,8 +81,9 @@ a user as a side effect.
|
|
|
69
81
|
## Invariants
|
|
70
82
|
|
|
71
83
|
- Credentials and provider secrets come from environment values.
|
|
72
|
-
- An application with accounts ships the executable `tools/preview-identity
|
|
73
|
-
|
|
84
|
+
- An application with accounts ships the executable `tools/preview-identity`,
|
|
85
|
+
passes it its preview host's protocol id and hostnames, and declares it to
|
|
86
|
+
that host.
|
|
74
87
|
- Auth backend selection comes from the installed provider graph, not an
|
|
75
88
|
`AUTH_LOCAL_BACKEND` environment value.
|
|
76
89
|
- The selected auth backend and the storage containing the application's users
|
|
@@ -107,8 +120,8 @@ Exercise failed and successful login, sign-out, reset, protected navigation,
|
|
|
107
120
|
keyboard interaction, warm-cache return navigation, and browser refresh.
|
|
108
121
|
Open the login route with an existing authenticated session and confirm it
|
|
109
122
|
returns to the requested screen; repeat signed out and confirm the form remains.
|
|
110
|
-
Confirm `tools/preview-identity` is committed as executable
|
|
111
|
-
|
|
123
|
+
Confirm `tools/preview-identity` is committed as executable, passes the protocol
|
|
124
|
+
id the host's declaration names, and is declared to the host as above.
|
|
112
125
|
|
|
113
126
|
## Avoid
|
|
114
127
|
|
|
@@ -2,4 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import { runManagedPreviewIdentityCommand } from "@jskit-ai/auth-web/server/managedPreviewIdentity";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// The preview host's protocol id, and the hostnames besides loopback that it
|
|
6
|
+
// serves the application on, as that host documents them.
|
|
7
|
+
process.exitCode = await runManagedPreviewIdentityCommand({
|
|
8
|
+
protocol: "jskit.preview-identity.command.v1",
|
|
9
|
+
localHostnames: [],
|
|
10
|
+
env: process.env
|
|
11
|
+
});
|
|
@@ -38,6 +38,18 @@ to authorized application, user, provider and integration. The application owns
|
|
|
38
38
|
key-entry and disconnect screens. Never return connection parameters to a
|
|
39
39
|
browser or share coding-agent subscription credentials.
|
|
40
40
|
|
|
41
|
+
Each collaborator the composition receives (`authorize`, `createModel`,
|
|
42
|
+
`createClient` and `resolveReference`) is a required parameter typed in a JSDoc
|
|
43
|
+
`@param` and called directly, without a `typeof` probe at the call or a no-op
|
|
44
|
+
default. `createPerplexityAnswers()` checks `authorize` and `createClient` once,
|
|
45
|
+
as input validation when it is composed, so a missing one fails there instead of
|
|
46
|
+
on the first answer. `authorize` and `resolveReference` are typed with
|
|
47
|
+
`ConnectorAuthorize` and `ResolveReference` from
|
|
48
|
+
`@jskit-ai/connectors-core/server/types`. Only the production
|
|
49
|
+
`resolveReference = createEnvironmentReferenceResolver(process.env)` stays as a default, in
|
|
50
|
+
both compositions. A server feature that uses it follows
|
|
51
|
+
[typed features](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/agent-docs/site/guide/framework/typed-features.md).
|
|
52
|
+
|
|
41
53
|
## Do not use when
|
|
42
54
|
|
|
43
55
|
Frameworks outside Node follow their own configuration and AI client patterns.
|
|
@@ -65,6 +77,9 @@ Do not add a runtime catalogue fetch, token billing, an inference proxy, a
|
|
|
65
77
|
cross-language runtime or a silent paid fallback. Never infer that a model
|
|
66
78
|
marked free can be used without the authentication its provider requires.
|
|
67
79
|
|
|
80
|
+
Do not probe a collaborator, default one to `null`, `{}` or a no-op, fill a slot
|
|
81
|
+
with a setter after construction, or keep a module-level registry.
|
|
82
|
+
|
|
68
83
|
## Existing Perplexity connector slots
|
|
69
84
|
|
|
70
85
|
Use `example/perplexity-answer.js` when configuration already has provider
|
|
@@ -80,6 +95,6 @@ search_results. For stream=true consume the async iterator, rendering deltas
|
|
|
80
95
|
and retaining final citations/search_results; cancel with AbortSignal.
|
|
81
96
|
Allow only safe HTTP(S) links in rendered citations. Never send the API key/client
|
|
82
97
|
to a browser. A public route must sanitize SDK failures and enforce app budgets.
|
|
83
|
-
This is direct app-to-provider traffic, with no
|
|
98
|
+
This is direct app-to-provider traffic, with no hosted token sales or proxy.
|
|
84
99
|
A trusted CLI operator can use the same JSON/Env and factory. Other frameworks
|
|
85
100
|
use their own native Perplexity/OpenAI-compatible clients and the same slot.
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import { createEnvironmentReferenceResolver } from "@jskit-ai/connectors-core/server";
|
|
1
2
|
import { createAiConnectionResolver } from "@jskit-ai/connectors-catalog/server/ai";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* App-owned composition. Supply the authenticated authorization policy and the
|
|
6
|
+
* SDK model factory used by this application. Omit resolveReference for Env.
|
|
7
|
+
* @param {object} dependencies
|
|
8
|
+
* @param {object} dependencies.configuration The integration configuration.
|
|
9
|
+
* @param {import("@jskit-ai/connectors-core/server/types").ConnectorAuthorize} dependencies.authorize The application's access policy: the owner, or null.
|
|
10
|
+
* @param {import("@jskit-ai/connectors-core/server/types").ResolveReference} [dependencies.resolveReference]
|
|
11
|
+
* @param {(parameters: object) => unknown} dependencies.createModel The application's SDK model factory.
|
|
12
|
+
*/
|
|
13
|
+
export function createConfiguredAiModel({ configuration, authorize,
|
|
14
|
+
resolveReference = createEnvironmentReferenceResolver(process.env), createModel }) {
|
|
6
15
|
const connections = createAiConnectionResolver({ configuration, authorize, resolveReference });
|
|
7
16
|
return async ({ context, integrationId }) => {
|
|
8
17
|
const parameters = await connections.resolve({ context, integrationId });
|
package/skills/jskit/references/patterns/connectors/ai-connections/example/perplexity-answer.js
CHANGED
|
@@ -2,11 +2,22 @@ import { ConnectorError, createEnvironmentReferenceResolver } from "@jskit-ai/co
|
|
|
2
2
|
import { validateIntegrationConfiguration } from "@jskit-ai/connectors-core/shared/configuration";
|
|
3
3
|
import { perplexityProvider } from "@jskit-ai/connectors-catalog/server/perplexity";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* App-owned composition, not an inference service. Supply the application's native
|
|
7
|
+
* OpenAI-compatible client factory. Credentials and the returned client stay server-side.
|
|
8
|
+
* @param {object} dependencies
|
|
9
|
+
* @param {object} dependencies.configuration The integration configuration.
|
|
10
|
+
* @param {import("@jskit-ai/connectors-core/server/types").ConnectorAuthorize} dependencies.authorize The application's access policy: the owner, or null.
|
|
11
|
+
* @param {(options: object) => { chat: { completions: { create: (body: object, request: object) => Promise<any> } } }} dependencies.createClient
|
|
12
|
+
* The application's native SDK client factory, such as `options => new OpenAI(options)`.
|
|
13
|
+
* @param {import("@jskit-ai/connectors-core/server/types").ResolveReference} [dependencies.resolveReference]
|
|
14
|
+
*/
|
|
7
15
|
export function createPerplexityAnswers({ configuration, authorize, createClient,
|
|
8
|
-
resolveReference = createEnvironmentReferenceResolver() }) {
|
|
9
|
-
|
|
16
|
+
resolveReference = createEnvironmentReferenceResolver(process.env) }) {
|
|
17
|
+
// readable-check: allow method-probe - input validation: the application passes its access policy and its SDK client factory
|
|
18
|
+
if (typeof authorize !== "function" || typeof createClient !== "function") {
|
|
19
|
+
throw new TypeError("Supply application authorization and its native client factory.");
|
|
20
|
+
}
|
|
10
21
|
const config = validateIntegrationConfiguration(configuration, { providers: [perplexityProvider], allowUnknownProviders: true });
|
|
11
22
|
return async ({ context, integrationId, question, model, stream = false, signal }) => {
|
|
12
23
|
const slot = Object.hasOwn(config.integrations, integrationId) ? config.integrations[integrationId] : null;
|
|
@@ -112,6 +112,12 @@ not require putting credentials into source.
|
|
|
112
112
|
- An optional frontend key reference is distinct from the primary backend key.
|
|
113
113
|
Only the application may deliberately expose a suitable search-only key;
|
|
114
114
|
successful backend verification does not verify that frontend key's restrictions.
|
|
115
|
+
- Each collaborator the composition receives (`authorize`) is a required
|
|
116
|
+
parameter typed in a JSDoc `@param` and called directly, without a `typeof`
|
|
117
|
+
probe, a "requires x" guard or a no-op default. `authorize` is typed with
|
|
118
|
+
`ConnectorAuthorize` from `@jskit-ai/connectors-core/server/types`. Only the
|
|
119
|
+
production `env = process.env` stays as a default. A server feature that uses
|
|
120
|
+
it follows [typed features](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/agent-docs/site/guide/framework/typed-features.md).
|
|
115
121
|
|
|
116
122
|
## Framework APIs
|
|
117
123
|
|
|
@@ -168,7 +174,7 @@ const protection = createCredentialProtection({
|
|
|
168
174
|
const store = createFileConnectionStore({ directory: process.env.CONNECTOR_STATE_DIRECTORY, protection });
|
|
169
175
|
const connections = createConnectionService({
|
|
170
176
|
configuration, providers, store,
|
|
171
|
-
resolveReference: createEnvironmentReferenceResolver(),
|
|
177
|
+
resolveReference: createEnvironmentReferenceResolver(process.env),
|
|
172
178
|
authorize: applicationConnectionPolicy
|
|
173
179
|
});
|
|
174
180
|
|
|
@@ -243,6 +249,8 @@ Do not turn provider metadata into arbitrary authenticated URL forwarding.
|
|
|
243
249
|
Do not retry a paid or mutating request automatically. Do not mark an untested
|
|
244
250
|
managed mode or an unimplemented provider operation available.
|
|
245
251
|
|
|
252
|
+
Do not probe a collaborator, default one to `null`, `{}` or a no-op, fill a slot
|
|
253
|
+
with a setter after construction, or keep a module-level registry.
|
|
246
254
|
|
|
247
255
|
## Granola meeting data
|
|
248
256
|
|
package/skills/jskit/references/patterns/connectors/api-key-connection/example/connections.js
CHANGED
|
@@ -5,8 +5,11 @@ import { createFileConnectionStore, createCredentialProtection } from "@jskit-ai
|
|
|
5
5
|
import { resendProvider } from "@jskit-ai/connectors-catalog/server/resend";
|
|
6
6
|
import { firecrawlProvider } from "@jskit-ai/connectors-catalog/server/firecrawl";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Both a manually written CLI and a server can compose this application-owned module.
|
|
10
|
+
* The application supplies its existing identity and permission policy.
|
|
11
|
+
* @param {{ authorize: import("@jskit-ai/connectors-core/server/types").ConnectorAuthorize, env?: Record<string, string | undefined>, configFile?: string }} dependencies
|
|
12
|
+
*/
|
|
10
13
|
export async function applicationConnections({ authorize, env = process.env, configFile = "integrations.json" }) {
|
|
11
14
|
const providers = [resendProvider, firecrawlProvider];
|
|
12
15
|
const configuration = parseIntegrationConfiguration(await readFile(configFile, "utf8"), { providers });
|
|
@@ -19,7 +19,7 @@ composes those libraries with the application's identity and resource policy.
|
|
|
19
19
|
## Do not use when
|
|
20
20
|
|
|
21
21
|
Do not use this as an application login, an AWS account creator, a general SDK
|
|
22
|
-
proxy, or proof that a managed
|
|
22
|
+
proxy, or proof that a managed host's allocation exists. Do not use a machine's
|
|
23
23
|
default AWS credentials for arbitrary application users. Per-user federation,
|
|
24
24
|
AWS IAM Identity Center, noncommercial AWS partitions and arbitrary endpoints
|
|
25
25
|
are outside the fragment. Athena statements can write data and incur costs;
|
|
@@ -28,8 +28,8 @@ connecting does not approve arbitrary future SQL.
|
|
|
28
28
|
## Product decisions
|
|
29
29
|
|
|
30
30
|
Use the exact [S3](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/connectors-catalog/docs/aws-s3.md) or
|
|
31
|
-
[Athena](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/connectors-catalog/docs/aws-athena.md) JSON. The same file is usable by CLI and
|
|
32
|
-
|
|
31
|
+
[Athena](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/connectors-catalog/docs/aws-athena.md) JSON. The same file is usable by CLI and a
|
|
32
|
+
hosted editor's form. Store the actual secret access key, access key ID and optional
|
|
33
33
|
session token outside source. The access key ID uses `settings.accessKeyIdRef`,
|
|
34
34
|
the secret uses `authentication.secretRef`, and temporary credentials add
|
|
35
35
|
`settings.sessionTokenRef`. A missing explicit binding is an error.
|
|
@@ -43,6 +43,13 @@ account assignments, quotas and credential renewal are separate operations.
|
|
|
43
43
|
There is no OAuth callback for these modes. See
|
|
44
44
|
[AWS ownership](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/connectors-catalog/docs/aws-credentials.md).
|
|
45
45
|
|
|
46
|
+
Each collaborator the composition receives (the connection `service`) is a
|
|
47
|
+
required parameter typed in a JSDoc `@param` and called directly, without a
|
|
48
|
+
`typeof` probe, a "requires x" guard or a no-op default. Only the production
|
|
49
|
+
`fetchImpl = globalThis.fetch` stays as a default. A server feature that uses it
|
|
50
|
+
follows
|
|
51
|
+
[typed features](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/agent-docs/site/guide/framework/typed-features.md).
|
|
52
|
+
|
|
46
53
|
## Framework APIs
|
|
47
54
|
|
|
48
55
|
Follow the [API-key connection pattern](../api-key-connection/PATTERN.md) to
|
|
@@ -154,6 +161,9 @@ Do not expose presigned URLs in logs, infer table permission from a workgroup
|
|
|
154
161
|
read, treat workgroup membership as user isolation, or poll queries without an
|
|
155
162
|
application-controlled limit.
|
|
156
163
|
|
|
164
|
+
Do not probe a collaborator, default one to `null`, `{}` or a no-op, fill a slot
|
|
165
|
+
with a setter after construction, or keep a module-level registry.
|
|
166
|
+
|
|
157
167
|
## Verification
|
|
158
168
|
|
|
159
169
|
Missing credential references fail before HTTP. Expired/rejected AWS credentials
|
package/skills/jskit/references/patterns/connectors/aws-storage-queries/example/s3-transfer.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Application-owned composition: service.authorize must approve this exact key
|
|
3
|
+
* for context. The same function works in a Node CLI or application backend.
|
|
4
|
+
* Pass a bounded signal for both signing and the complete response-body read.
|
|
5
|
+
* @param {object} request
|
|
6
|
+
* @param {import("@jskit-ai/connectors-core/server/types").ConnectorsCore} request.service
|
|
7
|
+
* @param {object} request.context
|
|
8
|
+
* @param {string} request.integrationId
|
|
9
|
+
* @param {string} request.key
|
|
10
|
+
* @param {"download" | "upload"} request.direction
|
|
11
|
+
* @param {Blob | ArrayBuffer | ArrayBufferView} [request.body]
|
|
12
|
+
* @param {AbortSignal} request.signal
|
|
13
|
+
* @param {typeof globalThis.fetch} [request.fetchImpl]
|
|
14
|
+
*/
|
|
4
15
|
export async function transferS3Object({ service, context, integrationId, key,
|
|
5
16
|
direction, body, signal, fetchImpl = globalThis.fetch }) {
|
|
6
17
|
if (!["download", "upload"].includes(direction)) throw new TypeError("Choose download or upload.");
|
|
@@ -41,6 +41,11 @@ authenticated user and check membership/operation permissions there.
|
|
|
41
41
|
- The application authorizes owners and executes package-owned migrations.
|
|
42
42
|
- OAuth and persistence machinery is imported from the library.
|
|
43
43
|
- Provider consent and a successful account check precede Connected.
|
|
44
|
+
- Each collaborator the composition receives (the connection `service` that
|
|
45
|
+
`connectInBrowser()` uses) is a required parameter typed in a JSDoc `@param`
|
|
46
|
+
and called directly, without a `typeof` probe, a "requires x" guard or a no-op
|
|
47
|
+
default. A server feature that uses it follows
|
|
48
|
+
[typed features](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/agent-docs/site/guide/framework/typed-features.md).
|
|
44
49
|
|
|
45
50
|
## Framework APIs
|
|
46
51
|
|
|
@@ -104,3 +109,6 @@ your credentials and account approval. The initial runtime implements own web
|
|
|
104
109
|
client registrations. The editor configures the generated application's own registration. Its backend
|
|
105
110
|
resolves the secret from the application environment; never ship a client secret
|
|
106
111
|
inside a desktop binary or browser bundle.
|
|
112
|
+
|
|
113
|
+
Do not probe a collaborator, default one to `null`, `{}` or a no-op, fill a slot
|
|
114
|
+
with a setter after construction, or keep a module-level registry.
|
|
@@ -2,4 +2,4 @@ import { existsSync } from "node:fs";
|
|
|
2
2
|
import { createKnexMigrationConfigFromApp } from "@jskit-ai/database-runtime/server/knexMigrationConfig";
|
|
3
3
|
|
|
4
4
|
if (existsSync(".env")) process.loadEnvFile(".env");
|
|
5
|
-
export default await createKnexMigrationConfigFromApp({ client: "mysql2" });
|
|
5
|
+
export default await createKnexMigrationConfigFromApp({ client: "mysql2", environment: process.env });
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
"db:migrate:status": "knex --knexfile ./knexfile.js migrate:list"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@jskit-ai/connectors-core": "0.2.
|
|
11
|
-
"@jskit-ai/connector-google-calendar": "0.2.
|
|
12
|
-
"@jskit-ai/database-runtime": "0.1.
|
|
13
|
-
"@jskit-ai/database-runtime-mysql": "0.1.
|
|
10
|
+
"@jskit-ai/connectors-core": "0.2.4",
|
|
11
|
+
"@jskit-ai/connector-google-calendar": "0.2.4",
|
|
12
|
+
"@jskit-ai/database-runtime": "0.1.253",
|
|
13
|
+
"@jskit-ai/database-runtime-mysql": "0.1.251",
|
|
14
14
|
"knex": "^3.1.0"
|
|
15
15
|
}
|
|
16
16
|
}
|
package/skills/jskit/references/patterns/connectors/calendar-cli/example/scripts/calendar.js
CHANGED
|
@@ -7,7 +7,11 @@ import { createConnectionService, createEnvironmentReferenceResolver } from "@js
|
|
|
7
7
|
import { createCredentialProtection, createKnexConnectionStore } from "@jskit-ai/connectors-core/server/storage";
|
|
8
8
|
import { googleCalendarProvider } from "@jskit-ai/connector-google-calendar/server";
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* A local operator command owns this HTTP listener; web apps use authenticated routes.
|
|
12
|
+
* @param {import("@jskit-ai/connectors-core/server/types").ConnectorsCore} service
|
|
13
|
+
* @param {object} context
|
|
14
|
+
*/
|
|
11
15
|
async function connectInBrowser(service, context) {
|
|
12
16
|
const callback = new URL(process.env.GOOGLE_CALLBACK_URL);
|
|
13
17
|
if (callback.protocol !== "http:" || callback.hostname !== "127.0.0.1" || !callback.port) {
|
|
@@ -47,9 +51,9 @@ async function connectInBrowser(service, context) {
|
|
|
47
51
|
const start = await service.beginAuthorization({ context, integrationId: "calendar", signal: controller.signal });
|
|
48
52
|
state = new URL(start.authorizationUrl).searchParams.get("state");
|
|
49
53
|
console.log(`Open this URL in your browser:\n${start.authorizationUrl}`);
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
return
|
|
54
|
+
const settled = await outcome;
|
|
55
|
+
if (settled.error) throw settled.error;
|
|
56
|
+
return settled.result;
|
|
53
57
|
} finally {
|
|
54
58
|
clearTimeout(timeout);
|
|
55
59
|
process.off("SIGINT", cancel);
|
|
@@ -145,7 +145,7 @@ schedules with awareness of daylight-saving behavior.
|
|
|
145
145
|
Expose the SDK route through the app's normal server composition, then deploy
|
|
146
146
|
and sync its HTTPS `/api/inngest` URL in the selected Inngest environment.
|
|
147
147
|
Keep the Signing Key private and let the native adapter verify signatures.
|
|
148
|
-
JSKIT CLI users follow the same steps
|
|
148
|
+
JSKIT CLI users follow the same steps. Other stacks use native
|
|
149
149
|
SDKs where available and the same event name/payload/Env contract; this example
|
|
150
150
|
does not promise an SDK in every language. No function execution, cloud sync
|
|
151
151
|
or generated application is performed by this reference pattern.
|
|
@@ -39,6 +39,13 @@ reference, stable project identity and public settings. Verify before reporting
|
|
|
39
39
|
Connected; authorize every audience before sending. Preserve the existing file
|
|
40
40
|
store and token lock instead of copying the grant implementation.
|
|
41
41
|
|
|
42
|
+
Each collaborator the composition receives (`authorizeConnectionOperation`) is a
|
|
43
|
+
required parameter typed in a JSDoc `@param` and called directly, without a
|
|
44
|
+
`typeof` probe, a "requires x" guard or a no-op default. It is typed with
|
|
45
|
+
`ConnectorAuthorize` from `@jskit-ai/connectors-core/server/types`. A server
|
|
46
|
+
feature that uses it follows
|
|
47
|
+
[typed features](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/agent-docs/site/guide/framework/typed-features.md).
|
|
48
|
+
|
|
42
49
|
## Framework APIs
|
|
43
50
|
|
|
44
51
|
Use `parseIntegrationConfiguration`, `createConnectionService`,
|
|
@@ -154,3 +161,6 @@ Do not expose service-account JSON to the browser, confuse Firebase API keys
|
|
|
154
161
|
with private service credentials, or choose the paid project from caller input.
|
|
155
162
|
Do not treat an accepted message receipt as device delivery or automatically
|
|
156
163
|
retry a send whose outcome is unknown.
|
|
164
|
+
|
|
165
|
+
Do not probe a collaborator, default one to `null`, `{}` or a no-op, fill a slot
|
|
166
|
+
with a setter after construction, or keep a module-level registry.
|
|
@@ -4,6 +4,14 @@ import { createConnectionService, createEnvironmentReferenceResolver } from "@js
|
|
|
4
4
|
import { createFileConnectionStore, createCredentialProtection } from "@jskit-ai/connectors-core/server/file-storage";
|
|
5
5
|
import { firebaseCloudMessagingProvider } from "@jskit-ai/connectors-catalog/server/firebase-cloud-messaging";
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @param {object} options
|
|
9
|
+
* @param {string} options.configurationPath
|
|
10
|
+
* @param {string} options.runtimeDirectory
|
|
11
|
+
* @param {Buffer} options.credentialKey
|
|
12
|
+
* @param {Record<string, string | undefined>} options.environment
|
|
13
|
+
* @param {import("@jskit-ai/connectors-core/server/types").ConnectorAuthorize} options.authorizeConnectionOperation The application's access policy.
|
|
14
|
+
*/
|
|
7
15
|
export async function openNotificationConnections({
|
|
8
16
|
configurationPath, runtimeDirectory, credentialKey, environment,
|
|
9
17
|
authorizeConnectionOperation
|
|
@@ -27,18 +27,20 @@ const created = await ads.create(review.reviewId); // starts PAUSED
|
|
|
27
27
|
`configuration.extensions.googleAdsSearch[integrationId]` holds the saved plan.
|
|
28
28
|
Validate it with `validateGoogleAdsSearchPlan` from the package's shared
|
|
29
29
|
`google-ads-search` export. Keep OAuth settings separate so campaign edits do not
|
|
30
|
-
invalidate consent. The runtime has no
|
|
30
|
+
invalidate consent. The runtime has no command protocol, frontend, Env injection or
|
|
31
31
|
storage owner. CLI apps can call it directly. Normal `connections.authorize` must
|
|
32
32
|
authorize the trusted application's advertising administrator for each operation;
|
|
33
33
|
never accept a subject identity from a request body.
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
command and return exactly one JSON result on stdout.
|
|
35
|
+
When a host runs the app's integration setup command, compose `example/ads-setup.js`
|
|
36
|
+
into that command and return exactly one JSON result on stdout. Pass the host's
|
|
37
|
+
request protocol as the fragment's third argument: `protocol`, the id its requests
|
|
38
|
+
carry and its response echoes, and `maxResponseBytes`, the largest response it
|
|
39
|
+
accepts; the host's own command contract names both. Derive `context` and the
|
|
37
40
|
allowed integration ID from trusted command composition before calling the
|
|
38
41
|
fragment. Keep connection status/connect/reconnect/disconnect operations intact.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
their native libraries; they do not execute this JavaScript fragment.
|
|
42
|
+
Other frameworks implement its JSON/Env and operation contract with their native
|
|
43
|
+
libraries; they do not execute this JavaScript fragment.
|
|
42
44
|
|
|
43
45
|
The Search recipe supports only non-political manual-CPC campaigns with one ad
|
|
44
46
|
group, phrase keywords and a website conversion goal. Account creation, PMax,
|
|
@@ -66,9 +68,15 @@ persistent OAuth grants. Reviews include live account values and the saved plan.
|
|
|
66
68
|
Creation is paused and atomic; launch rechecks the live review. Do not replay a
|
|
67
69
|
write after an uncertain response. Disconnecting does not pause campaigns.
|
|
68
70
|
|
|
71
|
+
Each collaborator the composition receives (the `createGoogleAdsSearchService()`
|
|
72
|
+
service) is a required parameter typed in a JSDoc `@param` and called directly,
|
|
73
|
+
without a `typeof` probe, a "requires x" guard or a no-op default. A server
|
|
74
|
+
feature that uses it follows
|
|
75
|
+
[typed features](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/agent-docs/site/guide/framework/typed-features.md).
|
|
76
|
+
|
|
69
77
|
## Example files
|
|
70
78
|
|
|
71
|
-
`example/ads-setup.js` maps
|
|
79
|
+
`example/ads-setup.js` maps a host's optional setup command to the shared service. It
|
|
72
80
|
contains no HTTP endpoint, credential resolution or trusted-identity inference.
|
|
73
81
|
|
|
74
82
|
## Variation points
|
|
@@ -90,3 +98,6 @@ approval and conversion/billing readiness require operator verification.
|
|
|
90
98
|
Do not put secrets in JSON, stdout or chat. Do not execute conversion snippets in
|
|
91
99
|
the editor, confuse OAuth consent with advertiser approval, or claim live account
|
|
92
100
|
acceptance from fixture tests. Keep larger campaign types outside this recipe.
|
|
101
|
+
|
|
102
|
+
Do not probe a collaborator, default one to `null`, `{}` or a no-op, fill a slot
|
|
103
|
+
with a setter after construction, or keep a module-level registry.
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Runs one advertising setup request against the Google Ads Search service. Compose
|
|
3
|
+
* the service in the application's existing authenticated command owner: no request
|
|
4
|
+
* value establishes the trusted application or administrator identity.
|
|
5
|
+
* @param {{ protocol: string, requestId: string, operation: string, ads: Record<string, any> }} request The parsed setup command.
|
|
6
|
+
* @param {import("@jskit-ai/connectors-catalog/server/types").GoogleAdsSearchService} service
|
|
7
|
+
* @param {object} host The command host's request protocol.
|
|
8
|
+
* @param {string} host.protocol The protocol id that requests carry and the response echoes.
|
|
9
|
+
* @param {number} host.maxResponseBytes The largest response the host accepts.
|
|
10
|
+
*/
|
|
11
|
+
export async function dispatchAdsSetup(request, service, { protocol, maxResponseBytes }) {
|
|
12
|
+
if (request?.protocol !== protocol || typeof request.requestId !== "string" ||
|
|
5
13
|
!/^[A-Za-z0-9_-]{1,200}$/.test(request.requestId) || !request.ads || Array.isArray(request.ads) || typeof request.ads !== "object") {
|
|
6
14
|
throw new Error("Invalid advertising setup request.");
|
|
7
15
|
}
|
|
@@ -20,6 +28,6 @@ export async function dispatchAdsSetup(request, service) {
|
|
|
20
28
|
default: throw new Error("Unsupported advertising setup operation.");
|
|
21
29
|
}
|
|
22
30
|
const response = { protocol: request.protocol, requestId: request.requestId, status: "ads", operation: request.operation, data };
|
|
23
|
-
if (Buffer.byteLength(JSON.stringify(response)) >
|
|
31
|
+
if (Buffer.byteLength(JSON.stringify(response)) > maxResponseBytes) throw new Error("Advertising result exceeds the host's response limit. Inspect Google Ads before repeating any write.");
|
|
24
32
|
return response;
|
|
25
33
|
}
|
|
@@ -69,7 +69,7 @@ const protection = createCredentialProtection({
|
|
|
69
69
|
const connections = createConnectionService({
|
|
70
70
|
configuration, providers,
|
|
71
71
|
store: createFileConnectionStore({ directory: process.env.CONNECTOR_STATE_DIRECTORY, protection }),
|
|
72
|
-
resolveReference: createEnvironmentReferenceResolver(), authorize: applicationConnectionPolicy
|
|
72
|
+
resolveReference: createEnvironmentReferenceResolver(process.env), authorize: applicationConnectionPolicy
|
|
73
73
|
});
|
|
74
74
|
```
|
|
75
75
|
|
|
@@ -38,6 +38,12 @@ the ordinary runtime for each request, preserving authorization and the
|
|
|
38
38
|
connection's configured sandbox/live environment. The sandbox setting used for
|
|
39
39
|
local schema validation sends no request and does not override runtime routing.
|
|
40
40
|
|
|
41
|
+
Each collaborator the composition receives (the connection `runtime`) is a
|
|
42
|
+
required parameter typed in a JSDoc `@param` and called directly, without a
|
|
43
|
+
`typeof` probe, a "requires x" guard or a no-op default. A server feature that
|
|
44
|
+
uses it follows
|
|
45
|
+
[typed features](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/agent-docs/site/guide/framework/typed-features.md).
|
|
46
|
+
|
|
41
47
|
## Product decisions
|
|
42
48
|
|
|
43
49
|
For assistant use, authorize the complete cloned request with
|
|
@@ -58,12 +64,15 @@ termination can prevent the returned report from being saved, so an application
|
|
|
58
64
|
needing crash recovery must record each completed step durably. This small
|
|
59
65
|
recipe does not promise crash recovery, rollback or exactly-once execution.
|
|
60
66
|
|
|
67
|
+
Do not probe a collaborator, default one to `null`, `{}` or a no-op, fill a slot
|
|
68
|
+
with a setter after construction, or keep a module-level registry.
|
|
69
|
+
|
|
61
70
|
## Variation points
|
|
62
71
|
|
|
63
|
-
CLI users can call this same JavaScript recipe with their own runtime.
|
|
72
|
+
CLI users can call this same JavaScript recipe with their own runtime. An editor
|
|
64
73
|
configures the project; it does not execute catalogue writes on configuration
|
|
65
74
|
save. Laravel applications implement this composition with their own framework
|
|
66
|
-
and Paddle client, without importing JavaScript or depending on
|
|
75
|
+
and Paddle client, without importing JavaScript or depending on an editor.
|
|
67
76
|
|
|
68
77
|
## Example files
|
|
69
78
|
|
package/skills/jskit/references/patterns/connectors/paddle-catalogue/example/create-products.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { paddleProvider } from "@jskit-ai/connectors-catalog/server/paddle";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Application-owned composition: pass an application-mode connection runtime.
|
|
5
|
+
* An assistant host must approve the complete batch before calling this recipe.
|
|
6
|
+
* @param {{ runtime: import("@jskit-ai/connectors-core/server/types").ConnectorsCore, context: object, integrationId: string, items: object[], signal?: AbortSignal }} request
|
|
7
|
+
*/
|
|
5
8
|
async function createProductsWithPrices({ runtime, context, integrationId, items, signal }) {
|
|
6
9
|
if (!Array.isArray(items) || !items.length || items.length > 100) {
|
|
7
10
|
throw new TypeError("Supply between 1 and 100 products with prices.");
|
|
@@ -29,12 +29,18 @@ existing access policy applies before exposing its configured resources.
|
|
|
29
29
|
|
|
30
30
|
## Invariants
|
|
31
31
|
|
|
32
|
-
- CLI and
|
|
32
|
+
- The CLI and a hosted editor edit the same reference-only `integrations.json`.
|
|
33
33
|
- Only a `pk_` key enters an image URL; a private key fails validation.
|
|
34
34
|
- URL creation is local and does not establish a verified account connection.
|
|
35
35
|
- Browser load/error events report delivery. A monogram is not proof of a brand logo.
|
|
36
36
|
- Domain restrictions concern the app that loads the image, including previews
|
|
37
37
|
and custom domains. The editor VM may have a different origin.
|
|
38
|
+
- Each collaborator the composition receives (`resolveReference`) is a required
|
|
39
|
+
parameter typed in a JSDoc `@param` and called directly, without a `typeof`
|
|
40
|
+
probe, a "requires x" guard or a no-op default. It is typed with
|
|
41
|
+
`ResolveReference` from `@jskit-ai/connectors-core/server/types`. A server
|
|
42
|
+
feature that uses it follows
|
|
43
|
+
[typed features](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/agent-docs/site/guide/framework/typed-features.md).
|
|
38
44
|
|
|
39
45
|
## Framework APIs
|
|
40
46
|
|
|
@@ -82,3 +88,6 @@ These checks need neither live credentials nor generated sample applications.
|
|
|
82
88
|
Do not call server `connectApiKey` to manufacture a Connected receipt for this
|
|
83
89
|
image flow. Do not send a secret key, an environment dump or a caller-selected
|
|
84
90
|
service origin to the browser. Do not treat key naming as provider quota isolation.
|
|
91
|
+
|
|
92
|
+
Do not probe a collaborator, default one to `null`, `{}` or a no-op, fill a slot
|
|
93
|
+
with a setter after construction, or keep a module-level registry.
|
|
@@ -2,7 +2,10 @@ import { parseIntegrationConfiguration } from "@jskit-ai/connectors-core/shared/
|
|
|
2
2
|
import { logoDevDefinition } from "@jskit-ai/connectors-catalog/shared";
|
|
3
3
|
import { createLogoDevImageUrl } from "@jskit-ai/connectors-catalog/client/logo-dev";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The application authorizes access before passing its configuration and resolver.
|
|
7
|
+
* @param {{ configurationText: string, integrationId: string, resolveReference: import("@jskit-ai/connectors-core/server/types").ResolveReference, image: object }} request
|
|
8
|
+
*/
|
|
6
9
|
async function logoUrlFromConfiguration({ configurationText, integrationId, resolveReference, image }) {
|
|
7
10
|
const configuration = parseIntegrationConfiguration(configurationText, { providers: [logoDevDefinition], allowUnknownProviders: true });
|
|
8
11
|
const integration = configuration.integrations[integrationId];
|
|
@@ -24,7 +24,7 @@ SQL can modify data; read-only behavior requires appropriate database grants.
|
|
|
24
24
|
|
|
25
25
|
## Product decisions
|
|
26
26
|
|
|
27
|
-
Select serverless or provisioned in the same JSON
|
|
27
|
+
Select serverless or provisioned in the same JSON the editor edits. Serverless
|
|
28
28
|
requires a workgroup name; provisioned requires a cluster identifier and may use
|
|
29
29
|
an explicit database user. Both require a database and region. Store AWS secrets
|
|
30
30
|
outside the file. Temporary credentials additionally need `sessionTokenRef` and
|