aipctl 2026.6.14 → 2026.7.1
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/build/index.cjs +140 -42
- package/docs/architecture.md +1 -0
- package/package.json +10 -8
package/build/index.cjs
CHANGED
|
@@ -11108,7 +11108,7 @@ const liveServices = /*#__PURE__*/pipe(/*#__PURE__*/empty$s(), /*#__PURE__*/add$
|
|
|
11108
11108
|
const currentServices = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/DefaultServices/currentServices"), () => fiberRefUnsafeMakeContext(liveServices));
|
|
11109
11109
|
// circular with Clock
|
|
11110
11110
|
/** @internal */
|
|
11111
|
-
const sleep$
|
|
11111
|
+
const sleep$4 = duration => {
|
|
11112
11112
|
const decodedDuration = decode(duration);
|
|
11113
11113
|
return clockWith(clock => clock.sleep(decodedDuration));
|
|
11114
11114
|
};
|
|
@@ -12664,7 +12664,7 @@ const matchSimple = (concurrency, sequential, concurrent) => {
|
|
|
12664
12664
|
* @since 2.0.0
|
|
12665
12665
|
* @category constructors
|
|
12666
12666
|
*/
|
|
12667
|
-
const sleep$
|
|
12667
|
+
const sleep$3 = sleep$4;
|
|
12668
12668
|
/**
|
|
12669
12669
|
* @since 2.0.0
|
|
12670
12670
|
* @category constructors
|
|
@@ -12854,7 +12854,7 @@ const repeatN$1 = /*#__PURE__*/dual(2, (self, n) => suspend$7(() => repeatNLoop(
|
|
|
12854
12854
|
/* @internal */
|
|
12855
12855
|
const repeatNLoop = (self, n) => flatMap$7(self, a => n <= 0 ? succeed$9(a) : zipRight$4(yieldNow$2(), repeatNLoop(self, n - 1)));
|
|
12856
12856
|
/* @internal */
|
|
12857
|
-
const sleep$
|
|
12857
|
+
const sleep$2 = sleep$3;
|
|
12858
12858
|
/* @internal */
|
|
12859
12859
|
const succeedNone = /*#__PURE__*/succeed$9(/*#__PURE__*/none$7());
|
|
12860
12860
|
/* @internal */
|
|
@@ -17145,7 +17145,7 @@ const timeoutTo = /*#__PURE__*/dual(2, (self, {
|
|
|
17145
17145
|
duration,
|
|
17146
17146
|
onSuccess,
|
|
17147
17147
|
onTimeout
|
|
17148
|
-
}) => fiberIdWith$1(parentFiberId => uninterruptibleMask$2(restore => raceFibersWith(restore(self), interruptible$2(sleep$
|
|
17148
|
+
}) => fiberIdWith$1(parentFiberId => uninterruptibleMask$2(restore => raceFibersWith(restore(self), interruptible$2(sleep$2(duration)), {
|
|
17149
17149
|
onSelfWin: (winner, loser) => flatMap$7(winner.await, exit => {
|
|
17150
17150
|
if (exit._tag === "Success") {
|
|
17151
17151
|
return flatMap$7(winner.inheritAll, () => as$1(interruptAsFiber(loser, parentFiberId), onSuccess(exit.value)));
|
|
@@ -18062,7 +18062,7 @@ class ScheduleDriverImpl {
|
|
|
18062
18062
|
return setState.pipe(zipRight$4(updateInfo(this.iterationMeta, now, input, out)), as$1(out));
|
|
18063
18063
|
}
|
|
18064
18064
|
const duration = millis(millis$1);
|
|
18065
|
-
return pipe(setState, zipRight$4(updateInfo(this.iterationMeta, now, input, out)), zipRight$4(sleep$
|
|
18065
|
+
return pipe(setState, zipRight$4(updateInfo(this.iterationMeta, now, input, out)), zipRight$4(sleep$2(duration)), as$1(out));
|
|
18066
18066
|
}))))));
|
|
18067
18067
|
}
|
|
18068
18068
|
}
|
|
@@ -20952,7 +20952,7 @@ const forkScoped = forkScoped$1;
|
|
|
20952
20952
|
* @since 2.0.0
|
|
20953
20953
|
* @category Delays & Timeouts
|
|
20954
20954
|
*/
|
|
20955
|
-
const sleep = sleep$
|
|
20955
|
+
const sleep$1 = sleep$2;
|
|
20956
20956
|
/**
|
|
20957
20957
|
* Adds a time limit to an effect, triggering a timeout if the effect exceeds
|
|
20958
20958
|
* the duration.
|
|
@@ -89663,14 +89663,14 @@ const runMain = runMain$1;
|
|
|
89663
89663
|
({
|
|
89664
89664
|
...CommitPrototype$1});
|
|
89665
89665
|
|
|
89666
|
-
const BUILD_ENVS = ["local", "dev", "stage", "prod", "test"];
|
|
89666
|
+
const BUILD_ENVS = ["local", "dev", "qa", "stage", "prod", "test"];
|
|
89667
89667
|
const isBuildEnv = (value) => BUILD_ENVS.includes(value);
|
|
89668
89668
|
|
|
89669
|
-
const injectedBuildEnv = "
|
|
89669
|
+
const injectedBuildEnv = "dev".length > 0 ? "dev" : "local";
|
|
89670
89670
|
if (!isBuildEnv(injectedBuildEnv)) {
|
|
89671
89671
|
throw new Error(`Invalid AIPCTL_BUILD_ENV: ${injectedBuildEnv}`);
|
|
89672
89672
|
}
|
|
89673
|
-
const VERSION = "2026.
|
|
89673
|
+
const VERSION = "2026.7.1".length > 0 ? "2026.7.1" : "0.0.0";
|
|
89674
89674
|
const BUILD_ENV = injectedBuildEnv;
|
|
89675
89675
|
const INCLUDE_NATIVE_LOGS = BUILD_ENV !== "prod";
|
|
89676
89676
|
|
|
@@ -93492,7 +93492,7 @@ const startOAuthFlow = gen(function* () {
|
|
|
93492
93492
|
});
|
|
93493
93493
|
const callback = yield* raceFirst(
|
|
93494
93494
|
_await(deferred),
|
|
93495
|
-
sleep("5 minutes").pipe(flatMap$5(() => fail$3(new Error("Login timeout"))))
|
|
93495
|
+
sleep$1("5 minutes").pipe(flatMap$5(() => fail$3(new Error("Login timeout"))))
|
|
93496
93496
|
);
|
|
93497
93497
|
yield* sync$1(() => {
|
|
93498
93498
|
console.log("Authorization received. Exchanging token...");
|
|
@@ -93643,6 +93643,8 @@ class ApiServiceTag extends Tag$1("ApiService")() {
|
|
|
93643
93643
|
}
|
|
93644
93644
|
const REFRESH_BUFFER_MS = 6e4;
|
|
93645
93645
|
const JSON_CONTENT_TYPE = "application/json";
|
|
93646
|
+
const AGENT_CHAT_STREAM_RETRY_DELAY_MS = 1e3;
|
|
93647
|
+
const AGENT_CHAT_STREAM_MAX_ATTEMPTS = 4;
|
|
93646
93648
|
function bearerHeaders(accessToken) {
|
|
93647
93649
|
return { Authorization: `Bearer ${accessToken}` };
|
|
93648
93650
|
}
|
|
@@ -93666,6 +93668,13 @@ function apiErrorFromUnknown(error, fallbackMessage) {
|
|
|
93666
93668
|
message: error instanceof Error ? error.message : fallbackMessage
|
|
93667
93669
|
});
|
|
93668
93670
|
}
|
|
93671
|
+
class AgentChatStreamIncompleteError extends Error {
|
|
93672
|
+
constructor(sawOnlyTerminalEnvelope) {
|
|
93673
|
+
super("Agent chat stream ended without a complete event");
|
|
93674
|
+
this.sawOnlyTerminalEnvelope = sawOnlyTerminalEnvelope;
|
|
93675
|
+
this.name = "AgentChatStreamIncompleteError";
|
|
93676
|
+
}
|
|
93677
|
+
}
|
|
93669
93678
|
function normalizeAutomationPagination(pagination) {
|
|
93670
93679
|
return {
|
|
93671
93680
|
page: pagination.page ?? pagination.pageNumber ?? 1,
|
|
@@ -93779,6 +93788,9 @@ async function rateLimitedFetch(input, init) {
|
|
|
93779
93788
|
await release();
|
|
93780
93789
|
}
|
|
93781
93790
|
}
|
|
93791
|
+
async function sleep(ms) {
|
|
93792
|
+
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
93793
|
+
}
|
|
93782
93794
|
async function toApiError(response) {
|
|
93783
93795
|
let errorData = {};
|
|
93784
93796
|
try {
|
|
@@ -93837,27 +93849,67 @@ const getResponseMessageText = (responseMessage) => {
|
|
|
93837
93849
|
}
|
|
93838
93850
|
return contentText;
|
|
93839
93851
|
};
|
|
93852
|
+
const extractFinalAgentChatResult = (parsed) => {
|
|
93853
|
+
if (parsed["final"] !== true) {
|
|
93854
|
+
return null;
|
|
93855
|
+
}
|
|
93856
|
+
const conversation = parsed["conversation"];
|
|
93857
|
+
const conversationId = conversation?.conversationId;
|
|
93858
|
+
if (typeof conversationId !== "string") {
|
|
93859
|
+
return null;
|
|
93860
|
+
}
|
|
93861
|
+
const text = getResponseMessageText(parsed["responseMessage"]);
|
|
93862
|
+
return text === void 0 ? null : { text, conversationId };
|
|
93863
|
+
};
|
|
93864
|
+
const parseStreamEnvelopeData = (data) => {
|
|
93865
|
+
if (typeof data === "string") {
|
|
93866
|
+
try {
|
|
93867
|
+
const parsed = JSON.parse(data);
|
|
93868
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
93869
|
+
} catch {
|
|
93870
|
+
return null;
|
|
93871
|
+
}
|
|
93872
|
+
}
|
|
93873
|
+
return data && typeof data === "object" && !Array.isArray(data) ? data : null;
|
|
93874
|
+
};
|
|
93840
93875
|
const parseAgentChatEvent = (data) => {
|
|
93841
93876
|
try {
|
|
93842
93877
|
const parsed = JSON.parse(data);
|
|
93843
|
-
if (parsed["
|
|
93844
|
-
|
|
93878
|
+
if (parsed["type"] === "error") {
|
|
93879
|
+
throw createApiError({
|
|
93880
|
+
message: typeof parsed["data"] === "string" ? parsed["data"] : "Agent chat stream failed"
|
|
93881
|
+
});
|
|
93845
93882
|
}
|
|
93846
|
-
|
|
93847
|
-
|
|
93848
|
-
|
|
93849
|
-
|
|
93883
|
+
if (parsed["type"] === "event") {
|
|
93884
|
+
const eventPayload = parseStreamEnvelopeData(parsed["data"]);
|
|
93885
|
+
return eventPayload ? extractFinalAgentChatResult(eventPayload) : null;
|
|
93886
|
+
}
|
|
93887
|
+
if (parsed["type"] === "message-final") {
|
|
93888
|
+
const value = parsed["value"];
|
|
93889
|
+
return value && typeof value === "object" ? extractFinalAgentChatResult(value) : null;
|
|
93890
|
+
}
|
|
93891
|
+
return extractFinalAgentChatResult(parsed);
|
|
93892
|
+
} catch (error) {
|
|
93893
|
+
if (error instanceof ApiError) {
|
|
93894
|
+
throw error;
|
|
93850
93895
|
}
|
|
93851
|
-
const text = getResponseMessageText(parsed["responseMessage"]);
|
|
93852
|
-
return text === void 0 ? null : { text, conversationId };
|
|
93853
|
-
} catch {
|
|
93854
93896
|
return null;
|
|
93855
93897
|
}
|
|
93856
93898
|
};
|
|
93899
|
+
const isTerminalStreamEnvelope = (data) => {
|
|
93900
|
+
try {
|
|
93901
|
+
const parsed = JSON.parse(data);
|
|
93902
|
+
return parsed["type"] === "end" || parsed["type"] === "abort";
|
|
93903
|
+
} catch {
|
|
93904
|
+
return false;
|
|
93905
|
+
}
|
|
93906
|
+
};
|
|
93857
93907
|
const parseSseStream = async (body) => {
|
|
93858
93908
|
const reader = body.getReader();
|
|
93859
93909
|
const decoder = new TextDecoder();
|
|
93860
93910
|
let buffer = "";
|
|
93911
|
+
let hasDataEvent = false;
|
|
93912
|
+
let sawOnlyTerminalEnvelope = false;
|
|
93861
93913
|
try {
|
|
93862
93914
|
while (true) {
|
|
93863
93915
|
const { done, value } = await reader.read();
|
|
@@ -93870,6 +93922,12 @@ const parseSseStream = async (body) => {
|
|
|
93870
93922
|
if (!data) {
|
|
93871
93923
|
continue;
|
|
93872
93924
|
}
|
|
93925
|
+
hasDataEvent = true;
|
|
93926
|
+
if (isTerminalStreamEnvelope(data)) {
|
|
93927
|
+
sawOnlyTerminalEnvelope = true;
|
|
93928
|
+
continue;
|
|
93929
|
+
}
|
|
93930
|
+
sawOnlyTerminalEnvelope = false;
|
|
93873
93931
|
const result = parseAgentChatEvent(data);
|
|
93874
93932
|
if (result) {
|
|
93875
93933
|
return result;
|
|
@@ -93879,7 +93937,7 @@ const parseSseStream = async (body) => {
|
|
|
93879
93937
|
} finally {
|
|
93880
93938
|
reader.releaseLock();
|
|
93881
93939
|
}
|
|
93882
|
-
throw
|
|
93940
|
+
throw new AgentChatStreamIncompleteError(hasDataEvent && sawOnlyTerminalEnvelope);
|
|
93883
93941
|
};
|
|
93884
93942
|
const ApiServiceLive = effect$1(
|
|
93885
93943
|
ApiServiceTag,
|
|
@@ -93998,32 +94056,69 @@ const ApiServiceLive = effect$1(
|
|
|
93998
94056
|
});
|
|
93999
94057
|
const baseUrl = () => loadConfiguredApiBaseUrl();
|
|
94000
94058
|
const chatBaseUrl = () => loadConfiguredChatBaseUrl();
|
|
94001
|
-
const
|
|
94059
|
+
const subscribeAgentChatStream = (orgSlug, conversationId, token) => gen(function* () {
|
|
94002
94060
|
const resolvedChatBaseUrl = yield* requireChatBaseUrlEffect();
|
|
94003
|
-
const
|
|
94061
|
+
const path = `/api/${encodeURIComponent(orgSlug)}/conversations/${encodeURIComponent(conversationId)}/stream`;
|
|
94004
94062
|
return yield* tryPromise({
|
|
94005
94063
|
try: async () => {
|
|
94006
|
-
|
|
94007
|
-
|
|
94008
|
-
|
|
94009
|
-
|
|
94010
|
-
|
|
94011
|
-
|
|
94012
|
-
|
|
94013
|
-
|
|
94014
|
-
|
|
94015
|
-
|
|
94064
|
+
for (let attempt = 1; attempt <= AGENT_CHAT_STREAM_MAX_ATTEMPTS; attempt += 1) {
|
|
94065
|
+
const response = await rateLimitedFetch(`${resolvedChatBaseUrl}${path}`, {
|
|
94066
|
+
method: "POST",
|
|
94067
|
+
headers: jsonBearerHeaders(token),
|
|
94068
|
+
body: JSON.stringify({})
|
|
94069
|
+
});
|
|
94070
|
+
if (!response.ok) {
|
|
94071
|
+
throw await toApiError(response);
|
|
94072
|
+
}
|
|
94073
|
+
if (!response.body) {
|
|
94074
|
+
throw createApiError({ message: "No response body from agent chat stream endpoint" });
|
|
94075
|
+
}
|
|
94076
|
+
try {
|
|
94077
|
+
return await parseSseStream(response.body);
|
|
94078
|
+
} catch (error) {
|
|
94079
|
+
if (error instanceof AgentChatStreamIncompleteError && error.sawOnlyTerminalEnvelope && attempt < AGENT_CHAT_STREAM_MAX_ATTEMPTS) {
|
|
94080
|
+
await sleep(AGENT_CHAT_STREAM_RETRY_DELAY_MS);
|
|
94081
|
+
continue;
|
|
94082
|
+
}
|
|
94083
|
+
throw error;
|
|
94084
|
+
}
|
|
94016
94085
|
}
|
|
94017
|
-
|
|
94086
|
+
throw new AgentChatStreamIncompleteError(true);
|
|
94018
94087
|
},
|
|
94019
94088
|
catch: (error) => {
|
|
94020
94089
|
if (error instanceof ApiError) return error;
|
|
94090
|
+
if (error instanceof AgentChatStreamIncompleteError) {
|
|
94091
|
+
return createApiError({ message: error.message });
|
|
94092
|
+
}
|
|
94021
94093
|
return createApiError({
|
|
94022
94094
|
message: error instanceof Error ? error.message : "Agent chat failed"
|
|
94023
94095
|
});
|
|
94024
94096
|
}
|
|
94025
94097
|
});
|
|
94026
94098
|
});
|
|
94099
|
+
const startAgentChat = (orgSlug, body) => gen(function* () {
|
|
94100
|
+
const token = yield* getAccessToken();
|
|
94101
|
+
const startPath = `/api/${encodeURIComponent(orgSlug)}/conversations/agent-chat`;
|
|
94102
|
+
const startResponse = yield* makeRequest(chatBaseUrl, startPath, token, {
|
|
94103
|
+
method: "POST",
|
|
94104
|
+
body
|
|
94105
|
+
});
|
|
94106
|
+
return yield* subscribeAgentChatStream(orgSlug, startResponse.conversationId, token);
|
|
94107
|
+
});
|
|
94108
|
+
const resolveAgentInstallationId = (orgSlug, conversationId, token) => gen(function* () {
|
|
94109
|
+
const conversation = yield* makeRequest(
|
|
94110
|
+
chatBaseUrl,
|
|
94111
|
+
`/librechat/api/${encodeURIComponent(orgSlug)}/convos/${encodeURIComponent(conversationId)}`,
|
|
94112
|
+
token
|
|
94113
|
+
);
|
|
94114
|
+
if (!conversation?.agentInstallationId) {
|
|
94115
|
+
return yield* fail$3(createApiError({
|
|
94116
|
+
message: `Conversation "${conversationId}" is missing an agent installation id.`,
|
|
94117
|
+
statusCode: 400
|
|
94118
|
+
}));
|
|
94119
|
+
}
|
|
94120
|
+
return conversation.agentInstallationId;
|
|
94121
|
+
});
|
|
94027
94122
|
return {
|
|
94028
94123
|
listOrganizations: () => gen(function* () {
|
|
94029
94124
|
const token = yield* getAccessToken();
|
|
@@ -94798,14 +94893,17 @@ const ApiServiceLive = effect$1(
|
|
|
94798
94893
|
});
|
|
94799
94894
|
}),
|
|
94800
94895
|
// Agent headless chat
|
|
94801
|
-
agentNewChat: (orgSlug, agentInstallationId, text) =>
|
|
94802
|
-
|
|
94803
|
-
|
|
94804
|
-
|
|
94805
|
-
|
|
94806
|
-
|
|
94807
|
-
|
|
94808
|
-
|
|
94896
|
+
agentNewChat: (orgSlug, agentInstallationId, text) => startAgentChat(orgSlug, { agentInstallationId, text, files: [] }),
|
|
94897
|
+
agentChat: (orgSlug, conversationId, text) => gen(function* () {
|
|
94898
|
+
const token = yield* getAccessToken();
|
|
94899
|
+
const agentInstallationId = yield* resolveAgentInstallationId(orgSlug, conversationId, token);
|
|
94900
|
+
return yield* startAgentChat(orgSlug, {
|
|
94901
|
+
agentInstallationId,
|
|
94902
|
+
conversationId,
|
|
94903
|
+
text,
|
|
94904
|
+
files: []
|
|
94905
|
+
});
|
|
94906
|
+
})
|
|
94809
94907
|
};
|
|
94810
94908
|
})
|
|
94811
94909
|
);
|
|
@@ -97713,7 +97811,7 @@ const startOrganizationSelectionBrowserFlow = (knownOrganizations) => gen(functi
|
|
|
97713
97811
|
});
|
|
97714
97812
|
const callback = yield* raceFirst(
|
|
97715
97813
|
_await(deferred),
|
|
97716
|
-
sleep("5 minutes").pipe(flatMap$5(() => fail$3(new Error(ORG_SELECTION_TIMEOUT_MESSAGE))))
|
|
97814
|
+
sleep$1("5 minutes").pipe(flatMap$5(() => fail$3(new Error(ORG_SELECTION_TIMEOUT_MESSAGE))))
|
|
97717
97815
|
);
|
|
97718
97816
|
return yield* saveSelectedOrganization(callback.slug, knownOrganizations);
|
|
97719
97817
|
}).pipe(ensuring$1(promise$1(() => closeServer())));
|
package/docs/architecture.md
CHANGED
|
@@ -60,6 +60,7 @@ desktop/packages/cli/
|
|
|
60
60
|
- package base version: `0.0.0`
|
|
61
61
|
- publish-time CalVer가 `AIPCTL_VERSION`으로 TS bundle과 Go ldflags에 주입됩니다.
|
|
62
62
|
- `AIPCTL_BUILD_ENV`는 `local|dev|stage|prod|test` 중 하나이며 `logs` gating에 사용됩니다.
|
|
63
|
+
- native input hash가 이전 발행본과 같으면 platform package를 새로 빌드하지 않고 기존 version을 재사용합니다.
|
|
63
64
|
|
|
64
65
|
## Dependency direction
|
|
65
66
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aipctl",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.7.1",
|
|
4
4
|
"description": "QueryPie AIP and MCP CLI tool",
|
|
5
5
|
"author": "QueryPie",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -22,14 +22,16 @@
|
|
|
22
22
|
"node": ">=24.18.0"
|
|
23
23
|
},
|
|
24
24
|
"metadata": {
|
|
25
|
-
"contentHash": "
|
|
25
|
+
"contentHash": "af530f42e5ea5a74adb553dd20edc2b693a157bce934f1cb89756f0793eb9fbe",
|
|
26
|
+
"wrapperHash": "a5cdccd7a4d3b6be014e48d99deafbd43ba35b96e65e66db0afa65c75615da42",
|
|
27
|
+
"nativeHash": "220fe3ebd9647cf1fcab88dfe86a0e30534917a2d4533e6dfee338083402c848"
|
|
26
28
|
},
|
|
27
29
|
"optionalDependencies": {
|
|
28
|
-
"aipctl-darwin-x64": "2026.
|
|
29
|
-
"aipctl-darwin-arm64": "2026.
|
|
30
|
-
"aipctl-linux-x64": "2026.
|
|
31
|
-
"aipctl-linux-arm64": "2026.
|
|
32
|
-
"aipctl-windows-x64": "2026.
|
|
33
|
-
"aipctl-windows-arm64": "2026.
|
|
30
|
+
"aipctl-darwin-x64": "2026.7.1",
|
|
31
|
+
"aipctl-darwin-arm64": "2026.7.1",
|
|
32
|
+
"aipctl-linux-x64": "2026.7.1",
|
|
33
|
+
"aipctl-linux-arm64": "2026.7.1",
|
|
34
|
+
"aipctl-windows-x64": "2026.7.1",
|
|
35
|
+
"aipctl-windows-arm64": "2026.7.1"
|
|
34
36
|
}
|
|
35
37
|
}
|