@primitive.ai/prim 0.1.0-alpha.83 → 0.1.0-alpha.85
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/{chunk-ZOSNEO5N.js → chunk-7O6NAUKJ.js} +2 -2
- package/dist/{chunk-BQUJ4AFJ.js → chunk-PPQYQEIR.js} +52 -8
- package/dist/daemon/server.js +411 -0
- package/dist/hook-runtime/daemon/server.js +411 -0
- package/dist/hook-runtime/hooks/post-tool-use.js +53 -9
- package/dist/hook-runtime/hooks/pre-tool-use.js +63 -12
- package/dist/hook-runtime/hooks/prim-hook.js +53 -9
- package/dist/hook-runtime/index.js +469 -1
- package/dist/hooks/post-tool-use.js +2 -2
- package/dist/hooks/pre-tool-use.js +12 -5
- package/dist/hooks/prim-hook.js +2 -2
- package/dist/index.js +469 -1
- package/package.json +1 -1
|
@@ -26797,6 +26797,417 @@ function validate61(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
26797
26797
|
return errors === 0;
|
|
26798
26798
|
}
|
|
26799
26799
|
validate61.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
26800
|
+
function validate62(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
26801
|
+
;
|
|
26802
|
+
let vErrors = null;
|
|
26803
|
+
let errors = 0;
|
|
26804
|
+
const evaluated0 = validate62.evaluated;
|
|
26805
|
+
if (evaluated0.dynamicProps) {
|
|
26806
|
+
evaluated0.props = void 0;
|
|
26807
|
+
}
|
|
26808
|
+
if (evaluated0.dynamicItems) {
|
|
26809
|
+
evaluated0.items = void 0;
|
|
26810
|
+
}
|
|
26811
|
+
const _errs0 = errors;
|
|
26812
|
+
if (errors === _errs0) {
|
|
26813
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
26814
|
+
let missing0;
|
|
26815
|
+
if (data.error === void 0 && (missing0 = "error")) {
|
|
26816
|
+
validate62.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationDisabled/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
26817
|
+
return false;
|
|
26818
|
+
} else {
|
|
26819
|
+
const _errs2 = errors;
|
|
26820
|
+
for (const key0 in data) {
|
|
26821
|
+
if (!(key0 === "error")) {
|
|
26822
|
+
validate62.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationDisabled/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
|
|
26823
|
+
return false;
|
|
26824
|
+
break;
|
|
26825
|
+
}
|
|
26826
|
+
}
|
|
26827
|
+
if (_errs2 === errors) {
|
|
26828
|
+
if (data.error !== void 0) {
|
|
26829
|
+
let data0 = data.error;
|
|
26830
|
+
if (typeof data0 !== "string") {
|
|
26831
|
+
validate62.errors = [{ instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationDisabled/properties/error/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
26832
|
+
return false;
|
|
26833
|
+
}
|
|
26834
|
+
if ("Not found" !== data0) {
|
|
26835
|
+
validate62.errors = [{ instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationDisabled/properties/error/const", keyword: "const", params: { allowedValue: "Not found" }, message: "must be equal to constant" }];
|
|
26836
|
+
return false;
|
|
26837
|
+
}
|
|
26838
|
+
}
|
|
26839
|
+
}
|
|
26840
|
+
}
|
|
26841
|
+
} else {
|
|
26842
|
+
validate62.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationDisabled/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
26843
|
+
return false;
|
|
26844
|
+
}
|
|
26845
|
+
}
|
|
26846
|
+
validate62.errors = vErrors;
|
|
26847
|
+
return errors === 0;
|
|
26848
|
+
}
|
|
26849
|
+
validate62.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
26850
|
+
function validate63(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
26851
|
+
;
|
|
26852
|
+
let vErrors = null;
|
|
26853
|
+
let errors = 0;
|
|
26854
|
+
const evaluated0 = validate63.evaluated;
|
|
26855
|
+
if (evaluated0.dynamicProps) {
|
|
26856
|
+
evaluated0.props = void 0;
|
|
26857
|
+
}
|
|
26858
|
+
if (evaluated0.dynamicItems) {
|
|
26859
|
+
evaluated0.items = void 0;
|
|
26860
|
+
}
|
|
26861
|
+
const _errs1 = errors;
|
|
26862
|
+
let valid1 = false;
|
|
26863
|
+
const _errs2 = errors;
|
|
26864
|
+
if (errors === _errs2) {
|
|
26865
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
26866
|
+
let missing0;
|
|
26867
|
+
if (data.error === void 0 && (missing0 = "error")) {
|
|
26868
|
+
const err0 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationError/anyOf/0/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" };
|
|
26869
|
+
if (vErrors === null) {
|
|
26870
|
+
vErrors = [err0];
|
|
26871
|
+
} else {
|
|
26872
|
+
vErrors.push(err0);
|
|
26873
|
+
}
|
|
26874
|
+
errors++;
|
|
26875
|
+
} else {
|
|
26876
|
+
const _errs4 = errors;
|
|
26877
|
+
for (const key0 in data) {
|
|
26878
|
+
if (!(key0 === "error")) {
|
|
26879
|
+
const err1 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationError/anyOf/0/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
26880
|
+
if (vErrors === null) {
|
|
26881
|
+
vErrors = [err1];
|
|
26882
|
+
} else {
|
|
26883
|
+
vErrors.push(err1);
|
|
26884
|
+
}
|
|
26885
|
+
errors++;
|
|
26886
|
+
break;
|
|
26887
|
+
}
|
|
26888
|
+
}
|
|
26889
|
+
if (_errs4 === errors) {
|
|
26890
|
+
if (data.error !== void 0) {
|
|
26891
|
+
let data0 = data.error;
|
|
26892
|
+
if (typeof data0 !== "string") {
|
|
26893
|
+
const err2 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationError/anyOf/0/properties/error/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
26894
|
+
if (vErrors === null) {
|
|
26895
|
+
vErrors = [err2];
|
|
26896
|
+
} else {
|
|
26897
|
+
vErrors.push(err2);
|
|
26898
|
+
}
|
|
26899
|
+
errors++;
|
|
26900
|
+
}
|
|
26901
|
+
if ("Not found" !== data0) {
|
|
26902
|
+
const err3 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationError/anyOf/0/properties/error/const", keyword: "const", params: { allowedValue: "Not found" }, message: "must be equal to constant" };
|
|
26903
|
+
if (vErrors === null) {
|
|
26904
|
+
vErrors = [err3];
|
|
26905
|
+
} else {
|
|
26906
|
+
vErrors.push(err3);
|
|
26907
|
+
}
|
|
26908
|
+
errors++;
|
|
26909
|
+
}
|
|
26910
|
+
}
|
|
26911
|
+
}
|
|
26912
|
+
}
|
|
26913
|
+
} else {
|
|
26914
|
+
const err4 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationError/anyOf/0/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
26915
|
+
if (vErrors === null) {
|
|
26916
|
+
vErrors = [err4];
|
|
26917
|
+
} else {
|
|
26918
|
+
vErrors.push(err4);
|
|
26919
|
+
}
|
|
26920
|
+
errors++;
|
|
26921
|
+
}
|
|
26922
|
+
}
|
|
26923
|
+
var _valid0 = _errs2 === errors;
|
|
26924
|
+
valid1 = valid1 || _valid0;
|
|
26925
|
+
if (_valid0) {
|
|
26926
|
+
var props0 = true;
|
|
26927
|
+
}
|
|
26928
|
+
const _errs7 = errors;
|
|
26929
|
+
if (errors === _errs7) {
|
|
26930
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
26931
|
+
let missing1;
|
|
26932
|
+
if (data.error === void 0 && (missing1 = "error")) {
|
|
26933
|
+
const err5 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationError/anyOf/1/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" };
|
|
26934
|
+
if (vErrors === null) {
|
|
26935
|
+
vErrors = [err5];
|
|
26936
|
+
} else {
|
|
26937
|
+
vErrors.push(err5);
|
|
26938
|
+
}
|
|
26939
|
+
errors++;
|
|
26940
|
+
} else {
|
|
26941
|
+
const _errs9 = errors;
|
|
26942
|
+
for (const key1 in data) {
|
|
26943
|
+
if (!(key1 === "error")) {
|
|
26944
|
+
const err6 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationError/anyOf/1/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" };
|
|
26945
|
+
if (vErrors === null) {
|
|
26946
|
+
vErrors = [err6];
|
|
26947
|
+
} else {
|
|
26948
|
+
vErrors.push(err6);
|
|
26949
|
+
}
|
|
26950
|
+
errors++;
|
|
26951
|
+
break;
|
|
26952
|
+
}
|
|
26953
|
+
}
|
|
26954
|
+
if (_errs9 === errors) {
|
|
26955
|
+
if (data.error !== void 0) {
|
|
26956
|
+
let data1 = data.error;
|
|
26957
|
+
if (typeof data1 !== "string") {
|
|
26958
|
+
const err7 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationError/anyOf/1/properties/error/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
26959
|
+
if (vErrors === null) {
|
|
26960
|
+
vErrors = [err7];
|
|
26961
|
+
} else {
|
|
26962
|
+
vErrors.push(err7);
|
|
26963
|
+
}
|
|
26964
|
+
errors++;
|
|
26965
|
+
}
|
|
26966
|
+
if ("connect_device_auth_unavailable" !== data1) {
|
|
26967
|
+
const err8 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationError/anyOf/1/properties/error/const", keyword: "const", params: { allowedValue: "connect_device_auth_unavailable" }, message: "must be equal to constant" };
|
|
26968
|
+
if (vErrors === null) {
|
|
26969
|
+
vErrors = [err8];
|
|
26970
|
+
} else {
|
|
26971
|
+
vErrors.push(err8);
|
|
26972
|
+
}
|
|
26973
|
+
errors++;
|
|
26974
|
+
}
|
|
26975
|
+
}
|
|
26976
|
+
}
|
|
26977
|
+
}
|
|
26978
|
+
} else {
|
|
26979
|
+
const err9 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationError/anyOf/1/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
26980
|
+
if (vErrors === null) {
|
|
26981
|
+
vErrors = [err9];
|
|
26982
|
+
} else {
|
|
26983
|
+
vErrors.push(err9);
|
|
26984
|
+
}
|
|
26985
|
+
errors++;
|
|
26986
|
+
}
|
|
26987
|
+
}
|
|
26988
|
+
var _valid0 = _errs7 === errors;
|
|
26989
|
+
valid1 = valid1 || _valid0;
|
|
26990
|
+
if (_valid0) {
|
|
26991
|
+
if (props0 !== true) {
|
|
26992
|
+
props0 = true;
|
|
26993
|
+
}
|
|
26994
|
+
}
|
|
26995
|
+
if (!valid1) {
|
|
26996
|
+
const err10 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationError/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
|
|
26997
|
+
if (vErrors === null) {
|
|
26998
|
+
vErrors = [err10];
|
|
26999
|
+
} else {
|
|
27000
|
+
vErrors.push(err10);
|
|
27001
|
+
}
|
|
27002
|
+
errors++;
|
|
27003
|
+
validate63.errors = vErrors;
|
|
27004
|
+
return false;
|
|
27005
|
+
} else {
|
|
27006
|
+
errors = _errs1;
|
|
27007
|
+
if (vErrors !== null) {
|
|
27008
|
+
if (_errs1) {
|
|
27009
|
+
vErrors.length = _errs1;
|
|
27010
|
+
} else {
|
|
27011
|
+
vErrors = null;
|
|
27012
|
+
}
|
|
27013
|
+
}
|
|
27014
|
+
}
|
|
27015
|
+
validate63.errors = vErrors;
|
|
27016
|
+
evaluated0.props = props0;
|
|
27017
|
+
return errors === 0;
|
|
27018
|
+
}
|
|
27019
|
+
validate63.evaluated = { "dynamicProps": true, "dynamicItems": false };
|
|
27020
|
+
var schema119 = { "type": "object", "properties": { "protocol_version": { "type": "number", "const": 1 }, "issuer": { "type": "string", "format": "uri" }, "client_id": { "type": "string", "maxLength": 256, "pattern": "^client_[A-Za-z0-9_-]+$" }, "default_scopes": { "minItems": 4, "maxItems": 4, "type": "array", "items": { "type": "string", "enum": ["openid", "profile", "email", "offline_access"] } } }, "required": ["protocol_version", "issuer", "client_id", "default_scopes"], "additionalProperties": false, "x-primitive-runtime-refinements": ["canonical_https_origin", "exact_workos_connect_device_scopes"] };
|
|
27021
|
+
var pattern37 = new RegExp("^client_[A-Za-z0-9_-]+$", "u");
|
|
27022
|
+
function validate64(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
27023
|
+
;
|
|
27024
|
+
let vErrors = null;
|
|
27025
|
+
let errors = 0;
|
|
27026
|
+
const evaluated0 = validate64.evaluated;
|
|
27027
|
+
if (evaluated0.dynamicProps) {
|
|
27028
|
+
evaluated0.props = void 0;
|
|
27029
|
+
}
|
|
27030
|
+
if (evaluated0.dynamicItems) {
|
|
27031
|
+
evaluated0.items = void 0;
|
|
27032
|
+
}
|
|
27033
|
+
const _errs0 = errors;
|
|
27034
|
+
if (errors === _errs0) {
|
|
27035
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
27036
|
+
let missing0;
|
|
27037
|
+
if (data.protocol_version === void 0 && (missing0 = "protocol_version") || data.issuer === void 0 && (missing0 = "issuer") || data.client_id === void 0 && (missing0 = "client_id") || data.default_scopes === void 0 && (missing0 = "default_scopes")) {
|
|
27038
|
+
validate64.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
27039
|
+
return false;
|
|
27040
|
+
} else {
|
|
27041
|
+
const _errs3 = errors;
|
|
27042
|
+
for (const key0 in data) {
|
|
27043
|
+
if (!(key0 === "protocol_version" || key0 === "issuer" || key0 === "client_id" || key0 === "default_scopes")) {
|
|
27044
|
+
validate64.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
|
|
27045
|
+
return false;
|
|
27046
|
+
break;
|
|
27047
|
+
}
|
|
27048
|
+
}
|
|
27049
|
+
if (_errs3 === errors) {
|
|
27050
|
+
if (data.protocol_version !== void 0) {
|
|
27051
|
+
let data0 = data.protocol_version;
|
|
27052
|
+
const _errs4 = errors;
|
|
27053
|
+
if (!(typeof data0 == "number" && isFinite(data0))) {
|
|
27054
|
+
validate64.errors = [{ instancePath: instancePath + "/protocol_version", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/properties/protocol_version/type", keyword: "type", params: { type: "number" }, message: "must be number" }];
|
|
27055
|
+
return false;
|
|
27056
|
+
}
|
|
27057
|
+
if (1 !== data0) {
|
|
27058
|
+
validate64.errors = [{ instancePath: instancePath + "/protocol_version", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/properties/protocol_version/const", keyword: "const", params: { allowedValue: 1 }, message: "must be equal to constant" }];
|
|
27059
|
+
return false;
|
|
27060
|
+
}
|
|
27061
|
+
var valid1 = _errs4 === errors;
|
|
27062
|
+
} else {
|
|
27063
|
+
var valid1 = true;
|
|
27064
|
+
}
|
|
27065
|
+
if (valid1) {
|
|
27066
|
+
if (data.issuer !== void 0) {
|
|
27067
|
+
const _errs6 = errors;
|
|
27068
|
+
if (errors === _errs6) {
|
|
27069
|
+
if (errors === _errs6) {
|
|
27070
|
+
if (!(typeof data.issuer === "string")) {
|
|
27071
|
+
validate64.errors = [{ instancePath: instancePath + "/issuer", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/properties/issuer/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
27072
|
+
return false;
|
|
27073
|
+
}
|
|
27074
|
+
}
|
|
27075
|
+
}
|
|
27076
|
+
var valid1 = _errs6 === errors;
|
|
27077
|
+
} else {
|
|
27078
|
+
var valid1 = true;
|
|
27079
|
+
}
|
|
27080
|
+
if (valid1) {
|
|
27081
|
+
if (data.client_id !== void 0) {
|
|
27082
|
+
let data2 = data.client_id;
|
|
27083
|
+
const _errs8 = errors;
|
|
27084
|
+
if (errors === _errs8) {
|
|
27085
|
+
if (typeof data2 === "string") {
|
|
27086
|
+
if (func1(data2) > 256) {
|
|
27087
|
+
validate64.errors = [{ instancePath: instancePath + "/client_id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/properties/client_id/maxLength", keyword: "maxLength", params: { limit: 256 }, message: "must NOT have more than 256 characters" }];
|
|
27088
|
+
return false;
|
|
27089
|
+
} else {
|
|
27090
|
+
if (!pattern37.test(data2)) {
|
|
27091
|
+
validate64.errors = [{ instancePath: instancePath + "/client_id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/properties/client_id/pattern", keyword: "pattern", params: { pattern: "^client_[A-Za-z0-9_-]+$" }, message: 'must match pattern "^client_[A-Za-z0-9_-]+$"' }];
|
|
27092
|
+
return false;
|
|
27093
|
+
}
|
|
27094
|
+
}
|
|
27095
|
+
} else {
|
|
27096
|
+
validate64.errors = [{ instancePath: instancePath + "/client_id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/properties/client_id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
27097
|
+
return false;
|
|
27098
|
+
}
|
|
27099
|
+
}
|
|
27100
|
+
var valid1 = _errs8 === errors;
|
|
27101
|
+
} else {
|
|
27102
|
+
var valid1 = true;
|
|
27103
|
+
}
|
|
27104
|
+
if (valid1) {
|
|
27105
|
+
if (data.default_scopes !== void 0) {
|
|
27106
|
+
let data3 = data.default_scopes;
|
|
27107
|
+
const _errs10 = errors;
|
|
27108
|
+
if (errors === _errs10) {
|
|
27109
|
+
if (Array.isArray(data3)) {
|
|
27110
|
+
if (data3.length > 4) {
|
|
27111
|
+
validate64.errors = [{ instancePath: instancePath + "/default_scopes", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/properties/default_scopes/maxItems", keyword: "maxItems", params: { limit: 4 }, message: "must NOT have more than 4 items" }];
|
|
27112
|
+
return false;
|
|
27113
|
+
} else {
|
|
27114
|
+
if (data3.length < 4) {
|
|
27115
|
+
validate64.errors = [{ instancePath: instancePath + "/default_scopes", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/properties/default_scopes/minItems", keyword: "minItems", params: { limit: 4 }, message: "must NOT have fewer than 4 items" }];
|
|
27116
|
+
return false;
|
|
27117
|
+
} else {
|
|
27118
|
+
var valid2 = true;
|
|
27119
|
+
const len0 = data3.length;
|
|
27120
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
27121
|
+
let data4 = data3[i0];
|
|
27122
|
+
const _errs12 = errors;
|
|
27123
|
+
if (typeof data4 !== "string") {
|
|
27124
|
+
validate64.errors = [{ instancePath: instancePath + "/default_scopes/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/properties/default_scopes/items/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
27125
|
+
return false;
|
|
27126
|
+
}
|
|
27127
|
+
if (!(data4 === "openid" || data4 === "profile" || data4 === "email" || data4 === "offline_access")) {
|
|
27128
|
+
validate64.errors = [{ instancePath: instancePath + "/default_scopes/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/properties/default_scopes/items/enum", keyword: "enum", params: { allowedValues: schema119.properties.default_scopes.items.enum }, message: "must be equal to one of the allowed values" }];
|
|
27129
|
+
return false;
|
|
27130
|
+
}
|
|
27131
|
+
var valid2 = _errs12 === errors;
|
|
27132
|
+
if (!valid2) {
|
|
27133
|
+
break;
|
|
27134
|
+
}
|
|
27135
|
+
}
|
|
27136
|
+
}
|
|
27137
|
+
}
|
|
27138
|
+
} else {
|
|
27139
|
+
validate64.errors = [{ instancePath: instancePath + "/default_scopes", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/properties/default_scopes/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
27140
|
+
return false;
|
|
27141
|
+
}
|
|
27142
|
+
}
|
|
27143
|
+
var valid1 = _errs10 === errors;
|
|
27144
|
+
} else {
|
|
27145
|
+
var valid1 = true;
|
|
27146
|
+
}
|
|
27147
|
+
}
|
|
27148
|
+
}
|
|
27149
|
+
}
|
|
27150
|
+
}
|
|
27151
|
+
}
|
|
27152
|
+
} else {
|
|
27153
|
+
validate64.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationSuccess/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
27154
|
+
return false;
|
|
27155
|
+
}
|
|
27156
|
+
}
|
|
27157
|
+
validate64.errors = vErrors;
|
|
27158
|
+
return errors === 0;
|
|
27159
|
+
}
|
|
27160
|
+
validate64.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
27161
|
+
function validate65(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
27162
|
+
;
|
|
27163
|
+
let vErrors = null;
|
|
27164
|
+
let errors = 0;
|
|
27165
|
+
const evaluated0 = validate65.evaluated;
|
|
27166
|
+
if (evaluated0.dynamicProps) {
|
|
27167
|
+
evaluated0.props = void 0;
|
|
27168
|
+
}
|
|
27169
|
+
if (evaluated0.dynamicItems) {
|
|
27170
|
+
evaluated0.items = void 0;
|
|
27171
|
+
}
|
|
27172
|
+
const _errs0 = errors;
|
|
27173
|
+
if (errors === _errs0) {
|
|
27174
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
27175
|
+
let missing0;
|
|
27176
|
+
if (data.error === void 0 && (missing0 = "error")) {
|
|
27177
|
+
validate65.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationUnavailable/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
27178
|
+
return false;
|
|
27179
|
+
} else {
|
|
27180
|
+
const _errs2 = errors;
|
|
27181
|
+
for (const key0 in data) {
|
|
27182
|
+
if (!(key0 === "error")) {
|
|
27183
|
+
validate65.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationUnavailable/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
|
|
27184
|
+
return false;
|
|
27185
|
+
break;
|
|
27186
|
+
}
|
|
27187
|
+
}
|
|
27188
|
+
if (_errs2 === errors) {
|
|
27189
|
+
if (data.error !== void 0) {
|
|
27190
|
+
let data0 = data.error;
|
|
27191
|
+
if (typeof data0 !== "string") {
|
|
27192
|
+
validate65.errors = [{ instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationUnavailable/properties/error/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
27193
|
+
return false;
|
|
27194
|
+
}
|
|
27195
|
+
if ("connect_device_auth_unavailable" !== data0) {
|
|
27196
|
+
validate65.errors = [{ instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationUnavailable/properties/error/const", keyword: "const", params: { allowedValue: "connect_device_auth_unavailable" }, message: "must be equal to constant" }];
|
|
27197
|
+
return false;
|
|
27198
|
+
}
|
|
27199
|
+
}
|
|
27200
|
+
}
|
|
27201
|
+
}
|
|
27202
|
+
} else {
|
|
27203
|
+
validate65.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/WorkosConnectDeviceConfigurationUnavailable/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
27204
|
+
return false;
|
|
27205
|
+
}
|
|
27206
|
+
}
|
|
27207
|
+
validate65.errors = vErrors;
|
|
27208
|
+
return errors === 0;
|
|
27209
|
+
}
|
|
27210
|
+
validate65.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
26800
27211
|
|
|
26801
27212
|
// src/contract/cli-http-v1.ts
|
|
26802
27213
|
function isGitHubInstallIntentStatusResponse(value) {
|
|
@@ -29606,7 +30017,7 @@ var GATE_BIN2 = "prim-pre-tool-use";
|
|
|
29606
30017
|
var POST_TOOL_USE_BIN2 = "prim-post-tool-use";
|
|
29607
30018
|
var SESSION_START_BIN2 = "prim-session-start";
|
|
29608
30019
|
var CODEX_ARGS = "--agent codex";
|
|
29609
|
-
var CODEX_EDIT_MATCHER = "apply_patch";
|
|
30020
|
+
var CODEX_EDIT_MATCHER = "apply_patch|Bash";
|
|
29610
30021
|
var CODEX_POST_TOOL_MATCHER = "apply_patch|Bash";
|
|
29611
30022
|
var JSON_INDENT2 = 2;
|
|
29612
30023
|
var CODEX_CAPTURE_EVENTS = [
|
|
@@ -32212,18 +32623,29 @@ var EXPECTED_STAGE = {
|
|
|
32212
32623
|
publish: "provisional",
|
|
32213
32624
|
restore: "draft",
|
|
32214
32625
|
ratify: "adopted",
|
|
32626
|
+
promote: "adopted",
|
|
32627
|
+
demote: "provisional",
|
|
32628
|
+
withdraw: "abandoned",
|
|
32215
32629
|
supersede: "superseded"
|
|
32216
32630
|
};
|
|
32217
32631
|
var PATH = {
|
|
32218
32632
|
publish: "/api/cli/decisions/publish",
|
|
32219
32633
|
restore: "/api/cli/decisions/restore",
|
|
32220
32634
|
ratify: "/api/cli/decisions/ratify",
|
|
32635
|
+
// `promote` is the human-facing alias for the established ratify wire
|
|
32636
|
+
// operation; no second server transition or contract endpoint exists.
|
|
32637
|
+
promote: "/api/cli/decisions/ratify",
|
|
32638
|
+
demote: "/api/cli/decisions/demote",
|
|
32639
|
+
withdraw: "/api/cli/decisions/withdraw",
|
|
32221
32640
|
supersede: "/api/cli/decisions/supersede"
|
|
32222
32641
|
};
|
|
32223
32642
|
var PAST_PARTICIPLE = {
|
|
32224
32643
|
publish: "published",
|
|
32225
32644
|
restore: "restored",
|
|
32226
32645
|
ratify: "ratified",
|
|
32646
|
+
promote: "promoted",
|
|
32647
|
+
demote: "demoted",
|
|
32648
|
+
withdraw: "withdrawn",
|
|
32227
32649
|
supersede: "superseded"
|
|
32228
32650
|
};
|
|
32229
32651
|
var ORG_UNBOUND_MESSAGE = "CLI token is not bound to an organization";
|
|
@@ -32233,6 +32655,8 @@ var DECISION_NOT_FOUND_MESSAGE = "Decision not found";
|
|
|
32233
32655
|
var REPLACEMENT_NOT_FOUND_MESSAGE = "Replacement decision not found";
|
|
32234
32656
|
var SELF_REPLACEMENT_MESSAGE = "A decision cannot supersede itself";
|
|
32235
32657
|
var OLD_SERVER_NOT_FOUND_MESSAGE = "Not found";
|
|
32658
|
+
var FEATURE_DISABLED_MESSAGE = "feature_disabled";
|
|
32659
|
+
var FEATURE_CHECK_UNAVAILABLE_MESSAGE = "feature_check_unavailable";
|
|
32236
32660
|
var STAGE_NAME = "(?:draft|provisional|adopted|superseded|abandoned)";
|
|
32237
32661
|
var IMMUTABLE_MESSAGE = new RegExp(
|
|
32238
32662
|
`^An ${STAGE_NAME} decision is immutable \u2014 supersede it to change it$`,
|
|
@@ -32277,6 +32701,15 @@ function formatSuccessHuman(operation, request2, response) {
|
|
|
32277
32701
|
if (operation === "ratify") {
|
|
32278
32702
|
return `[prim] ${identifier} ratified as ${response.stage}.`;
|
|
32279
32703
|
}
|
|
32704
|
+
if (operation === "promote") {
|
|
32705
|
+
return `[prim] ${identifier} promoted as ${response.stage}.`;
|
|
32706
|
+
}
|
|
32707
|
+
if (operation === "demote") {
|
|
32708
|
+
return `[prim] ${identifier} demoted to provisional \u2014 advisory again until re-ratified.`;
|
|
32709
|
+
}
|
|
32710
|
+
if (operation === "withdraw") {
|
|
32711
|
+
return `[prim] ${identifier} withdrawn as abandoned \u2014 removed from active guidance, not deleted; recover with \`prim decisions restore\`.`;
|
|
32712
|
+
}
|
|
32280
32713
|
const replacement = safeRequestedIdentifier(
|
|
32281
32714
|
request2.by,
|
|
32282
32715
|
"the replacement Decision"
|
|
@@ -32300,6 +32733,12 @@ function classifyHttpError2(error) {
|
|
|
32300
32733
|
if (error.status === 403 && message === NOT_AUTHOR_MESSAGE) {
|
|
32301
32734
|
return failure2("not_author", DECISION_LIFECYCLE_EXIT.rejected, error.status);
|
|
32302
32735
|
}
|
|
32736
|
+
if (error.status === 403 && message === FEATURE_DISABLED_MESSAGE) {
|
|
32737
|
+
return failure2("feature_disabled", DECISION_LIFECYCLE_EXIT.rejected, error.status);
|
|
32738
|
+
}
|
|
32739
|
+
if (error.status === 503 && message === FEATURE_CHECK_UNAVAILABLE_MESSAGE) {
|
|
32740
|
+
return failure2("feature_check_unavailable", DECISION_LIFECYCLE_EXIT.server, error.status);
|
|
32741
|
+
}
|
|
32303
32742
|
if (error.status === 409 && message === AMBIGUOUS_MESSAGE) {
|
|
32304
32743
|
return failure2("ambiguous_identifier", DECISION_LIFECYCLE_EXIT.rejected, error.status);
|
|
32305
32744
|
}
|
|
@@ -32359,6 +32798,10 @@ function formatFailureHuman(operation, result) {
|
|
|
32359
32798
|
return `[prim] ${verb} rejected: Decision not found.`;
|
|
32360
32799
|
case "replacement_not_found":
|
|
32361
32800
|
return "[prim] supersede rejected: replacement Decision not found.";
|
|
32801
|
+
case "feature_disabled":
|
|
32802
|
+
return `[prim] ${verb} rejected: manual lifecycle actions are not enabled for this account.`;
|
|
32803
|
+
case "feature_check_unavailable":
|
|
32804
|
+
return `[prim] ${verb} unavailable: the server could not verify feature availability; retry shortly.`;
|
|
32362
32805
|
case "unsupported_server":
|
|
32363
32806
|
return `[prim] ${verb} unavailable: this Primitive server does not support this Decision lifecycle operation; upgrade the server before retrying.`;
|
|
32364
32807
|
case "rejected":
|
|
@@ -32427,6 +32870,18 @@ function ratifyDecision(id, dependencies = defaultDependencies3) {
|
|
|
32427
32870
|
const request2 = { id };
|
|
32428
32871
|
return executeLifecycle("ratify", request2, dependencies);
|
|
32429
32872
|
}
|
|
32873
|
+
function promoteDecision(id, dependencies = defaultDependencies3) {
|
|
32874
|
+
const request2 = { id };
|
|
32875
|
+
return executeLifecycle("promote", request2, dependencies);
|
|
32876
|
+
}
|
|
32877
|
+
function demoteDecision(id, dependencies = defaultDependencies3) {
|
|
32878
|
+
const request2 = { id };
|
|
32879
|
+
return executeLifecycle("demote", request2, dependencies);
|
|
32880
|
+
}
|
|
32881
|
+
function withdrawDecision(id, dependencies = defaultDependencies3) {
|
|
32882
|
+
const request2 = { id };
|
|
32883
|
+
return executeLifecycle("withdraw", request2, dependencies);
|
|
32884
|
+
}
|
|
32430
32885
|
function supersedeDecision(id, by, dependencies = defaultDependencies3) {
|
|
32431
32886
|
const request2 = { id, by };
|
|
32432
32887
|
return executeLifecycle("supersede", request2, dependencies);
|
|
@@ -33367,6 +33822,19 @@ function registerDecisionsCommands(program3) {
|
|
|
33367
33822
|
decisions.command("ratify <idOrShortId>").description("Ratify an authored Decision as adopted").action(async (idOrShortId) => {
|
|
33368
33823
|
process.exitCode = await ratifyDecision(idOrShortId);
|
|
33369
33824
|
});
|
|
33825
|
+
decisions.command("promote <idOrShortId>").description("Promote an authored Decision to adopted, ratified guidance").action(async (idOrShortId) => {
|
|
33826
|
+
process.exitCode = await promoteDecision(idOrShortId);
|
|
33827
|
+
});
|
|
33828
|
+
decisions.command("demote <idOrShortId>").description(
|
|
33829
|
+
"Demote an authored adopted Decision back to provisional \u2014 advisory guidance only, no longer ratified"
|
|
33830
|
+
).action(async (idOrShortId) => {
|
|
33831
|
+
process.exitCode = await demoteDecision(idOrShortId);
|
|
33832
|
+
});
|
|
33833
|
+
decisions.command("withdraw <idOrShortId>").description(
|
|
33834
|
+
"Withdraw an authored Decision as abandoned \u2014 removed from active guidance but never deleted; `prim decisions restore` recovers it as a private draft"
|
|
33835
|
+
).action(async (idOrShortId) => {
|
|
33836
|
+
process.exitCode = await withdrawDecision(idOrShortId);
|
|
33837
|
+
});
|
|
33370
33838
|
decisions.command("supersede <idOrShortId>").description("Supersede a Decision with a distinct replacement Decision").requiredOption("--by <replacementIdOrShortId>", "Decision that replaces the named Decision").action(async (idOrShortId, opts) => {
|
|
33371
33839
|
process.exitCode = await supersedeDecision(idOrShortId, opts.by);
|
|
33372
33840
|
});
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
enrichHookPayloadWithFileRefs,
|
|
7
7
|
preserveHookFileMetadata
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-7O6NAUKJ.js";
|
|
9
9
|
import {
|
|
10
10
|
postToolInvocationId,
|
|
11
11
|
toMove,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
appendMove,
|
|
19
19
|
resolveOrg
|
|
20
20
|
} from "../chunk-YWO7O6QG.js";
|
|
21
|
-
import "../chunk-
|
|
21
|
+
import "../chunk-PPQYQEIR.js";
|
|
22
22
|
import {
|
|
23
23
|
appendCodexContext,
|
|
24
24
|
prepareCodexContext
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
failOpenHermes,
|
|
11
11
|
failOpenOutput,
|
|
12
12
|
readHookMode
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-PPQYQEIR.js";
|
|
14
14
|
import {
|
|
15
15
|
appendCodexContext,
|
|
16
16
|
hasVisibleCodexMessage,
|
|
@@ -60,8 +60,9 @@ function resolvePreflightTargets(args) {
|
|
|
60
60
|
let rawPaths;
|
|
61
61
|
let coverage = "complete";
|
|
62
62
|
let mutation = "present";
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
let definite = false;
|
|
64
|
+
if ((args.agent === "claude_code" || args.agent === "codex") && args.toolName === "Bash") {
|
|
65
|
+
const command = typeof args.toolInput === "string" ? args.toolInput : args.toolInput && typeof args.toolInput === "object" ? args.toolInput.command : void 0;
|
|
65
66
|
if (typeof command !== "string") {
|
|
66
67
|
return { paths: [], coverage: "unverified", mutation: "present" };
|
|
67
68
|
}
|
|
@@ -69,11 +70,13 @@ function resolvePreflightTargets(args) {
|
|
|
69
70
|
rawPaths = shell.paths;
|
|
70
71
|
coverage = shell.coverage;
|
|
71
72
|
mutation = shell.mutation;
|
|
73
|
+
definite = shell.definiteEdit === true;
|
|
72
74
|
} else {
|
|
73
75
|
const extracted = extractFileTargets(args.toolName, args.toolInput, args.agent);
|
|
74
76
|
if (!extracted) return { paths: [], coverage: "complete", mutation: "none" };
|
|
75
77
|
rawPaths = extracted.paths;
|
|
76
78
|
if (!extracted.complete) coverage = "unverified";
|
|
79
|
+
definite = true;
|
|
77
80
|
}
|
|
78
81
|
const root = canonicalGitRoot(args.cwd);
|
|
79
82
|
const paths = /* @__PURE__ */ new Set();
|
|
@@ -84,7 +87,11 @@ function resolvePreflightTargets(args) {
|
|
|
84
87
|
}
|
|
85
88
|
const bounded = [...paths];
|
|
86
89
|
if (bounded.length > MAX_PREFLIGHT_PATHS) coverage = "unverified";
|
|
87
|
-
|
|
90
|
+
const resolved = bounded.slice(0, MAX_PREFLIGHT_PATHS);
|
|
91
|
+
if (definite && resolved.length === 0 && mutation === "present") {
|
|
92
|
+
return { paths: resolved, coverage: "unverified", mutation, definite: true };
|
|
93
|
+
}
|
|
94
|
+
return { paths: resolved, coverage, mutation };
|
|
88
95
|
}
|
|
89
96
|
function truncateUtf8(value, maxBytes) {
|
|
90
97
|
const encoded = Buffer2.from(value);
|
|
@@ -284,7 +291,7 @@ async function main() {
|
|
|
284
291
|
await emit(failOpen());
|
|
285
292
|
return;
|
|
286
293
|
}
|
|
287
|
-
if (targets.paths.length === 0) {
|
|
294
|
+
if (targets.paths.length === 0 && !targets.definite) {
|
|
288
295
|
await emit(failOpen());
|
|
289
296
|
return;
|
|
290
297
|
}
|
package/dist/hooks/prim-hook.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
enrichHookPayloadWithFileRefs,
|
|
14
14
|
preserveHookFileMetadata
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-7O6NAUKJ.js";
|
|
16
16
|
import {
|
|
17
17
|
postToolInvocationId,
|
|
18
18
|
shouldFlushAfter,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
appendMove,
|
|
26
26
|
resolveOrg
|
|
27
27
|
} from "../chunk-YWO7O6QG.js";
|
|
28
|
-
import "../chunk-
|
|
28
|
+
import "../chunk-PPQYQEIR.js";
|
|
29
29
|
import {
|
|
30
30
|
prepareCodexContext
|
|
31
31
|
} from "../chunk-4CZTNXIS.js";
|