@intentius/chant-lexicon-aws 0.124.23 → 0.124.25
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/dist/api/credential-chain.d.ts +114 -0
- package/dist/api/credential-chain.d.ts.map +1 -0
- package/dist/api/read-client.d.ts +20 -0
- package/dist/api/read-client.d.ts.map +1 -1
- package/dist/caller-identity.d.ts +25 -6
- package/dist/caller-identity.d.ts.map +1 -1
- package/dist/codegen/generate.d.ts.map +1 -1
- package/dist/codegen/property-overlay.d.ts +60 -0
- package/dist/codegen/property-overlay.d.ts.map +1 -0
- package/dist/codegen/property-overlay.json +19 -0
- package/dist/integrity.json +4 -4
- package/dist/manifest.json +1 -1
- package/dist/meta.json +7 -0
- package/dist/okf/types/Runtime.md +1 -0
- package/dist/op/activities/floci.d.ts +10 -1
- package/dist/op/activities/floci.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/package.json +2 -2
- package/src/api/credential-chain.test.ts +70 -0
- package/src/api/credential-chain.ts +536 -0
- package/src/api/read-client.ts +54 -0
- package/src/caller-identity.test.ts +301 -16
- package/src/caller-identity.ts +43 -21
- package/src/codegen/generate.ts +23 -1
- package/src/codegen/property-overlay.json +19 -0
- package/src/codegen/property-overlay.test.ts +61 -0
- package/src/codegen/property-overlay.ts +125 -0
- package/src/composites/agentcore-agent.test.ts +26 -1
- package/src/generated/index.d.ts +2 -0
- package/src/generated/lexicon-aws.json +7 -0
- package/src/op/activities/floci.test.ts +26 -0
- package/src/op/activities/floci.ts +17 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backfilled properties (chant #3953).
|
|
3
|
+
*
|
|
4
|
+
* The Registry spec is pinned by content (src/spec/pin.ts), so a property AWS
|
|
5
|
+
* adds after the pin was accepted does not reach the generated types until the
|
|
6
|
+
* pin moves. Moving it is a reviewed, whole-spec decision: the 2026-08-05 pin
|
|
7
|
+
* against the October upstream is 185 resource types apart. When one property
|
|
8
|
+
* is needed before that, it goes here instead of being cast past the types.
|
|
9
|
+
*
|
|
10
|
+
* Each entry names a top-level property and the schema fragment to add for it,
|
|
11
|
+
* copied from the live Registry schema. It is merged into the raw schema before
|
|
12
|
+
* parsing, so the property reaches the `.d.ts` and the lexicon registry by the
|
|
13
|
+
* same path a spec property does. The overlay has no way to mark a property
|
|
14
|
+
* create-only, so it only suits properties that are updatable in place.
|
|
15
|
+
*
|
|
16
|
+
* Precedence follows the enum overlay (#1497): where the spec already declares
|
|
17
|
+
* the property, the spec wins and the entry is reported as redundant, so a pin
|
|
18
|
+
* bump surfaces the entries it retires.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import overlayDocument from "./property-overlay.json" with { type: "json" };
|
|
22
|
+
|
|
23
|
+
/** One backfilled property. */
|
|
24
|
+
export interface PropertyOverlayEntry {
|
|
25
|
+
/** CloudFormation type name, e.g. `AWS::BedrockAgentCore::Runtime`. */
|
|
26
|
+
type: string;
|
|
27
|
+
/** Top-level property name, added under `/properties`. */
|
|
28
|
+
property: string;
|
|
29
|
+
/** The chant issue that asked for it. */
|
|
30
|
+
issue: number;
|
|
31
|
+
/** Where the schema fragment was copied from. */
|
|
32
|
+
source: string;
|
|
33
|
+
/** ISO date the fragment was last read from `source`. */
|
|
34
|
+
reviewed: string;
|
|
35
|
+
/** JSON Schema for the property, as the Registry schema declares it. */
|
|
36
|
+
schema: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** What happened to one entry during a generation run. */
|
|
40
|
+
export interface PropertyOverlayApplication {
|
|
41
|
+
entry: PropertyOverlayEntry;
|
|
42
|
+
/** `applied` added the property; `redundant` found the spec already declares it. */
|
|
43
|
+
outcome: "applied" | "redundant";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The backfilled entries, in file order. */
|
|
47
|
+
export function propertyOverlayEntries(): PropertyOverlayEntry[] {
|
|
48
|
+
return overlayDocument.entries as PropertyOverlayEntry[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Entries grouped by CloudFormation type name. */
|
|
52
|
+
export function propertyOverlayByType(
|
|
53
|
+
entries: PropertyOverlayEntry[] = propertyOverlayEntries(),
|
|
54
|
+
): Map<string, PropertyOverlayEntry[]> {
|
|
55
|
+
const byType = new Map<string, PropertyOverlayEntry[]>();
|
|
56
|
+
for (const entry of entries) {
|
|
57
|
+
const list = byType.get(entry.type);
|
|
58
|
+
if (list) list.push(entry);
|
|
59
|
+
else byType.set(entry.type, [entry]);
|
|
60
|
+
}
|
|
61
|
+
return byType;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Add the entries for one CloudFormation type to its raw schema bytes. */
|
|
65
|
+
export function applyPropertyOverlay(
|
|
66
|
+
data: Buffer | string,
|
|
67
|
+
entries: PropertyOverlayEntry[],
|
|
68
|
+
): { data: Buffer | string; applications: PropertyOverlayApplication[] } {
|
|
69
|
+
if (entries.length === 0) return { data, applications: [] };
|
|
70
|
+
|
|
71
|
+
const text = typeof data === "string" ? data : data.toString("utf-8");
|
|
72
|
+
const doc = JSON.parse(text) as Record<string, unknown>;
|
|
73
|
+
const properties = (doc.properties ??= {}) as Record<string, unknown>;
|
|
74
|
+
const applications: PropertyOverlayApplication[] = [];
|
|
75
|
+
let changed = false;
|
|
76
|
+
|
|
77
|
+
for (const entry of entries) {
|
|
78
|
+
if (entry.property in properties) {
|
|
79
|
+
applications.push({ entry, outcome: "redundant" });
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
properties[entry.property] = structuredClone(entry.schema);
|
|
83
|
+
changed = true;
|
|
84
|
+
applications.push({ entry, outcome: "applied" });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!changed) return { data, applications };
|
|
88
|
+
const rewritten = JSON.stringify(doc);
|
|
89
|
+
return {
|
|
90
|
+
data: typeof data === "string" ? rewritten : Buffer.from(rewritten),
|
|
91
|
+
applications,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Fail on an entry whose type the run never saw. Only a run over the real
|
|
97
|
+
* schema zip is strict; a fixture run legitimately lacks most types.
|
|
98
|
+
*/
|
|
99
|
+
export function assertPropertyOverlayCoverage(
|
|
100
|
+
entries: PropertyOverlayEntry[],
|
|
101
|
+
seenTypes: Set<string>,
|
|
102
|
+
strict: boolean,
|
|
103
|
+
): void {
|
|
104
|
+
if (!strict) return;
|
|
105
|
+
const missing = [...new Set(entries.filter((e) => !seenTypes.has(e.type)).map((e) => e.type))];
|
|
106
|
+
if (missing.length === 0) return;
|
|
107
|
+
throw new Error(
|
|
108
|
+
`property overlay names type(s) the spec does not contain: ${missing.sort().join(", ")}. ` +
|
|
109
|
+
`Drop them from src/codegen/property-overlay.json or fix the type name.`,
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** One warning line per entry the spec has caught up with. */
|
|
114
|
+
export function redundantPropertyOverlayWarnings(
|
|
115
|
+
applications: PropertyOverlayApplication[],
|
|
116
|
+
): Array<{ file: string; error: string }> {
|
|
117
|
+
return applications
|
|
118
|
+
.filter((a) => a.outcome === "redundant")
|
|
119
|
+
.map((a) => ({
|
|
120
|
+
file: `${a.entry.type}/properties/${a.entry.property}`,
|
|
121
|
+
error:
|
|
122
|
+
`property overlay entry is redundant: the spec already declares this property, ` +
|
|
123
|
+
`and the spec wins. Retire the entry from src/codegen/property-overlay.json.`,
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
@@ -6,7 +6,8 @@ import { AttrRef } from "@intentius/chant/attrref";
|
|
|
6
6
|
// reaching into core directly here mirrors nested-stack-integration.test.ts's
|
|
7
7
|
// precedent for aws-lexicon integration-style tests.
|
|
8
8
|
import { resolveAttrRefs } from "../../../../packages/core/src/discovery/resolve";
|
|
9
|
-
import { AgentCoreAgent, agentCoreDefaultEndpointArn } from "./agentcore-agent";
|
|
9
|
+
import { AgentCoreAgent, agentCoreDefaultEndpointArn, type AgentCoreAgentProps } from "./agentcore-agent";
|
|
10
|
+
import { Runtime } from "../generated";
|
|
10
11
|
import { Split, Ref } from "../intrinsics";
|
|
11
12
|
import { awsSerializer } from "../serializer";
|
|
12
13
|
|
|
@@ -262,6 +263,30 @@ describe("AgentCoreAgent", () => {
|
|
|
262
263
|
expect(endpointProps.Description).toBe("prod alias");
|
|
263
264
|
});
|
|
264
265
|
|
|
266
|
+
test("defaults.runtime takes PlatformVersion, typed, and it reaches the template (#3953)", () => {
|
|
267
|
+
// Typed on purpose: the backfilled property must be accepted without a cast.
|
|
268
|
+
const runtimeDefaults: AgentCoreAgentProps["defaults"] = { runtime: { PlatformVersion: "2" } };
|
|
269
|
+
const expanded = expandComposite("agent", AgentCoreAgent({ ...baseProps, defaults: runtimeDefaults }));
|
|
270
|
+
resolveAttrRefs(expanded);
|
|
271
|
+
const template = JSON.parse(awsSerializer.serialize(expanded) as string);
|
|
272
|
+
expect(template.Resources.agentRuntime.Properties.PlatformVersion).toBe("2");
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
test("a Runtime built directly with PlatformVersion emits it (#3953)", () => {
|
|
276
|
+
const runtime = new Runtime({
|
|
277
|
+
AgentRuntimeName: "support_agent",
|
|
278
|
+
AgentRuntimeArtifact: { ContainerConfiguration: { ContainerUri: baseProps.containerUri } },
|
|
279
|
+
NetworkConfiguration: { NetworkMode: "PUBLIC" },
|
|
280
|
+
RoleArn: "arn:aws:iam::123456789012:role/agent",
|
|
281
|
+
PlatformVersion: "2",
|
|
282
|
+
});
|
|
283
|
+
const template = JSON.parse(awsSerializer.serialize(new Map([["agentRuntime", runtime]])) as string);
|
|
284
|
+
expect(template.Resources.agentRuntime).toMatchObject({
|
|
285
|
+
Type: "AWS::BedrockAgentCore::Runtime",
|
|
286
|
+
Properties: { AgentRuntimeName: "support_agent", PlatformVersion: "2" },
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
|
|
265
290
|
test("serializes to a valid CloudFormation template with the expected resource types", () => {
|
|
266
291
|
const expanded = expandComposite("agent", AgentCoreAgent(withEndpoint));
|
|
267
292
|
resolveAttrRefs(expanded);
|
package/src/generated/index.d.ts
CHANGED
|
@@ -30885,6 +30885,8 @@ export declare class Runtime {
|
|
|
30885
30885
|
LastUpdatedAt?: string;
|
|
30886
30886
|
/** Lifecycle configuration for managing runtime sessions */
|
|
30887
30887
|
LifecycleConfiguration?: Runtime_LifecycleConfiguration;
|
|
30888
|
+
/** The version of the runtime platform */
|
|
30889
|
+
PlatformVersion?: string;
|
|
30888
30890
|
/** Protocol configuration for the agent runtime */
|
|
30889
30891
|
ProtocolConfiguration?: Runtime_ProtocolConfiguration;
|
|
30890
30892
|
/** Configuration for HTTP request headers */
|
|
@@ -87930,6 +87930,13 @@
|
|
|
87930
87930
|
"WorkloadIdentityDetails": "WorkloadIdentityDetails",
|
|
87931
87931
|
"FailureReason": "FailureReason"
|
|
87932
87932
|
},
|
|
87933
|
+
"propertyConstraints": {
|
|
87934
|
+
"PlatformVersion": {
|
|
87935
|
+
"pattern": "^[^\\s]+$",
|
|
87936
|
+
"minLength": 1,
|
|
87937
|
+
"maxLength": 128
|
|
87938
|
+
}
|
|
87939
|
+
},
|
|
87933
87940
|
"createOnly": [
|
|
87934
87941
|
"AgentRuntimeName"
|
|
87935
87942
|
],
|
|
@@ -32,6 +32,32 @@ describe("flociRunCommand (#704)", () => {
|
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
+
describe("flociRunCommand image, network, settings and loopback (#3952)", () => {
|
|
36
|
+
test("the default image stays the pinned one when only other options are given", () => {
|
|
37
|
+
expect(flociRunCommand({ network: "loom" }).endsWith("floci/floci:1.5.34")).toBe(true);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("all four options together, in the argv docker gets", () => {
|
|
41
|
+
expect(
|
|
42
|
+
flociRunCommand({
|
|
43
|
+
image: "floci/floci:1.6.0",
|
|
44
|
+
network: "loom-local",
|
|
45
|
+
settings: { FLOCI_STORAGE_MODE: "memory" },
|
|
46
|
+
loopback: true,
|
|
47
|
+
dockerSocket: true,
|
|
48
|
+
}),
|
|
49
|
+
).toBe(
|
|
50
|
+
"docker run -d --rm --name chant-floci -p 127.0.0.1:4566:4566 --network loom-local " +
|
|
51
|
+
"-e FLOCI_STORAGE_MODE=memory -v /var/run/docker.sock:/var/run/docker.sock floci/floci:1.6.0",
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test("a setting that is not FLOCI_* is refused, not passed to the container", () => {
|
|
56
|
+
expect(() => flociRunCommand({ settings: { AWS_SECRET_ACCESS_KEY: "x" } })).toThrow(/not a FLOCI_\* variable/);
|
|
57
|
+
expect(FLOCI_SPEC.settingsPrefix).toBe("FLOCI_");
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
35
61
|
describe("flociRmCommand / flociExistsCommand (#704)", () => {
|
|
36
62
|
test("rm force-removes the container", () => {
|
|
37
63
|
expect(flociRmCommand("chant-floci")).toBe("docker rm -f chant-floci");
|
|
@@ -16,8 +16,17 @@ export interface FlociUpArgs {
|
|
|
16
16
|
name?: string;
|
|
17
17
|
/** Host port mapped to the emulator's `:4566`. Default: `4566`. */
|
|
18
18
|
port?: number;
|
|
19
|
-
/** Floci image. Default: `floci/floci:
|
|
19
|
+
/** Floci image. Default: the pinned `floci/floci:1.5.34`. */
|
|
20
20
|
image?: string;
|
|
21
|
+
/** Docker network the container joins, e.g. a compose network other containers reach Floci on. */
|
|
22
|
+
network?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Extra Floci settings, passed to the container as `-e KEY=VALUE`. Every key
|
|
25
|
+
* must start with `FLOCI_`; any other key is refused rather than passed on.
|
|
26
|
+
*/
|
|
27
|
+
settings?: Record<string, string>;
|
|
28
|
+
/** Publish the port on 127.0.0.1 only, instead of every host interface. Default: `false`. */
|
|
29
|
+
loopback?: boolean;
|
|
21
30
|
/** Mount the docker socket — Floci needs it for the ECR backing registry. Default: `false`. */
|
|
22
31
|
dockerSocket?: boolean;
|
|
23
32
|
/** `AWS_REGION` exported for subsequent steps. Default: `us-east-1`. */
|
|
@@ -60,6 +69,7 @@ const flociSpecFor = (readyService: string): EmulatorSpec => ({
|
|
|
60
69
|
healthPath: "/_localstack/health",
|
|
61
70
|
ready: (body) => isFlociReady(body, readyService),
|
|
62
71
|
upstream: { repo: "floci-io/floci" },
|
|
72
|
+
settingsPrefix: "FLOCI_",
|
|
63
73
|
});
|
|
64
74
|
|
|
65
75
|
/** The Floci emulator spec — the aws plugin's `emulator` capability (#920). */
|
|
@@ -91,6 +101,9 @@ export function flociRunCommand(args: FlociUpArgs = {}): string {
|
|
|
91
101
|
name: args.name,
|
|
92
102
|
port: args.port,
|
|
93
103
|
image: args.image,
|
|
104
|
+
network: args.network,
|
|
105
|
+
settings: args.settings,
|
|
106
|
+
loopback: args.loopback,
|
|
94
107
|
extraArgs: args.dockerSocket ? [...DOCKER_SOCK] : [],
|
|
95
108
|
});
|
|
96
109
|
}
|
|
@@ -113,6 +126,9 @@ export async function flociUp(args: FlociUpArgs = {}, signal?: AbortSignal): Pro
|
|
|
113
126
|
name: args.name,
|
|
114
127
|
port: args.port,
|
|
115
128
|
image: args.image,
|
|
129
|
+
network: args.network,
|
|
130
|
+
settings: args.settings,
|
|
131
|
+
loopback: args.loopback,
|
|
116
132
|
timeoutMs: args.timeoutMs,
|
|
117
133
|
intervalMs: args.intervalMs,
|
|
118
134
|
extraArgs: args.dockerSocket ? [...DOCKER_SOCK] : [],
|