@voxgig/sdkgen 4.2.6 → 4.2.8
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/bin/voxgig-sdkgen +1 -1
- package/dist/helpers/naming.js +5 -4
- package/dist/helpers/naming.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/project/.sdk/model/feature/cost.aon +43 -0
- package/project/.sdk/model/feature/feature-index.aon +1 -0
- package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +2 -1
- package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +2 -1
- package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +2 -1
- package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +2 -1
- package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +2 -1
- package/project/.sdk/src/cmp/py/ReadmeExamplesTest_py.ts +15 -5
- package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +2 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +2 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +2 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +2 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +2 -1
- package/project/.sdk/tm/c/core/sdk.h +1 -0
- package/project/.sdk/tm/c/feature/cost.c +549 -0
- package/project/.sdk/tm/c/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/clojure/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/feature/cost.hpp +419 -0
- package/project/.sdk/tm/cpp/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/csharp/feature/CostFeature.cs +518 -0
- package/project/.sdk/tm/csharp/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/dart/lib/feature/cost/CostFeature.dart +446 -0
- package/project/.sdk/tm/dart/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/cost.ex +442 -0
- package/project/.sdk/tm/elixir/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/go/feature/cost_feature.go +424 -0
- package/project/.sdk/tm/go/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/go-cli/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/go-mcp/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/java/feature/CostFeature.java +431 -0
- package/project/.sdk/tm/java/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/js/src/feature/cost/CostFeature.js +413 -0
- package/project/.sdk/tm/kotlin/feature/CostFeature.kt +430 -0
- package/project/.sdk/tm/kotlin/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/lua/feature/cost_feature.lua +457 -0
- package/project/.sdk/tm/lua/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/perl/feature/cost_feature.pm +446 -0
- package/project/.sdk/tm/perl/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/php/feature/CostFeature.php +439 -0
- package/project/.sdk/tm/php/feature/TestFeature.php +31 -1
- package/project/.sdk/tm/php/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/py/pkg/feature/cost_feature.py +381 -0
- package/project/.sdk/tm/py/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/py-data/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/rb/feature/cost_feature.rb +386 -0
- package/project/.sdk/tm/rb/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/rust/feature/cost.rs +467 -0
- package/project/.sdk/tm/rust/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/scala/feature/CostFeature.scala +388 -0
- package/project/.sdk/tm/scala/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/CostFeature.swift +425 -0
- package/project/.sdk/tm/swift/src/feature/cost/.gitkeep +0 -0
- package/project/.sdk/tm/ts/src/feature/cost/CostFeature.ts +415 -0
- package/project/.sdk/tm/zig/feature/cost.zig +457 -0
- package/project/.sdk/tm/zig/src/feature/cost/.gitkeep +0 -0
- package/project/sdkgen-package.json +2 -1
- package/src/helpers/naming.ts +5 -4
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
main: kit: feature: cost: {
|
|
3
|
+
|
|
4
|
+
name: key()
|
|
5
|
+
title: "Cost tracking and spend budget for API calls"
|
|
6
|
+
version: '0.0.1'
|
|
7
|
+
active: true
|
|
8
|
+
base: 'BASE'
|
|
9
|
+
|
|
10
|
+
# Both seams. The wrap prices every HTTP ATTEMPT (a retry is charged
|
|
11
|
+
# again, as the upstream API charges it); the hooks gate on budget before
|
|
12
|
+
# anything is sent, and attribute the total to the operation afterwards.
|
|
13
|
+
transport: 'wrap'
|
|
14
|
+
|
|
15
|
+
config: {
|
|
16
|
+
options: {
|
|
17
|
+
active: false
|
|
18
|
+
currency: 'USD'
|
|
19
|
+
# flat cost per attempt, when no rate or reported figure applies
|
|
20
|
+
unit: 0
|
|
21
|
+
# cost per attempt keyed '<entity>.<op>', '<op>', or '*'
|
|
22
|
+
rates: {}
|
|
23
|
+
# response header carrying a reported usage figure (per attempt)
|
|
24
|
+
header: ''
|
|
25
|
+
# response body path carrying a reported usage figure (per operation),
|
|
26
|
+
# e.g. 'usage.total_tokens'
|
|
27
|
+
path: ''
|
|
28
|
+
# price per reported unit; multiplies a header or body figure
|
|
29
|
+
perUnit: 0
|
|
30
|
+
# spend ceiling, in `currency`. 0 = no budget
|
|
31
|
+
budget: 0
|
|
32
|
+
# once the budget is spent: 'warn' records it, 'deny' refuses the call
|
|
33
|
+
onBudget: 'warn'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
hook: {
|
|
38
|
+
PrePoint: active: true
|
|
39
|
+
PreDone: active: true
|
|
40
|
+
# A failed operation still spent the money, so it is committed here too.
|
|
41
|
+
PreUnexpected: active: true
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -514,11 +514,21 @@ def _run_batch(items, label):
|
|
|
514
514
|
env = dict(os.environ)
|
|
515
515
|
env["PYTHONDONTWRITEBYTECODE"] = "1"
|
|
516
516
|
env["PYTHONPATH"] = _PY_ROOT + os.pathsep + env.get("PYTHONPATH", "")
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
517
|
+
|
|
518
|
+
# A FILE, not "python -c". The driver embeds every runnable snippet's
|
|
519
|
+
# source, and a large SDK documents hundreds of them: passing that on the
|
|
520
|
+
# command line exceeded ARG_MAX and the whole gate died with
|
|
521
|
+
# "OSError: [Errno 7] Argument list too long" — on gitlab and github, while
|
|
522
|
+
# every small repo passed. The batch has no size limit through a file.
|
|
523
|
+
with tempfile.TemporaryDirectory() as td:
|
|
524
|
+
driver_path = os.path.join(td, "readme_batch_driver.py")
|
|
525
|
+
with open(driver_path, "w", encoding="utf-8") as fh:
|
|
526
|
+
fh.write(driver)
|
|
527
|
+
proc = subprocess.run(
|
|
528
|
+
[sys.executable, driver_path],
|
|
529
|
+
cwd=_PY_ROOT, env=env, capture_output=True, text=True,
|
|
530
|
+
)
|
|
531
|
+
return (proc.stdout or "") + (proc.stderr or "")
|
|
522
532
|
|
|
523
533
|
|
|
524
534
|
def _batch_segment(text, index):
|
|
@@ -519,6 +519,7 @@ Feature* feature_retry_new(void);
|
|
|
519
519
|
Feature* feature_timeout_new(void);
|
|
520
520
|
Feature* feature_ratelimit_new(void);
|
|
521
521
|
Feature* feature_cache_new(void);
|
|
522
|
+
Feature* feature_cost_new(void);
|
|
522
523
|
Feature* feature_idempotency_new(void);
|
|
523
524
|
Feature* feature_paging_new(void);
|
|
524
525
|
Feature* feature_streaming_new(void);
|